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_http_stream.h" | 5 #include "net/spdy/spdy_http_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // ERR_IO_PENDING is the only possible error. | 417 // ERR_IO_PENDING is the only possible error. |
418 CHECK_GE(rv, 0); | 418 CHECK_GE(rv, 0); |
419 OnRequestBodyReadCompleted(rv); | 419 OnRequestBodyReadCompleted(rv); |
420 } | 420 } |
421 } | 421 } |
422 | 422 |
423 void SpdyHttpStream::OnRequestBodyReadCompleted(int status) { | 423 void SpdyHttpStream::OnRequestBodyReadCompleted(int status) { |
424 CHECK_GE(status, 0); | 424 CHECK_GE(status, 0); |
425 request_body_buf_size_ = status; | 425 request_body_buf_size_ = status; |
426 const bool eof = request_info_->upload_data_stream->IsEOF(); | 426 const bool eof = request_info_->upload_data_stream->IsEOF(); |
| 427 // Only the final fame may have a length of 0. |
427 if (eof) { | 428 if (eof) { |
428 CHECK_GE(request_body_buf_size_, 0); | 429 CHECK_GE(request_body_buf_size_, 0); |
429 } else { | 430 } else { |
430 CHECK_GT(request_body_buf_size_, 0); | 431 CHECK_GT(request_body_buf_size_, 0); |
431 } | 432 } |
432 stream_->SendData(request_body_buf_.get(), | 433 stream_->SendData(request_body_buf_.get(), |
433 request_body_buf_size_, | 434 request_body_buf_size_, |
434 eof ? NO_MORE_DATA_TO_SEND : MORE_DATA_TO_SEND); | 435 eof ? NO_MORE_DATA_TO_SEND : MORE_DATA_TO_SEND); |
435 } | 436 } |
436 | 437 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 Close(false); | 529 Close(false); |
529 delete this; | 530 delete this; |
530 } | 531 } |
531 | 532 |
532 void SpdyHttpStream::SetPriority(RequestPriority priority) { | 533 void SpdyHttpStream::SetPriority(RequestPriority priority) { |
533 // TODO(akalin): Plumb this through to |stream_request_| and | 534 // TODO(akalin): Plumb this through to |stream_request_| and |
534 // |stream_|. | 535 // |stream_|. |
535 } | 536 } |
536 | 537 |
537 } // namespace net | 538 } // namespace net |
OLD | NEW |