Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send a HTTP OPTIONS request from the command line?

Tags:

curl

wget

I tried to use cURL but it seems that by default (Debian) is not compiled with HTTPS support and I dont want to build it myself.

wget seems to have SSL support but I found no information on how to generate an OPTIONS HTTP request with wget.

like image 646
sorin Avatar asked Jan 23 '13 14:01

sorin


People also ask

How do you send an option request in curl?

To make an OPTIONS request with Curl, you must pass the -X OPTIONS command-line parameter to the Curl request. Browsers send OPTIONS requests when making a CORS request to another origin. The OPTIONS request does not return any data.

How do I use HTTP options method?

The HTTP OPTIONS method requests permitted communication options for a given URL or server. A client can specify a URL with this method, or an asterisk ( * ) to refer to the entire server.


1 Answers

The curl installed by default in Debian supports HTTPS since a great while back. (a long time ago there were two separate packages, one with and one without SSL but that's not the case anymore)

OPTIONS /path

You can send an OPTIONS request with curl like this:

curl -i -X OPTIONS http://example.org/path 

You may also use -v instead of -i to see more output.

OPTIONS *

To send a plain * (instead of the path, see RFC 7231) with the OPTIONS method, you need curl 7.55.0 or later as then you can run a command line like:

curl -i --request-target "*" -X OPTIONS http://example.org 
like image 134
Daniel Stenberg Avatar answered Sep 28 '22 03:09

Daniel Stenberg