diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-04-17 07:16:49 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-04-17 07:16:49 +0000 |
commit | 08f8917acb8c970cd190f1cf9fd63c705e736f68 (patch) | |
tree | 1fb724fe79621ba20556002c4cf59c9f68747b4c | |
parent | 62d205a2ec38ed54e359625d69a7210dc274f093 (diff) |
Dirk Manske's fix for HTTP response code 301, that now behaves more like
browsers do. Which thus *breaks* the RFC 2616...
-rw-r--r-- | lib/transfer.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index dcdb4708d..0a544e8d2 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1262,7 +1262,6 @@ CURLcode Curl_perform(struct SessionHandle *data) */ switch(data->info.httpcode) { case 300: /* Multiple Choices */ - case 301: /* Moved Permanently */ case 306: /* Not used */ case 307: /* Temporary Redirect */ default: /* for all unknown ones */ @@ -1270,6 +1269,27 @@ CURLcode Curl_perform(struct SessionHandle *data) * seem to be OK to POST to. */ break; + case 301: /* Moved Permanently */ + /* (quote from RFC2616, section 10.3.2): + * + * Note: When automatically redirecting a POST request after + * receiving a 301 status code, some existing HTTP/1.0 user agents + * will erroneously change it into a GET request. + * + * ---- + * Warning: Because most of importants user agents do this clear + * RFC2616 violation, many webservers expect this misbehavior. So + * these servers often answers to a POST request with an error page. + * To be sure that libcurl gets the page that most user agents + * would get, libcurl has to force GET: + */ + if( data->set.httpreq == HTTPREQ_POST + || data->set.httpreq == HTTPREQ_POST_FORM) { + infof(data, + "Violate RFC 2616/10.3.2 and switch from POST to GET\n"); + data->set.httpreq = HTTPREQ_GET; + } + break; case 302: /* Found */ /* (From 10.3.3) |