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

Unified Diff: net/url_request/url_request_redirect_job.cc

Issue 335123006: Simulate HTTP headers for URLRequestRedirectJob. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request_redirect_job.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_redirect_job.cc
diff --git a/net/url_request/url_request_redirect_job.cc b/net/url_request/url_request_redirect_job.cc
index 818d4c397ec5dee4a69c2116851eb283b5d71b70..33dc7c4210b8571c1929a8647e946befce6135ff 100644
--- a/net/url_request/url_request_redirect_job.cc
+++ b/net/url_request/url_request_redirect_job.cc
@@ -8,8 +8,10 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
+#include "base/strings/stringprintf.h"
#include "net/base/load_timing_info.h"
#include "net/base/net_log.h"
+#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
namespace net {
@@ -37,6 +39,10 @@ void URLRequestRedirectJob::Start() {
weak_factory_.GetWeakPtr()));
}
+void URLRequestRedirectJob::GetResponseInfo(HttpResponseInfo* info) {
+ info->headers = response_headers_;
+}
+
bool URLRequestRedirectJob::IsRedirectResponse(GURL* location,
int* http_status_code) {
*location = redirect_destination_;
@@ -54,6 +60,11 @@ URLRequestRedirectJob::~URLRequestRedirectJob() {}
void URLRequestRedirectJob::StartAsync() {
receive_headers_end_ = base::TimeTicks::Now();
+ // Fake a set of response headers so downstream consumers can read the
+ // response code.
+ response_headers_ = new HttpResponseHeaders(
+ base::StringPrintf("HTTP/1.1 %d %s\n", http_status_code_,
+ redirect_reason_.c_str()));
NotifyHeadersComplete();
}
« no previous file with comments | « net/url_request/url_request_redirect_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698