Index: net/spdy/spdy_http_stream.cc |
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc |
index 01656e93cc912679f174bbe98428388fca410ec5..d2ae8895542b0990f860e0a1c953623a54c48363 100644 |
--- a/net/spdy/spdy_http_stream.cc |
+++ b/net/spdy/spdy_http_stream.cc |
@@ -99,14 +99,6 @@ int SpdyHttpStream::InitializeStream(const HttpRequestInfo* request_info, |
return rv; |
} |
-UploadProgress SpdyHttpStream::GetUploadProgress() const { |
- if (!request_info_ || !HasUploadData()) |
- return UploadProgress(); |
- |
- return UploadProgress(request_info_->upload_data_stream->position(), |
- request_info_->upload_data_stream->size()); |
-} |
- |
int SpdyHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { |
CHECK(!callback.is_null()); |
if (stream_closed_) |
@@ -128,6 +120,12 @@ int SpdyHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { |
int SpdyHttpStream::ReadResponseBody( |
IOBuffer* buf, int buf_len, const CompletionCallback& callback) { |
+ // Invalidate HttpRequestInfo pointer. This is to allow the stream to be |
+ // shared across multiple transactions which might require this |
+ // stream to outlive the request_'s owner. |
+ if (request_info_) |
+ ResetRequestInfo(); |
+ |
if (stream_.get()) |
CHECK(!stream_->IsIdle()); |
@@ -375,7 +373,7 @@ void SpdyHttpStream::OnTrailers(const SpdyHeaderBlock& trailers) {} |
void SpdyHttpStream::OnClose(int status) { |
// Cancel any pending reads from the upload data stream. |
- if (request_info_->upload_data_stream) |
+ if (request_info_ && request_info_->upload_data_stream) |
request_info_->upload_data_stream->Reset(); |
if (stream_.get()) { |
@@ -620,4 +618,12 @@ void SpdyHttpStream::SetPriority(RequestPriority priority) { |
// |stream_|. |
} |
+void SpdyHttpStream::ResetRequestInfo() { |
+ // Only allowed when Reading of response body starts. It is safe to reset it |
+ // at this point since request_->upload_data_stream is also not needed |
+ // anymore. |
+ |
+ request_info_ = nullptr; |
+} |
+ |
} // namespace net |