| Index: net/quic/quic_http_stream.cc
|
| diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc
|
| index 14a64430d69ab0deddc2bb6eed0525665f0347f2..3a2d8936df0d212b8d29593279e033042e0dcb4b 100644
|
| --- a/net/quic/quic_http_stream.cc
|
| +++ b/net/quic/quic_http_stream.cc
|
| @@ -57,8 +57,8 @@ int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info,
|
| const CompletionCallback& callback) {
|
| DCHECK(!stream_);
|
| if (!session_)
|
| - return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED :
|
| - ERR_QUIC_HANDSHAKE_FAILED;
|
| + return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED
|
| + : ERR_QUIC_HANDSHAKE_FAILED;
|
|
|
| if (request_info->url.SchemeIsSecure()) {
|
| SSLInfo ssl_info;
|
| @@ -74,8 +74,9 @@ int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info,
|
| priority_ = priority;
|
|
|
| int rv = stream_request_.StartRequest(
|
| - session_, &stream_, base::Bind(&QuicHttpStream::OnStreamReady,
|
| - weak_factory_.GetWeakPtr()));
|
| + session_,
|
| + &stream_,
|
| + base::Bind(&QuicHttpStream::OnStreamReady, weak_factory_.GetWeakPtr()));
|
| if (rv == ERR_IO_PENDING) {
|
| callback_ = callback;
|
| } else if (rv == OK) {
|
| @@ -110,8 +111,11 @@ int QuicHttpStream::SendRequest(const HttpRequestHeaders& request_headers,
|
| QuicPriority priority = ConvertRequestPriorityToQuicPriority(priority_);
|
| stream_->set_priority(priority);
|
| // Store the serialized request headers.
|
| - CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers,
|
| - &request_headers_, SPDY3, /*direct=*/true);
|
| + CreateSpdyHeadersFromHttpRequest(*request_info_,
|
| + request_headers,
|
| + &request_headers_,
|
| + SPDY3,
|
| + /*direct=*/true);
|
|
|
| // Store the request body.
|
| request_body_stream_ = request_info_->upload_data_stream;
|
| @@ -170,8 +174,9 @@ const HttpResponseInfo* QuicHttpStream::GetResponseInfo() const {
|
| return response_info_;
|
| }
|
|
|
| -int QuicHttpStream::ReadResponseBody(
|
| - IOBuffer* buf, int buf_len, const CompletionCallback& callback) {
|
| +int QuicHttpStream::ReadResponseBody(IOBuffer* buf,
|
| + int buf_len,
|
| + const CompletionCallback& callback) {
|
| CHECK(buf);
|
| CHECK(buf_len);
|
| CHECK(!callback.is_null());
|
| @@ -189,7 +194,8 @@ int QuicHttpStream::ReadResponseBody(
|
| } else {
|
| const int bytes_remaining = data->size() - bytes_to_copy;
|
| IOBufferWithSize* new_buffer = new IOBufferWithSize(bytes_remaining);
|
| - memcpy(new_buffer->data(), &(data->data()[bytes_to_copy]),
|
| + memcpy(new_buffer->data(),
|
| + &(data->data()[bytes_to_copy]),
|
| bytes_remaining);
|
| response_body_.pop_front();
|
| response_body_.push_front(make_scoped_refptr(new_buffer));
|
| @@ -329,8 +335,8 @@ int QuicHttpStream::OnDataReceived(const char* data, int length) {
|
|
|
| void QuicHttpStream::OnClose(QuicErrorCode error) {
|
| if (error != QUIC_NO_ERROR) {
|
| - response_status_ = was_handshake_confirmed_ ?
|
| - ERR_QUIC_PROTOCOL_ERROR : ERR_QUIC_HANDSHAKE_FAILED;
|
| + response_status_ = was_handshake_confirmed_ ? ERR_QUIC_PROTOCOL_ERROR
|
| + : ERR_QUIC_HANDSHAKE_FAILED;
|
| } else if (!response_headers_received_) {
|
| response_status_ = ERR_ABORTED;
|
| }
|
| @@ -343,8 +349,8 @@ void QuicHttpStream::OnClose(QuicErrorCode error) {
|
|
|
| void QuicHttpStream::OnError(int error) {
|
| stream_ = NULL;
|
| - response_status_ = was_handshake_confirmed_ ?
|
| - error : ERR_QUIC_HANDSHAKE_FAILED;
|
| + response_status_ =
|
| + was_handshake_confirmed_ ? error : ERR_QUIC_HANDSHAKE_FAILED;
|
| if (!callback_.is_null())
|
| DoCallback(response_status_);
|
| }
|
| @@ -425,12 +431,16 @@ int QuicHttpStream::DoSendHeaders() {
|
| // Log the actual request with the URL Request's net log.
|
| stream_net_log_.AddEvent(
|
| NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS,
|
| - base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_,
|
| + base::Bind(&QuicRequestNetLogCallback,
|
| + stream_->id(),
|
| + &request_headers_,
|
| priority_));
|
| // Also log to the QuicSession's net log.
|
| stream_->net_log().AddEvent(
|
| NetLog::TYPE_QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS,
|
| - base::Bind(&QuicRequestNetLogCallback, stream_->id(), &request_headers_,
|
| + base::Bind(&QuicRequestNetLogCallback,
|
| + stream_->id(),
|
| + &request_headers_,
|
| priority_));
|
|
|
| bool has_upload_data = request_body_stream_ != NULL;
|
| @@ -445,8 +455,7 @@ int QuicHttpStream::DoSendHeadersComplete(int rv) {
|
| if (rv < 0)
|
| return rv;
|
|
|
| - next_state_ = request_body_stream_ ?
|
| - STATE_READ_REQUEST_BODY : STATE_OPEN;
|
| + next_state_ = request_body_stream_ ? STATE_READ_REQUEST_BODY : STATE_OPEN;
|
|
|
| return OK;
|
| }
|
| @@ -486,7 +495,8 @@ int QuicHttpStream::DoSendBody() {
|
| next_state_ = STATE_SEND_BODY_COMPLETE;
|
| base::StringPiece data(request_body_buf_->data(), len);
|
| return stream_->WriteStreamData(
|
| - data, eof,
|
| + data,
|
| + eof,
|
| base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| @@ -514,8 +524,8 @@ int QuicHttpStream::ParseResponseHeaders() {
|
| SpdyFramer framer(SPDY3);
|
| SpdyHeaderBlock headers;
|
| char* data = read_buf_->StartOfBuffer();
|
| - size_t len = framer.ParseHeaderBlockInBuffer(data, read_buf_->offset(),
|
| - &headers);
|
| + size_t len =
|
| + framer.ParseHeaderBlockInBuffer(data, read_buf_->offset(), &headers);
|
|
|
| if (len == 0) {
|
| return ERR_IO_PENDING;
|
| @@ -542,8 +552,8 @@ int QuicHttpStream::ParseResponseHeaders() {
|
| response_info_->socket_address = HostPortPair::FromIPEndPoint(address);
|
| response_info_->connection_info =
|
| HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3;
|
| - response_info_->vary_data
|
| - .Init(*request_info_, *response_info_->headers.get());
|
| + response_info_->vary_data.Init(*request_info_,
|
| + *response_info_->headers.get());
|
| response_info_->was_npn_negotiated = true;
|
| response_info_->npn_negotiated_protocol = "quic/1+spdy/3";
|
| response_headers_received_ = true;
|
|
|