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/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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 if (net_log_.IsLoggingAllEvents()) { | 365 if (net_log_.IsLoggingAllEvents()) { |
366 net_log_.AddEvent( | 366 net_log_.AddEvent( |
367 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 367 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
368 make_scoped_refptr(new NetLogHttpRequestParameter( | 368 make_scoped_refptr(new NetLogHttpRequestParameter( |
369 request_line, request_headers))); | 369 request_line, request_headers))); |
370 } | 370 } |
371 | 371 |
372 request_.extra_headers.MergeFrom(request_headers); | 372 request_.extra_headers.MergeFrom(request_headers); |
373 linked_ptr<spdy::SpdyHeaderBlock> headers(new spdy::SpdyHeaderBlock()); | 373 linked_ptr<spdy::SpdyHeaderBlock> headers(new spdy::SpdyHeaderBlock()); |
374 CreateSpdyHeadersFromHttpRequest(request_, request_headers, headers.get(), | 374 CreateSpdyHeadersFromHttpRequest(request_, request_headers, headers.get(), |
375 true); | 375 spdy_stream_->GetProtocolVersion(), true); |
376 // Reset the URL to be the endpoint of the connection | 376 // Reset the URL to be the endpoint of the connection |
377 (*headers)["url"] = endpoint_.ToString(); | 377 if (spdy_stream_->GetProtocolVersion() > 2) { |
378 headers->erase("scheme"); | 378 (*headers)[":path"] = endpoint_.ToString(); |
| 379 headers->erase(":scheme"); |
| 380 } else { |
| 381 (*headers)["url"] = endpoint_.ToString(); |
| 382 headers->erase("scheme"); |
| 383 } |
379 spdy_stream_->set_spdy_headers(headers); | 384 spdy_stream_->set_spdy_headers(headers); |
380 | 385 |
381 return spdy_stream_->SendRequest(true); | 386 return spdy_stream_->SendRequest(true); |
382 } | 387 } |
383 | 388 |
384 int SpdyProxyClientSocket::DoSendRequestComplete(int result) { | 389 int SpdyProxyClientSocket::DoSendRequestComplete(int result) { |
385 if (result < 0) | 390 if (result < 0) |
386 return result; | 391 return result; |
387 | 392 |
388 // Wait for SYN_REPLY frame from the server | 393 // Wait for SYN_REPLY frame from the server |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 } | 544 } |
540 // This may have been deleted by read_callback_, so check first. | 545 // This may have been deleted by read_callback_, so check first. |
541 if (weak_ptr && !write_callback.is_null()) | 546 if (weak_ptr && !write_callback.is_null()) |
542 write_callback.Run(ERR_CONNECTION_CLOSED); | 547 write_callback.Run(ERR_CONNECTION_CLOSED); |
543 } | 548 } |
544 | 549 |
545 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) { | 550 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) { |
546 } | 551 } |
547 | 552 |
548 } // namespace net | 553 } // namespace net |
OLD | NEW |