| OLD | NEW |
| 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 "net/test/embedded_test_server/http_request.h" | 5 #include "net/test/embedded_test_server/http_request.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 if (declared_content_length_ == http_request_->content.size()) { | 211 if (declared_content_length_ == http_request_->content.size()) { |
| 212 state_ = STATE_ACCEPTED; | 212 state_ = STATE_ACCEPTED; |
| 213 return ACCEPTED; | 213 return ACCEPTED; |
| 214 } | 214 } |
| 215 | 215 |
| 216 state_ = STATE_CONTENT; | 216 state_ = STATE_CONTENT; |
| 217 return WAITING; | 217 return WAITING; |
| 218 } | 218 } |
| 219 | 219 |
| 220 scoped_ptr<HttpRequest> HttpRequestParser::GetRequest() { | 220 std::unique_ptr<HttpRequest> HttpRequestParser::GetRequest() { |
| 221 DCHECK_EQ(STATE_ACCEPTED, state_); | 221 DCHECK_EQ(STATE_ACCEPTED, state_); |
| 222 scoped_ptr<HttpRequest> result = std::move(http_request_); | 222 std::unique_ptr<HttpRequest> result = std::move(http_request_); |
| 223 | 223 |
| 224 // Prepare for parsing a new request. | 224 // Prepare for parsing a new request. |
| 225 state_ = STATE_HEADERS; | 225 state_ = STATE_HEADERS; |
| 226 http_request_.reset(new HttpRequest()); | 226 http_request_.reset(new HttpRequest()); |
| 227 buffer_.clear(); | 227 buffer_.clear(); |
| 228 buffer_position_ = 0; | 228 buffer_position_ = 0; |
| 229 declared_content_length_ = 0; | 229 declared_content_length_ = 0; |
| 230 | 230 |
| 231 return result; | 231 return result; |
| 232 } | 232 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 248 return METHOD_CONNECT; | 248 return METHOD_CONNECT; |
| 249 } else if (token == "options") { | 249 } else if (token == "options") { |
| 250 return METHOD_OPTIONS; | 250 return METHOD_OPTIONS; |
| 251 } | 251 } |
| 252 LOG(WARNING) << "Method not implemented: " << token; | 252 LOG(WARNING) << "Method not implemented: " << token; |
| 253 return METHOD_GET; | 253 return METHOD_GET; |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace test_server | 256 } // namespace test_server |
| 257 } // namespace net | 257 } // namespace net |
| OLD | NEW |