| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/http/http_proxy_client_socket.h" | 5 #include "net/http/http_proxy_client_socket.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 HttpRequestHeaders authorization_headers; | 336 HttpRequestHeaders authorization_headers; |
| 337 if (auth_->HaveAuth()) | 337 if (auth_->HaveAuth()) |
| 338 auth_->AddAuthorizationHeader(&authorization_headers); | 338 auth_->AddAuthorizationHeader(&authorization_headers); |
| 339 std::string request_line; | 339 std::string request_line; |
| 340 HttpRequestHeaders request_headers; | 340 HttpRequestHeaders request_headers; |
| 341 BuildTunnelRequest(request_, authorization_headers, endpoint_, | 341 BuildTunnelRequest(request_, authorization_headers, endpoint_, |
| 342 &request_line, &request_headers); | 342 &request_line, &request_headers); |
| 343 if (net_log_.IsLoggingAllEvents()) { | 343 if (net_log_.IsLoggingAllEvents()) { |
| 344 net_log_.AddEvent( | 344 net_log_.AddEvent( |
| 345 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 345 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 346 new NetLogHttpRequestParameter( | 346 make_scoped_refptr(new NetLogHttpRequestParameter( |
| 347 request_line, request_headers)); | 347 request_line, request_headers))); |
| 348 } | 348 } |
| 349 request_headers_ = request_line + request_headers.ToString(); | 349 request_headers_ = request_line + request_headers.ToString(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 | 352 |
| 353 parser_buf_ = new GrowableIOBuffer(); | 353 parser_buf_ = new GrowableIOBuffer(); |
| 354 http_stream_parser_.reset( | 354 http_stream_parser_.reset( |
| 355 new HttpStreamParser(transport_.get(), &request_, parser_buf_, net_log_)); | 355 new HttpStreamParser(transport_.get(), &request_, parser_buf_, net_log_)); |
| 356 return http_stream_parser_->SendRequest(request_headers_, NULL, | 356 return http_stream_parser_->SendRequest(request_headers_, NULL, |
| 357 &response_, &io_callback_); | 357 &response_, &io_callback_); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 374 if (result < 0) | 374 if (result < 0) |
| 375 return result; | 375 return result; |
| 376 | 376 |
| 377 // Require the "HTTP/1.x" status line for SSL CONNECT. | 377 // Require the "HTTP/1.x" status line for SSL CONNECT. |
| 378 if (response_.headers->GetParsedHttpVersion() < HttpVersion(1, 0)) | 378 if (response_.headers->GetParsedHttpVersion() < HttpVersion(1, 0)) |
| 379 return ERR_TUNNEL_CONNECTION_FAILED; | 379 return ERR_TUNNEL_CONNECTION_FAILED; |
| 380 | 380 |
| 381 if (net_log_.IsLoggingAllEvents()) { | 381 if (net_log_.IsLoggingAllEvents()) { |
| 382 net_log_.AddEvent( | 382 net_log_.AddEvent( |
| 383 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 383 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 384 new NetLogHttpResponseParameter(response_.headers)); | 384 make_scoped_refptr(new NetLogHttpResponseParameter(response_.headers))); |
| 385 } | 385 } |
| 386 | 386 |
| 387 switch (response_.headers->response_code()) { | 387 switch (response_.headers->response_code()) { |
| 388 case 200: // OK | 388 case 200: // OK |
| 389 if (http_stream_parser_->IsMoreDataBuffered()) | 389 if (http_stream_parser_->IsMoreDataBuffered()) |
| 390 // The proxy sent extraneous data after the headers. | 390 // The proxy sent extraneous data after the headers. |
| 391 return ERR_TUNNEL_CONNECTION_FAILED; | 391 return ERR_TUNNEL_CONNECTION_FAILED; |
| 392 | 392 |
| 393 next_state_ = STATE_DONE; | 393 next_state_ = STATE_DONE; |
| 394 return OK; | 394 return OK; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 | 456 |
| 457 int rv = auth_->HandleAuthChallenge(response_.headers, false, true, net_log_); | 457 int rv = auth_->HandleAuthChallenge(response_.headers, false, true, net_log_); |
| 458 response_.auth_challenge = auth_->auth_info(); | 458 response_.auth_challenge = auth_->auth_info(); |
| 459 if (rv == OK) | 459 if (rv == OK) |
| 460 return ERR_PROXY_AUTH_REQUESTED; | 460 return ERR_PROXY_AUTH_REQUESTED; |
| 461 | 461 |
| 462 return rv; | 462 return rv; |
| 463 } | 463 } |
| 464 | 464 |
| 465 } // namespace net | 465 } // namespace net |
| OLD | NEW |