Home > Blockchain >  What else could curl cause a server to respond differently in comparison with wget?
What else could curl cause a server to respond differently in comparison with wget?

Time:10-03

I'm trying to figure out why I get one response for a curl request and a completely different response for a wget request. I set some flags for curl to make the request look like wget's one, and now I can see that both of them produce exactly the same request headers, but the responses are still different. What am I missing in all of this?

wget -d https://www.pornhub.com/view_video.php?viewkey=ph612e60227add0 -O wget.html

GET /view_video.php?viewkey=ph612e60227add0 HTTP/1.1
User-Agent: Wget/1.20.1 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: www.pornhub.com
Connection: Keep-Alive

HTTP/1.1 200 OK
server: openresty
date: Thu, 30 Sep 2021 16:48:12 GMT
content-type: text/html; charset=UTF-8
transfer-encoding: chunked
set-cookie: ua=ba5c6642243608779b026b59a8ebce83; expires=Fri, 01-Oct-2021 16:48:12 GMT; Max-Age=86400; path=/; domain=pornhub.com
set-cookie: platform=pc; expires=Thu, 07-Oct-2021 16:48:12 GMT; Max-Age=604800; path=/; domain=pornhub.com
set-cookie: bs=7r3ar0i5oz0r0d61yo30bc8ii1ghxoti; expires=Sun, 28-Sep-2031 16:48:12 GMT; Max-Age=315360000; path=/; domain=pornhub.com; secure; SameSite=None
set-cookie: ss=754597106371434372; expires=Fri, 30-Sep-2022 16:48:12 GMT; Max-Age=31536000; path=/; domain=pornhub.com
x-frame-options: SAMEORIGIN
vary: User-Agent
rating: RTA-5042-1996-1400-1577-RTA
x-request-id: 6155EA4C-42FE722901BBC4F1-2C741E4

curl --http1.1 --trace-ascii curl-trace.txt -H "User-Agent: Wget/1.20.1 (linux-gnu)" -H "Accept-Encoding: identity" -H "Connection: Keep-Alive" https://www.pornhub.com/view_video.php?viewkey=ph612e60227add0 -o curl.html

GET /view_video.php?viewkey=ph612e60227add0 HTTP/1.1
Host: www.pornhub.com
Accept: */*
User-Agent: Wget/1.20.1 (linux-gnu)
Accept-Encoding: identity
Connection: Keep-Alive

HTTP/1.1 200 OK
server: openresty
date: Thu, 30 Sep 2021 16:48:04 GMT
content-type: text/html
last-modified: Mon, 27 Sep 2021 22:14:56 GMT
transfer-encoding: chunked
set-cookie: ua=ba5c6642243608779b026b59a8ebce83; expires=Fri, 01-Oct-2021 16:48:04 GMT; Max-Age=86400; path=/; domain=pornhub.com
set-cookie: platform_cookie_reset=pc; expires=Sat, 30-Oct-2021 16:48:04 GMT; Max-Age=2592000; path=/; domain=pornhub.com
set-cookie: platform=pc; expires=Thu, 07-Oct-2021 16:48:04 GMT; Max-Age=604800; path=/; domain=pornhub.com
set-cookie: bs=o6y9u4ve1b14ynrqg056hqspry2wnj2u; expires=Sun, 28-Sep-2031 16:48:04 GMT; Max-Age=315360000; path=/; domain=pornhub.com
set-cookie: ss=140499405219430468; expires=Fri, 30-Sep-2022 16:48:04 GMT; Max-Age=31536000; path=/; domain=pornhub.com
set-cookie: fg_9d12f2b2865de2f8c67706feaa332230=22967.100000; expires=Sat, 30-Oct-2021 16:48:04 GMT; Max-Age=2592000; path=/; domain=pornhub.com
x-frame-options: SAMEORIGIN
x-mg-s: 0
vary: User-Agent
rating: RTA-5042-1996-1400-1577-RTA
x-request-id: 6155EA44-42FE722901BBD8BD-2DC3FD2

CodePudding user response:

Okay, I don't know why it works this way, but the curl flag --tlsv1.3 helped me.

  • Related