OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/test/chromedriver/server/http_handler.h" | 5 #include "chrome/test/chromedriver/server/http_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 HttpHandler::~HttpHandler() {} | 573 HttpHandler::~HttpHandler() {} |
574 | 574 |
575 void HttpHandler::Handle(const net::HttpServerRequestInfo& request, | 575 void HttpHandler::Handle(const net::HttpServerRequestInfo& request, |
576 const HttpResponseSenderFunc& send_response_func) { | 576 const HttpResponseSenderFunc& send_response_func) { |
577 CHECK(thread_checker_.CalledOnValidThread()); | 577 CHECK(thread_checker_.CalledOnValidThread()); |
578 | 578 |
579 if (received_shutdown_) | 579 if (received_shutdown_) |
580 return; | 580 return; |
581 | 581 |
582 std::string path = request.path; | 582 std::string path = request.path; |
583 if (!base::StartsWithASCII(path, url_base_, true)) { | 583 if (!base::StartsWith(path, url_base_, base::CompareCase::SENSITIVE)) { |
584 scoped_ptr<net::HttpServerResponseInfo> response( | 584 scoped_ptr<net::HttpServerResponseInfo> response( |
585 new net::HttpServerResponseInfo(net::HTTP_BAD_REQUEST)); | 585 new net::HttpServerResponseInfo(net::HTTP_BAD_REQUEST)); |
586 response->SetBody("unhandled request", "text/plain"); | 586 response->SetBody("unhandled request", "text/plain"); |
587 send_response_func.Run(response.Pass()); | 587 send_response_func.Run(response.Pass()); |
588 return; | 588 return; |
589 } | 589 } |
590 | 590 |
591 path.erase(0, url_base_.length()); | 591 path.erase(0, url_base_.length()); |
592 | 592 |
593 HandleCommand(request, path, send_response_func); | 593 HandleCommand(request, path, send_response_func); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 params.SetString(name, path_parts[i]); | 762 params.SetString(name, path_parts[i]); |
763 } else if (command_path_parts[i] != path_parts[i]) { | 763 } else if (command_path_parts[i] != path_parts[i]) { |
764 return false; | 764 return false; |
765 } | 765 } |
766 } | 766 } |
767 out_params->MergeDictionary(¶ms); | 767 out_params->MergeDictionary(¶ms); |
768 return true; | 768 return true; |
769 } | 769 } |
770 | 770 |
771 } // namespace internal | 771 } // namespace internal |
OLD | NEW |