Closed winstonma closed 9 months ago
Tested this. The server sends a RST (Reset) after submitting the request. Probably some user-agent or ssl sniffing in place at the site.
curl 8.5.0 on debian seems to behave the same way
@icing Just some additional information. I can use wget
with custom user-agent (please check the first command in the first post) to grab the webpage. But I tried to add the same user-agent in curl command it seems it doesn't work. Also if I use wget
without custom user-agent it would not work too.
Not sure if that help
It looks like the server does not send any data to curl.
Curious I tried wget 1.21.4 (also on debian), only to find it hangs for me the exact same way...
It looks like the server does not send any data to curl.
Curious I tried wget 1.21.4 (also on debian), only to find it hangs for me the exact same way...
Could you try the following command? I could download using the following command with wget 1.21.2 is working on Ubuntu.
wget -U 'Mozilla/5.0' https://www.amd.com/en.html
I think the website need user agent to get it work. That's why I added the same user agent in the freezing curl
command
Tested this. The server sends a RST (Reset) after submitting the request. Probably some user-agent or ssl sniffing in place at the site.
Just wonder if timeout mechanism should be added in curl or should curl exit when RST is received?
I could download using the following command with wget 1.21.2 is working on Ubuntu.
I can reproduce in Ubuntu. The wget request works and the curl request doesn't. However I used wget -d to get the request headers and then sent those same request headers using curl and it worked.
---request begin---
GET /en.html HTTP/1.1
User-Agent: Mozilla/5.0
Accept: */*
Accept-Encoding: identity
Host: www.amd.com
Connection: Keep-Alive
---request end---
curl -v -A Mozilla/5.0 --http1.1 -H "Accept-Encoding: identity" -H "Connection: Keep-Alive" -O https://www.amd.com/en.html
> GET /en.html HTTP/1.1
> Host: www.amd.com
> User-Agent: Mozilla/5.0
> Accept: */*
> Accept-Encoding: identity
> Connection: Keep-Alive
If I take away either Accept-Encoding
or Connection
the server will not reply. Possibly what is happening is this is a CDN server that can return a cached version of a page that is tied to a particular combination of headers. However, if it does not recognize the combination of headers then it will connect to the origin server with those headers to retrieve the page, add to its cache and return the response to the client. Sometimes it is tied to a user agent and sometimes it isn't.
The server isn't responding probably because the origin server isn't responding. It just happens to work for some combination of headers because the page is already cached for that combination.
curl is behaving as intended. If the request is successfully sent it will wait indefinitely for a response unless you set a timeout with --max-time.
@jay Thanks for the answer. Not only I learn the debugging process but also learn how the CDN response.
I did this
I would like to curl AMD website. I could wget it but I couldn't figure out how to get curl working.
I expected the following
I expect that curl command comes with an error or curl with success
curl/libcurl version
curl 8.4.0 (x86_64-conda-linux-gnu) libcurl/8.4.0 OpenSSL/3.0.12 zlib/1.2.13 libssh2/1.10.0 nghttp2/1.57.0 Release-Date: 2023-10-11 Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz NTLM SPNEGO SSL threadsafe TLS-SRP UnixSockets
operating system
Linux notebook 6.6.6-zabbly+ #ubuntu22.04 SMP PREEMPT_DYNAMIC Mon Dec 11 17:02:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux