我需要使用pycurl发送HTTP HEAD请求。
这段代码:
产生一个错误:
这段代码:
curl = pycurl.Curl()
...
curl.setopt(curl.CUSTOMREQUEST, "HEAD")
curl.perform()
产生一个错误:
< HTTP/1.1 200 OK
* Server nginx/1.6.2 is not blacklisted
< Server: nginx/1.6.2
< Date: # No matters
< Content-Type: text/html; charset=utf-8
< Connection: keep-alive
< Cache-Control: no-cache,no-store,must-revalidate
< Pragma: no-cache
< Expires: # No matters
< Last-Modified: # No matters
< Content-Security-Policy: # No matters
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: # No matters
< X-Content-Type-Options: nosniff
< Content-Encoding: gzip
* no chunk, no close, no size. Assume close to signal end
<
* Operation timed out after 15001 milliseconds with 0 bytes received
* Closing connection 1
有人能帮我吗?
curl.setopt(curl.NOBODY, True)
,现在它可以工作了! - StasEvseev