Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1274)

Side by Side Diff: chrome_frame/urlmon_url_request.cc

Issue 333043: If a HTTP post to a server returns any redirect code other than 307, then bro... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/net/fake_external_tab.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome_frame/urlmon_url_request.h" 5 #include "chrome_frame/urlmon_url_request.h"
6 6
7 #include <wininet.h> 7 #include <wininet.h>
8 8
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ULONG status_code, LPCWSTR status_text) { 161 ULONG status_code, LPCWSTR status_text) {
162 switch (status_code) { 162 switch (status_code) {
163 case BINDSTATUS_REDIRECTING: 163 case BINDSTATUS_REDIRECTING:
164 DCHECK(status_text != NULL); 164 DCHECK(status_text != NULL);
165 DLOG(INFO) << "URL: " << url() << " redirected to " 165 DLOG(INFO) << "URL: " << url() << " redirected to "
166 << status_text; 166 << status_text;
167 redirect_url_ = status_text; 167 redirect_url_ = status_text;
168 // Fetch the redirect status as they aren't all equal (307 in particular 168 // Fetch the redirect status as they aren't all equal (307 in particular
169 // retains the HTTP request verb). 169 // retains the HTTP request verb).
170 redirect_status_ = GetHttpResponseStatus(); 170 redirect_status_ = GetHttpResponseStatus();
171 // NOTE: Even though RFC 2616 says to preserve the request method when
172 // following a 302 redirect, normal browsers don't do that. Instead they
173 // all convert a POST into a GET in response to a 302 and so shall we.
174 // For 307 redirects, browsers preserve the method. The RFC says to
175 // prompt the user to confirm the generation of a new POST request, but
176 // IE omits this prompt and so shall we.
amit 2009/10/27 17:53:57 Does chrome do this as well?
ananta 2009/10/27 18:04:35 yes,
177 if (redirect_status_ != 307 &&
178 LowerCaseEqualsASCII(method(), "post")) {
179 set_method("get");
180 post_data_len_ = 0;
181 }
171 break; 182 break;
172 183
173 default: 184 default:
174 DLOG(INFO) << " Obj: " << std::hex << this << " OnProgress(" << url() 185 DLOG(INFO) << " Obj: " << std::hex << this << " OnProgress(" << url()
175 << StringPrintf(L") code: %i status: %ls", status_code, status_text); 186 << StringPrintf(L") code: %i status: %ls", status_code, status_text);
176 break; 187 break;
177 } 188 }
178 189
179 return S_OK; 190 return S_OK;
180 } 191 }
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 ret = net::ERR_ACCESS_DENIED; 813 ret = net::ERR_ACCESS_DENIED;
803 break; 814 break;
804 815
805 default: 816 default:
806 DLOG(WARNING) 817 DLOG(WARNING)
807 << StringPrintf("TODO: translate HRESULT 0x%08X to net::Error", hr); 818 << StringPrintf("TODO: translate HRESULT 0x%08X to net::Error", hr);
808 break; 819 break;
809 } 820 }
810 return ret; 821 return ret;
811 } 822 }
OLDNEW
« no previous file with comments | « chrome_frame/test/net/fake_external_tab.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698