-6

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.

1

1 Answer 1

6

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.

2
  • 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.
    – user313992
    Commented Jan 31, 2019 at 1:01
  • @mosvy Yes, well, my own sites respond "400 Bad request", but that's not what the TRACE method is for :-) Commented Jan 31, 2019 at 1:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .