From RFC7230 Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing
When a client wishes to request OPTIONS for the server as a whole, as opposed to a specific named resource of that server, the client must send only "*" (%x2A) as the request-target.
To test how my site reacts I want to send the following request to the server.
OPTIONS * HTTP/1.1
I know I can use telnet, write my own client, etc. But I want to know if it's possible to do it with cURL?
Edit
This can NOT be done with curl -X OPTIONS http://example.org
, as suggested in a similar, but not identical, question That command will send OPTIONS http://example.org/ HTTP/1.1
. I want to know if it's possible to send the asterisk with cURL.
Using
-X OPTIONS
only will send a slash and not an asterisk as path in the request.In order to send a plain
OPTIONS *
to the server with curl, you need curl 7.55.0 or later and its --request-target option in addition to the-X
flag. Used like this:You can send custom requests with cURL by using the -x option, https://curl.haxx.se/docs/manpage.html#-x
So this command would look like this