如何将指定的数据量之后中断的WebRequest(GET)?如何将、数据、GET、WebRequest

2023-09-04 23:12:50 作者:记忆零碎、

当我找出HTTP HEAD方法并不总是可靠的做法: HTTP头的可靠性方法

是否有可能以模拟HTTP HEAD方法的HTTP GET方法?我的意思是我只需要回答的标题,所以应该足以限制最大数据量。我可以这样做,在.NET?

谢谢!

解决方案   

是否有可能以模拟HTTP HEAD方法的HTTP GET方法?

不,当然不是。 GET请求总是与身体的反应。这就是HTTP规范说。所以,除非你找到它违反了HTTP规范,我不认为它会工作的Web服务器。只有头部动词的设计是实现你所期待的。

As I find out the HTTP HEAD method is not always reliable in practice: Reliability of HTTP HEAD method

Is it possible to emulate the HTTP HEAD method with the HTTP GET method? I mean I just need headers of the answer so it should suffice to restrict maximum amount of data. Can I do that in .NET?

dataShareSetting

Thanks!

解决方案

Is it possible to emulate the HTTP HEAD method with the HTTP GET method?

No, of course not. A GET request always comes with a body in response. That's what the HTTP specification says. So unless you find a web server which violates the HTTP specification I don't think it will work. Only the HEAD verb is designed to achieve what you are looking for.

 
精彩推荐
图片推荐