How can I perform a GET request without downloading the content?

前端 未结 3 1164
后悔当初
后悔当初 2021-01-31 09:40

I am working on a link checker, in general I can perform HEAD requests, however some sites seem to disable this verb, so on failure I need to also perform a G

3条回答
  •  走了就别回头了
    2021-01-31 09:56

    If you are using a GET request, you will receive the message-body whether you want to or not. The data will still be transmitted to your endpoint regardless of whether or not you read it from the socket or not. The data will just stay queued in the RecvQ waiting to be selected out.

    For this, you really should be using a "HEAD" request if possible, which will spare you the message body.

提交回复
热议问题