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

Unified Diff: net/test/embedded_test_server/embedded_test_server.cc

Issue 749793002: Data reduction proxy bypass with test server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from mmenke Created 6 years 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 | « components/test/data/data_reduction_proxy/proxy/noblock.html.mock-http-headers ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/embedded_test_server/embedded_test_server.cc
diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc
index 97b5d84509c5f2324872ce69c3bfedf9459c582e..7a44803b882e98d69f7f4b10a453ada517dd582b 100644
--- a/net/test/embedded_test_server/embedded_test_server.cc
+++ b/net/test/embedded_test_server/embedded_test_server.cc
@@ -49,8 +49,14 @@ scoped_ptr<HttpResponse> HandleFileRequest(
// This is a test-only server. Ignore I/O thread restrictions.
base::ThreadRestrictions::ScopedAllowIO allow_io;
+ std::string relative_url(request.relative_url);
+ // A proxy request will have an absolute path. Simulate the proxy by stripping
+ // the scheme, host, and port.
+ if (GURL(relative_url).is_valid())
mmenke 2014/12/08 18:16:05 nit: Should create the GURL on the stack, to avoi
bengr 2014/12/08 22:29:26 Done.
+ relative_url = GURL(relative_url).PathForRequest();
+
// Trim the first byte ('/').
- std::string request_path(request.relative_url.substr(1));
+ std::string request_path = relative_url.substr(1);
// Remove the query string if present.
size_t query_pos = request_path.find('?');
« no previous file with comments | « components/test/data/data_reduction_proxy/proxy/noblock.html.mock-http-headers ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698