| 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_stream_request.h" | 5 #include "net/http/http_stream_request.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 const HttpResponseInfo& response, | 186 const HttpResponseInfo& response, |
| 187 HttpAuthController* auth_controller) { | 187 HttpAuthController* auth_controller) { |
| 188 delegate_->OnNeedsProxyAuth(response, auth_controller); | 188 delegate_->OnNeedsProxyAuth(response, auth_controller); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void HttpStreamRequest::OnNeedsClientAuthCallback( | 191 void HttpStreamRequest::OnNeedsClientAuthCallback( |
| 192 SSLCertRequestInfo* cert_info) { | 192 SSLCertRequestInfo* cert_info) { |
| 193 delegate_->OnNeedsClientAuth(cert_info); | 193 delegate_->OnNeedsClientAuth(cert_info); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void HttpStreamRequest::OnHttpsProxyTunnelConnectionResponseCallback( |
| 197 const HttpResponseInfo& response_info, |
| 198 HttpStream* stream) { |
| 199 delegate_->OnHttpsProxyTunnelConnectionResponse(response_info, stream); |
| 200 } |
| 201 |
| 196 void HttpStreamRequest::OnPreconnectsComplete(int result) { | 202 void HttpStreamRequest::OnPreconnectsComplete(int result) { |
| 197 preconnect_delegate_->OnPreconnectsComplete(this, result); | 203 preconnect_delegate_->OnPreconnectsComplete(this, result); |
| 198 } | 204 } |
| 199 | 205 |
| 200 void HttpStreamRequest::OnIOComplete(int result) { | 206 void HttpStreamRequest::OnIOComplete(int result) { |
| 201 RunLoop(result); | 207 RunLoop(result); |
| 202 } | 208 } |
| 203 | 209 |
| 204 int HttpStreamRequest::RunLoop(int result) { | 210 int HttpStreamRequest::RunLoop(int result) { |
| 205 result = DoLoop(result); | 211 result = DoLoop(result); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 233 switch (result) { | 239 switch (result) { |
| 234 case ERR_PROXY_AUTH_REQUESTED: | 240 case ERR_PROXY_AUTH_REQUESTED: |
| 235 { | 241 { |
| 236 DCHECK(connection_.get()); | 242 DCHECK(connection_.get()); |
| 237 DCHECK(connection_->socket()); | 243 DCHECK(connection_->socket()); |
| 238 DCHECK(establishing_tunnel_); | 244 DCHECK(establishing_tunnel_); |
| 239 | 245 |
| 240 HttpProxyClientSocket* http_proxy_socket = | 246 HttpProxyClientSocket* http_proxy_socket = |
| 241 static_cast<HttpProxyClientSocket*>(connection_->socket()); | 247 static_cast<HttpProxyClientSocket*>(connection_->socket()); |
| 242 const HttpResponseInfo* tunnel_auth_response = | 248 const HttpResponseInfo* tunnel_auth_response = |
| 243 http_proxy_socket->GetResponseInfo(); | 249 http_proxy_socket->GetConnectResponseInfo(); |
| 244 | 250 |
| 245 next_state_ = STATE_WAITING_USER_ACTION; | 251 next_state_ = STATE_WAITING_USER_ACTION; |
| 246 MessageLoop::current()->PostTask( | 252 MessageLoop::current()->PostTask( |
| 247 FROM_HERE, | 253 FROM_HERE, |
| 248 method_factory_.NewRunnableMethod( | 254 method_factory_.NewRunnableMethod( |
| 249 &HttpStreamRequest::OnNeedsProxyAuthCallback, | 255 &HttpStreamRequest::OnNeedsProxyAuthCallback, |
| 250 *tunnel_auth_response, | 256 *tunnel_auth_response, |
| 251 http_proxy_socket->auth_controller())); | 257 http_proxy_socket->auth_controller())); |
| 252 } | 258 } |
| 253 return ERR_IO_PENDING; | 259 return ERR_IO_PENDING; |
| 254 | 260 |
| 255 case ERR_SSL_CLIENT_AUTH_CERT_NEEDED: | 261 case ERR_SSL_CLIENT_AUTH_CERT_NEEDED: |
| 256 MessageLoop::current()->PostTask( | 262 MessageLoop::current()->PostTask( |
| 257 FROM_HERE, | 263 FROM_HERE, |
| 258 method_factory_.NewRunnableMethod( | 264 method_factory_.NewRunnableMethod( |
| 259 &HttpStreamRequest::OnNeedsClientAuthCallback, | 265 &HttpStreamRequest::OnNeedsClientAuthCallback, |
| 260 connection_->ssl_error_response_info().cert_request_info)); | 266 connection_->ssl_error_response_info().cert_request_info)); |
| 261 return ERR_IO_PENDING; | 267 return ERR_IO_PENDING; |
| 262 | 268 |
| 269 case ERR_HTTPS_PROXY_TUNNEL_CONNECTION_RESPONSE: |
| 270 MessageLoop::current()->PostTask( |
| 271 FROM_HERE, |
| 272 method_factory_.NewRunnableMethod( |
| 273 &HttpStreamRequest::OnHttpsProxyTunnelConnectionResponseCallback, |
| 274 connection_->ssl_error_response_info(), |
| 275 connection_->release_pending_https_proxy_response_stream())); |
| 276 return ERR_IO_PENDING; |
| 277 |
| 263 case OK: | 278 case OK: |
| 264 next_state_ = STATE_DONE; | 279 next_state_ = STATE_DONE; |
| 265 MessageLoop::current()->PostTask( | 280 MessageLoop::current()->PostTask( |
| 266 FROM_HERE, | 281 FROM_HERE, |
| 267 method_factory_.NewRunnableMethod( | 282 method_factory_.NewRunnableMethod( |
| 268 &HttpStreamRequest::OnStreamReadyCallback)); | 283 &HttpStreamRequest::OnStreamReadyCallback)); |
| 269 return ERR_IO_PENDING; | 284 return ERR_IO_PENDING; |
| 270 | 285 |
| 271 default: | 286 default: |
| 272 MessageLoop::current()->PostTask( | 287 MessageLoop::current()->PostTask( |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 base::TimeDelta::FromMinutes(6), | 1059 base::TimeDelta::FromMinutes(6), |
| 1045 100); | 1060 100); |
| 1046 break; | 1061 break; |
| 1047 default: | 1062 default: |
| 1048 NOTREACHED(); | 1063 NOTREACHED(); |
| 1049 break; | 1064 break; |
| 1050 } | 1065 } |
| 1051 } | 1066 } |
| 1052 | 1067 |
| 1053 } // namespace net | 1068 } // namespace net |
| OLD | NEW |