gpt4 book ai didi

http - 如何获得 HTTP 100 继续在嵌入式 Grizzly 上为 WebDAV 工作?

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:13:26 26 4
gpt4 key购买 nike

我正在使用带有嵌入式 Grizzly servlet 容器 (2.1.7) 的 Milton WebDAV 服务器 (1.6.8),在它们的默认配置中,PUT 请求(至少由 Cyber​​duck 发出)不起作用。我已将问题归结为 HTTP 100 Continue 处理方式的问题(它显然也影响 Jetty),Milton mailing list 上的一条消息和 bug tracker说这是 servlet 容器的错误,它试图通过“透明的期望/继续处理”变得聪明。

Yes, containers which transparently handle expect continue effectively break HTTP security for Webdav. HTTP uses a challenge/response security model and many clients rely on that. Ie if doing a PUT they will simply do an un-authenticated PUT and rely on ExpectContinue to ensure that the challenge is issued before the file is uploaded.

But with transparent handling of ExpectContinue the entire file gets uploaded before the milton API is able to check if the current user is authenticated and authorised to perform the action.

Depending on your supported clients and you use cases this can either be wholely unacceptable, a nuisance or not an issue at all.

But, generally, I think you should try to find out if Grizzly's transparent handling can be disabled, and then re-enable support in milton.

我可以做些什么来禁用 Grizzly 的透明期望/继续处理,这种方法真的正确吗?另一种方法是关闭 Milton 中的 expect/continue 处理,但这似乎会破坏 WebDAV 身份验证。

更新:我现在也尝试了 Jetty (8.1.0.RC1),它表现出与 Grizzly 相同的行为:只有关闭 expect/continue 处理,我才能使用默认的 PUT 文件设置它不起作用。

最佳答案

关于 Grizly 2.x,您需要重写 ServletHandler 中的 sendAcknowledgment 方法,如下所示:

class MyServletHandler extends ServletHandler
{
protected boolean sendAcknowledgment(final Request request,
final Response response)
throws IOException
{
if (authClient(request, response)
{
return super.sendAcknowledgment(request, response);
}
else
{
response.setStatus(HttpStatus.EXPECTATION_FAILED_417);
return false;
}
}
}

希望对您有所帮助。

关于http - 如何获得 HTTP 100 继续在嵌入式 Grizzly 上为 WebDAV 工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8380324/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com