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

Side by Side Diff: net/spdy/spdy_proxy_client_socket.cc

Issue 769043003: Sanitize headers in Proxy Authentication Required responses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reformat something Created 6 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
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 "net/spdy/spdy_proxy_client_socket.h" 5 #include "net/spdy/spdy_proxy_client_socket.h"
6 6
7 #include <algorithm> // min 7 #include <algorithm> // min
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 base::Bind(&HttpResponseHeaders::NetLogCallback, response_.headers)); 407 base::Bind(&HttpResponseHeaders::NetLogCallback, response_.headers));
408 408
409 switch (response_.headers->response_code()) { 409 switch (response_.headers->response_code()) {
410 case 200: // OK 410 case 200: // OK
411 next_state_ = STATE_OPEN; 411 next_state_ = STATE_OPEN;
412 return OK; 412 return OK;
413 413
414 case 302: // Found / Moved Temporarily 414 case 302: // Found / Moved Temporarily
415 // Try to return a sanitized response so we can follow auth redirects. 415 // Try to return a sanitized response so we can follow auth redirects.
416 // If we can't, fail the tunnel connection. 416 // If we can't, fail the tunnel connection.
417 if (SanitizeProxyRedirect(&response_, request_.url)) { 417 if (!SanitizeProxyRedirect(&response_)) {
418 redirect_has_load_timing_info_ =
419 spdy_stream_->GetLoadTimingInfo(&redirect_load_timing_info_);
420 // Note that this triggers a RST_STREAM_CANCEL.
421 spdy_stream_->DetachDelegate();
422 next_state_ = STATE_DISCONNECTED;
423 return ERR_HTTPS_PROXY_TUNNEL_RESPONSE;
424 } else {
425 LogBlockedTunnelResponse(); 418 LogBlockedTunnelResponse();
426 return ERR_TUNNEL_CONNECTION_FAILED; 419 return ERR_TUNNEL_CONNECTION_FAILED;
427 } 420 }
428 421
422 redirect_has_load_timing_info_ =
423 spdy_stream_->GetLoadTimingInfo(&redirect_load_timing_info_);
424 // Note that this triggers a RST_STREAM_CANCEL.
425 spdy_stream_->DetachDelegate();
426 next_state_ = STATE_DISCONNECTED;
427 return ERR_HTTPS_PROXY_TUNNEL_RESPONSE;
428
429 case 407: // Proxy Authentication Required 429 case 407: // Proxy Authentication Required
430 next_state_ = STATE_OPEN; 430 next_state_ = STATE_OPEN;
431 if (!SanitizeProxyAuth(&response_)) {
432 LogBlockedTunnelResponse();
433 return ERR_TUNNEL_CONNECTION_FAILED;
Ryan Sleevi 2014/12/19 22:06:25 Ditto the comments re: |response_| sanitization
434 }
431 return HandleProxyAuthChallenge(auth_.get(), &response_, net_log_); 435 return HandleProxyAuthChallenge(auth_.get(), &response_, net_log_);
432 436
433 default: 437 default:
434 // Ignore response to avoid letting the proxy impersonate the target 438 // Ignore response to avoid letting the proxy impersonate the target
435 // server. (See http://crbug.com/137891.) 439 // server. (See http://crbug.com/137891.)
436 LogBlockedTunnelResponse(); 440 LogBlockedTunnelResponse();
437 return ERR_TUNNEL_CONNECTION_FAILED; 441 return ERR_TUNNEL_CONNECTION_FAILED;
438 } 442 }
439 } 443 }
440 444
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } else if (!read_callback_.is_null()) { 531 } else if (!read_callback_.is_null()) {
528 // If we have a read_callback_, the we need to make sure we call it back. 532 // If we have a read_callback_, the we need to make sure we call it back.
529 OnDataReceived(scoped_ptr<SpdyBuffer>()); 533 OnDataReceived(scoped_ptr<SpdyBuffer>());
530 } 534 }
531 // This may have been deleted by read_callback_, so check first. 535 // This may have been deleted by read_callback_, so check first.
532 if (weak_ptr.get() && !write_callback.is_null()) 536 if (weak_ptr.get() && !write_callback.is_null())
533 write_callback.Run(ERR_CONNECTION_CLOSED); 537 write_callback.Run(ERR_CONNECTION_CLOSED);
534 } 538 }
535 539
536 } // namespace net 540 } // namespace net
OLDNEW
« net/http/proxy_client_socket.cc ('K') | « net/http/proxy_client_socket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698