]> granicus.if.org Git - curl/commitdiff
curl: add --post303 to set the CURL_REDIR_POST_303 option
authorDaniel Stenberg <daniel@haxx.se>
Thu, 5 Apr 2012 21:34:12 +0000 (23:34 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 5 Apr 2012 21:34:12 +0000 (23:34 +0200)
src/tool_cfgable.h
src/tool_getparam.c
src/tool_help.c
src/tool_operate.c

index 38a71d30962c8c7727a317dad9b959546cde5502..68204ed274664ce907d842cb844b549246de0d9b 100644 (file)
@@ -187,6 +187,7 @@ struct Configurable {
   bool raw;
   bool post301;
   bool post302;
+  bool post303;
   bool nokeepalive;         /* for keepalive needs */
   long alivetime;
   bool content_disposition; /* use Content-disposition filename */
index 4fe2a64310e1860afa00efc2c71df1084203d2dd..c9cf9e44dc429794115b29bbe6718b5afdb7ebaf 100644 (file)
@@ -171,6 +171,7 @@ static const struct LongShort aliases[]= {
   {"$F", "resolve",                  TRUE},
   {"$G", "delegation",               TRUE},
   {"$H", "mail-auth",                TRUE},
+  {"$I", "post303",                  FALSE},
   {"0",  "http1.0",                  FALSE},
   {"1",  "tlsv1",                    FALSE},
   {"2",  "sslv2",                    FALSE},
@@ -764,6 +765,9 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       case '4': /* --post302 */
         config->post302 = toggle;
         break;
+      case 'I': /* --post303 */
+        config->post303 = toggle;
+        break;
       case '5': /* --noproxy */
         /* This specifies the noproxy list */
         GetStr(&config->noproxy, nextarg);
index 31ef1d295b6f3988709b4f66a38f67e6acaed44e..e5fea889fa76bf9839b3d77fe3e98e615e37582c 100644 (file)
@@ -140,6 +140,8 @@ static const char *const helptext[] = {
   "Do not switch to GET after following a 301 redirect (H)",
   "     --post302       "
   "Do not switch to GET after following a 302 redirect (H)",
+  "     --post303       "
+  "Do not switch to GET after following a 303 redirect (H)",
   " -#, --progress-bar  Display transfer progress as a progress bar",
   "     --proto PROTOCOLS  Enable/disable specified protocols",
   "     --proto-redir PROTOCOLS  "
index 04d1589d786b99d16326ea39e5830c817c13ef08..bd0038d4a4790cb366b48f59d5636c3e2573955d 100644 (file)
@@ -916,9 +916,12 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
           if(config->authtype)
             my_setopt_flags(curl, CURLOPT_HTTPAUTH, config->authtype);
 
-          /* curl 7.19.1 (the 301 version existed in 7.18.2) */
-          my_setopt(curl, CURLOPT_POSTREDIR, config->post301 |
-                    (config->post302 ? CURL_REDIR_POST_302 : FALSE));
+          /* curl 7.19.1 (the 301 version existed in 7.18.2),
+             303 was added in 7.26.0 */
+          my_setopt(curl, CURLOPT_POSTREDIR,
+                    (config->post301 ? CURL_REDIR_POST_301 : 0) |
+                    (config->post302 ? CURL_REDIR_POST_302 : 0) |
+                    (config->post303 ? CURL_REDIR_POST_303 : 0));
 
           /* new in libcurl 7.21.6 */
           if(config->encoding)