M
M
Mouvdy2015-01-15 02:13:14
HTTP headers
Mouvdy, 2015-01-15 02:13:14

How to get HTTP header as fast as possible?

Tell me how quickly (faster than using curl) to get the http header from a remote server - HTTP / 1.1 200 OK (for example, I have 300,000 urls) to find out / check if the file exists I
run it like this:

curl --connect-timeout 1 -Is site.com/image/325.jpg 2>/dev/null | head -n1
if [ "$Iswork" == "HTTP/1.1 200 OK
" ];
then
...............

Is it possible to speed up? Perhaps there is something else instead of curl?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eddy_Em, 2015-01-15
@Eddy_Em

Yes, it’s elementary to do it yourself: connect to the socket, read only the header (say, request 128 bytes), break the connection and process the header.
But here the biggest gag is the data transfer rate, so what's the point of such perversions?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question