1

Using output from the command below,

% curl -v stackoverflow.com/questions * About to connect() to stackoverflow.com port 80 (#0) * Trying 198.252.206.16... * Connected to stackoverflow.com (198.252.206.16) port 80 (#0) > GET /questions HTTP/1.1 > User-Agent: curl/7.29.0 > Host: stackoverflow.com > Accept: */* 

I could do curl -X GET -H "User-Agent: curl/7.29.0" -H "Host: stackoverflow.com" -H "Accept: */*" 198.252.206.16 to replicate the request but how do I specify the GET /questions in my command?

2 Answers 2

1
stackoverflow.com/questions 

= GET /questions

stackoverflow.com/87whjjgaas.asd 

= GET /87whjjgaas.asd

23.123.123.123/questions 

= GET /questions

for

curl -X GET -H "User-Agent: curl/7.29.0" -H "Host: stackoverflow.com" -H "Accept: /" 198.252.206.16

Answer is

curl -X GET -H "User-Agent: curl/7.29.0" -H "Host: stackoverflow.com" -H "Accept: /" 198.252.206.16/questions

:)

1

I needed to see how server behaved with certain "wrong" paths. To stop curl from normalizing a path, there is the --path-as-is option.

curl --path-as-is http://www.example.com/_cdn_assets_/./../font-awesome/4.3.0/css/font-awesome.css 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.