curl/docs/cmdline-opts/request.md
Daniel Stenberg 2494b8dd51
docs/cmdline: change to .md for cmdline docs
- switch all invidual files documenting command line options into .md,
   as the documentation is now markdown-looking.

 - made the parser treat 4-space indents as quotes

 - switch to building the curl.1 manpage using the "mainpage.idx" file,
   which lists the files to include to generate it, instead of using the
   previous page-footer/headers. Also, those files are now also .md
   ones, using the same format. I gave them underscore prefixes to make
   them sort separately:
   _NAME.md, _SYNOPSIS.md, _DESCRIPTION.md, _URL.md, _GLOBBING.md,
   _VARIABLES.md, _OUTPUT.md, _PROTOCOLS.md, _PROGRESS.md, _VERSION.md,
   _OPTIONS.md, _FILES.md, _ENVIRONMENT.md, _PROXYPREFIX.md,
   _EXITCODES.md, _BUGS.md, _AUTHORS.md, _WWW.md, _SEEALSO.md

 - updated test cases accordingly

Closes #12751
2024-01-23 14:30:15 +01:00

1.9 KiB

c SPDX-License-Identifier Long Short Arg Help Category Added Multi See-also Example
Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. curl request X <method> Specify request method to use connection 6.0 single
request-target
-X "DELETE" $URL
-X NLST ftp://example.com/

--request

Change the method to use when starting the transfer.

curl passes on the verbatim string you give it its the request without any filter or other safe guards. That includes white space and control characters.

HTTP

Specifies a custom request method to use when communicating with the HTTP server. The specified request method is used instead of the method otherwise used (which defaults to GET). Read the HTTP 1.1 specification for details and explanations. Common additional HTTP requests include PUT and DELETE, while related technologies like WebDAV offers PROPFIND, COPY, MOVE and more.

Normally you do not need this option. All sorts of GET, HEAD, POST and PUT requests are rather invoked by using dedicated command line options.

This option only changes the actual word used in the HTTP request, it does not alter the way curl behaves. So for example if you want to make a proper HEAD request, using -X HEAD does not suffice. You need to use the --head option.

The method string you set with --request is used for all requests, which if you for example use --location may cause unintended side-effects when curl does not change request method according to the HTTP 30x response codes - and similar.

FTP

Specifies a custom FTP command to use instead of LIST when doing file lists with FTP.

POP3

Specifies a custom POP3 command to use instead of LIST or RETR. (Added in 7.26.0)

IMAP

Specifies a custom IMAP command to use instead of LIST. (Added in 7.30.0)

SMTP

Specifies a custom SMTP command to use instead of HELP or VRFY. (Added in 7.34.0)