Troubleshooting connectivity when curl returns ’empty reply’ from a server on the computer only

curlmac-osxmalwarenetworking

For whatever reason, my computer (Mac OS X 10.11.1) cannot fetch a webpage from a website using curl when it works fine on other computers. Also ping works but curl doesn't:

$ ping www.latex-tutorial.com
PING latex-tutorial.com (162.252.172.25): 56 data bytes
64 bytes from 162.252.172.25: icmp_seq=0 ttl=54 time=76.116 ms
64 bytes from 162.252.172.25: icmp_seq=1 ttl=54 time=74.538 ms
64 bytes from 162.252.172.25: icmp_seq=2 ttl=54 time=90.379 ms
^C
--- latex-tutorial.com ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 74.538/80.344/90.379/7.125 ms

Now when curl was executed on the problematic machine several times:

$ curl http://www.latex-tutorial.com
curl: (52) Empty reply from server
$ curl -Lv http://www.latex-tutorial.com
* Rebuilt URL to: http://www.latex-tutorial.com/
*   Trying 2a02:748:a800:162:252:172:25::...
* Connected to www.latex-tutorial.com (::1) port 80 (#0)
> GET / HTTP/1.1
> Host: www.latex-tutorial.com
> User-Agent: curl/7.43.0
> Accept: */*
>
* Empty reply from server
* Connection #0 to host www.latex-tutorial.com left intact
curl: (52) Empty reply from server

When I execute the same command on a different Mac laptop (same version) in the same network, I do get a correct html web page every time. What could possibly be wrong with my machine? I did download a few things off the internet where my machine could have potentially contracted a virus/malware, but my antivirus program wasn't able to detect anything.

Can anyone point me to where I should start looking for errors?

Best Answer

Try adding the -4 option to your curl command line. Alternatively, try http://162.252.172.25 and see what you get. The ping is using that address, which is an IPv4 address. The curl is using IPv6, with an address starting with 2a02. Not all IPv6 stacks are equally robust - perhaps yours has connection issues.

Related Topic