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/quic/quic_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 weak_factory_.GetWeakPtr()))) { | 412 weak_factory_.GetWeakPtr()))) { |
413 // Do not compress headers unless it is likely that they can be sent. | 413 // Do not compress headers unless it is likely that they can be sent. |
414 next_state_ = STATE_SEND_HEADERS; | 414 next_state_ = STATE_SEND_HEADERS; |
415 return ERR_IO_PENDING; | 415 return ERR_IO_PENDING; |
416 } | 416 } |
417 request_ = stream_->compressor()->CompressHeadersWithPriority( | 417 request_ = stream_->compressor()->CompressHeadersWithPriority( |
418 ConvertRequestPriorityToQuicPriority(priority_), request_headers_); | 418 ConvertRequestPriorityToQuicPriority(priority_), request_headers_); |
419 } | 419 } |
420 // Log the actual request with the URL Request's net log. | 420 // Log the actual request with the URL Request's net log. |
421 stream_net_log_.AddEvent( | 421 stream_net_log_.AddEvent( |
422 NetLog::TYPE_HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS, | 422 NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS, |
423 base::Bind(&SpdyHeaderBlockNetLogCallback, &request_headers_)); | 423 base::Bind(&QuicRequestNetLogCallback, &request_headers_, priority_)); |
424 // Also log to the QuicSession's net log. | 424 // Also log to the QuicSession's net log. |
425 stream_->net_log().AddEvent( | 425 stream_->net_log().AddEvent( |
426 NetLog::TYPE_QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS, | 426 NetLog::TYPE_QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS, |
427 base::Bind(&SpdyHeaderBlockNetLogCallback, &request_headers_)); | 427 base::Bind(&QuicRequestNetLogCallback, &request_headers_, priority_)); |
428 | 428 |
429 bool has_upload_data = request_body_stream_ != NULL; | 429 bool has_upload_data = request_body_stream_ != NULL; |
430 | 430 |
431 next_state_ = STATE_SEND_HEADERS_COMPLETE; | 431 next_state_ = STATE_SEND_HEADERS_COMPLETE; |
432 int rv = (stream_->version() > QUIC_VERSION_12) ? | 432 int rv = (stream_->version() > QUIC_VERSION_12) ? |
433 stream_->WriteHeaders(request_headers_, !has_upload_data) : | 433 stream_->WriteHeaders(request_headers_, !has_upload_data) : |
434 stream_->WriteStreamData(request_, !has_upload_data, | 434 stream_->WriteStreamData(request_, !has_upload_data, |
435 base::Bind(&QuicHttpStream::OnIOComplete, | 435 base::Bind(&QuicHttpStream::OnIOComplete, |
436 weak_factory_.GetWeakPtr())); | 436 weak_factory_.GetWeakPtr())); |
437 request_headers_.clear(); | 437 request_headers_.clear(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 550 |
551 void QuicHttpStream::BufferResponseBody(const char* data, int length) { | 551 void QuicHttpStream::BufferResponseBody(const char* data, int length) { |
552 if (length == 0) | 552 if (length == 0) |
553 return; | 553 return; |
554 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); | 554 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); |
555 memcpy(io_buffer->data(), data, length); | 555 memcpy(io_buffer->data(), data, length); |
556 response_body_.push_back(make_scoped_refptr(io_buffer)); | 556 response_body_.push_back(make_scoped_refptr(io_buffer)); |
557 } | 557 } |
558 | 558 |
559 } // namespace net | 559 } // namespace net |
OLD | NEW |