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

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: 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..b3355783a2c235171acd75695d4c0b173ec4de02 100644
--- a/net/test/embedded_test_server/embedded_test_server.cc
+++ b/net/test/embedded_test_server/embedded_test_server.cc
@@ -49,8 +49,16 @@ scoped_ptr<HttpResponse> HandleFileRequest(
// This is a test-only server. Ignore I/O thread restrictions.
base::ThreadRestrictions::ScopedAllowIO allow_io;
+ std::string request_path(request.relative_url);
+ // A proxy will have an absolute path. Simulate the proxy by stripping the
+ // scheme, host, and port.
+ if (request_path.find("http://127.0.0.1") == 0) {
mmenke 2014/12/04 18:17:08 Can you just create a GURL from the path, and call
bengr 2014/12/05 23:13:32 Done.
+ GURL request_url(request_path);
+ request_path = request_url.path() +
+ (request_url.query().empty() ? "" : "?" + request_url.query());
mmenke 2014/12/04 18:17:09 request_url.PathForRequest()?
bengr 2014/12/05 23:13:32 Done. (Somehow I missed that method.)
+ }
// Trim the first byte ('/').
- std::string request_path(request.relative_url.substr(1));
+ request_path = request_path.substr(1);
mmenke 2014/12/04 18:17:09 Not a big fan of "This is the request_path, no, th
bengr 2014/12/05 23:13:32 Done.
// 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