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

Side by Side Diff: content/browser/debugger/devtools_http_handler_impl.cc

Issue 11591016: DevTools: allow query parameters and fragments in remote debugging command urls. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Lint Created 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/shell/shell_devtools_discovery_page.html » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/debugger/devtools_http_handler_impl.h" 5 #include "content/browser/debugger/devtools_http_handler_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 const net::HttpServerRequestInfo& info) { 472 const net::HttpServerRequestInfo& info) {
473 // Trim /json and ?jsonp=... 473 // Trim /json and ?jsonp=...
474 std::string path = info.path.substr(5); 474 std::string path = info.path.substr(5);
475 std::string jsonp; 475 std::string jsonp;
476 size_t jsonp_pos = path.find("?jsonp="); 476 size_t jsonp_pos = path.find("?jsonp=");
477 if (jsonp_pos != std::string::npos) { 477 if (jsonp_pos != std::string::npos) {
478 jsonp = path.substr(jsonp_pos + 7); 478 jsonp = path.substr(jsonp_pos + 7);
479 path = path.substr(0, jsonp_pos); 479 path = path.substr(0, jsonp_pos);
480 } 480 }
481 481
482 // Trim fragment and query
483 size_t query_pos = path.find("?");
484 if (query_pos != std::string::npos)
485 path = path.substr(0, query_pos);
486
487 size_t fragment_pos = path.find("#");
488 if (fragment_pos != std::string::npos)
489 path = path.substr(0, fragment_pos);
490
482 std::string command; 491 std::string command;
483 std::string target_id; 492 std::string target_id;
484 if (!ParseJsonPath(path, &command, &target_id)) { 493 if (!ParseJsonPath(path, &command, &target_id)) {
485 SendJson(connection_id, 494 SendJson(connection_id,
486 net::HTTP_NOT_FOUND, 495 net::HTTP_NOT_FOUND,
487 NULL, 496 NULL,
488 "Malformed query: " + info.path, 497 "Malformed query: " + info.path,
489 jsonp); 498 jsonp);
490 return; 499 return;
491 } 500 }
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 page_info.id.c_str())); 834 page_info.id.c_str()));
826 std::string devtools_frontend_url = GetFrontendURLInternal( 835 std::string devtools_frontend_url = GetFrontendURLInternal(
827 page_info.id.c_str(), 836 page_info.id.c_str(),
828 host); 837 host);
829 dictionary->SetString("devtoolsFrontendUrl", devtools_frontend_url); 838 dictionary->SetString("devtoolsFrontendUrl", devtools_frontend_url);
830 } 839 }
831 return dictionary; 840 return dictionary;
832 } 841 }
833 842
834 } // namespace content 843 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/shell/shell_devtools_discovery_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698