cURL / Mailing Lists / curl-users / Single Mail

curl-users

[PATCH] Clean up documentation on -X and -d

From: Alex Bligh <alex_at_alex.org.uk>
Date: Tue, 1 Sep 2015 07:06:50 +0100

Signed-off-by: Alex Bligh <alex_at_alex.org.uk>

---
 docs/curl.1 | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/docs/curl.1 b/docs/curl.1
index b49c492..d2c84eb 100644
--- a/docs/curl.1
+++ b/docs/curl.1
@@ -309,10 +309,12 @@ If this option is used several times, the last one will be used.
 
 (Added in 7.19.7)
 .IP "-d, --data <data>"
-(HTTP) Sends the specified data in a POST request to the HTTP server, in the
+(HTTP) Sends the specified data in a request to the HTTP server, in the
 same way that a browser does when a user has filled in an HTML form and
 presses the submit button. This will cause curl to pass the data to the server
-using the content-type application/x-www-form-urlencoded.  Compare to
+using the content-type application/x-www-form-urlencoded. If \fI-X, --request\fP
+is not specified, a POST method will be used, rather than a GET method
+which would be the default without \fI-d, --data\fP. Compare to
 \fI-F, --form\fP.
 
 \fI-d, --data\fP is the same as \fI--data-ascii\fP. \fI--data-raw\fP is almost
@@ -1977,7 +1979,8 @@ If this option is used several times, the last one will be used.
 .IP "-X, --request <command>"
 (HTTP) Specifies a custom request method to use when communicating with the
 HTTP server.  The specified request method will be used instead of the method
-otherwise used (which defaults to GET). Read the HTTP 1.1 specification for
+otherwise used (which defaults to GET, unless \fI-d, --data\fP is used
+in which case it defaults to POST). Read the HTTP 1.1 specification for
 details and explanations. Common additional HTTP requests include PUT and
 DELETE, but related technologies like WebDAV offers PROPFIND, COPY, MOVE and
 more.
@@ -1995,6 +1998,10 @@ for example use \fB-L, --location\fP may cause unintended side-effects when
 curl doesn't change request method according to the HTTP 30x response codes -
 and similar.
 
+It is unnecessary to specify the \fI-X, --request\fP option to use a GET
+request method (unless \fI-d, --data\fP is used), or to use a POST
+request method (if \fI-d, --data\fP is used is used).
+
 (FTP)
 Specifies a custom FTP command to use instead of LIST when doing file lists
 with FTP.
-- 
1.9.1
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2015-09-01