targeted http request status code only or file size only making sure to put least possible load/traffic on the destination server

StackOverflow https://stackoverflow.com/questions/19283440

문제

if curl --head http://.... includes "301" or "404" then ... if curl --head http://.... has content-Length > 1000000 then ...

how to be put the least possible load on the destination server when doing many of such requests?

is it possible to only request the first line of the http answer or even only the 3 digits of the status code(/content length) but nothing else, to minimize traffic?

(actually, is there any alternative http field next to content-length indicating file size?)

thanks!

도움이 되었습니까?

해결책

If you cannot modify server to return something small and useful - then the only option is HEAD http method to request only headers of response, all methods can be found here.

Content-length is standard way to tell the length of HTTP body, there are no other ways or they are very server specific, check http rfc

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top