-8

Does HTTP TRACE method do the same thing as curl --trace?

Stephen said at Does `curl -v` show the complete HTTP request including the body?:

the TRACE HTTP method affects the server’s behaviour, not the client’s (curl’s)

As far as what curl receives is concerned, HTTP TRACE method and curl --trace seem to provide the same information to curl. Correct? If not, what differences are between the information provided by HTTP TRACE method and information provided by curl --trace?

If considering how the information is collected, do the two ways do the same thing to collect the information?

Thanks.

  • --trace doesn’t change the HTTP method used, it causes curl to dump all outgoing and incoming data to a file. You already got an answer. They're unrelated. – 炸鱼薯条德里克 Jan 30 at 23:48
  • What clients will receive purely depends on the request data and the current server status. It has nothing to do with --trace. – 炸鱼薯条德里克 Jan 30 at 23:51
  • "all outgoing and incoming data" do you mean HTTP request and response only? What information does TRACE method provide then? – Tim Jan 31 at 2:08
  • What else do you think HTTP have? As for TRACE method, see the answer by Stephen. It also depends on the server because not all the servers are standard. After all, HTTP standard is just document, not code. – 炸鱼薯条德里克 Jan 31 at 2:32
  • 4
4

The HTTP TRACE method provides a "message test" mechanism. It basically returns back what the client sent.

So, for example if a client sent

TRACE / HTTP/1.1
Host: foo
Bar: baz

then it might expect back something like

HTTP/1.1 200 OK
Server: myserver
Date: Wed, 31 Jan 2019 01:37:48 GMT
Connection: close
Content-Type: message/http
Content-Length: 39

TRACE / HTTP/1.1
Host: foo
Bar: baz

This is totally unrelated to the curl --trace option, which provides detailed information around the normal request (eg GET) made by the client.

  • FWIW, the only purpose of the TRACE method is to generate a 400 or 405 error from the server. With many sites (eg. google or facebook), the EXTERMINATE method will do that, too. – mosvy Jan 31 at 1:01
  • @mosvy Yes, well, my own sites respond "400 Bad request", but that's not what the TRACE method is for :-) – Stephen Harris Jan 31 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.