Chromium Code Reviews| Index: net/http/http_cache_transaction.cc |
| diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc |
| index 07fa4dbacc4dbb68763c70cfde3c639a809e6677..57a309e7ba5845358620d08b8af5026f36abbe1d 100644 |
| --- a/net/http/http_cache_transaction.cc |
| +++ b/net/http/http_cache_transaction.cc |
| @@ -1385,6 +1385,17 @@ int HttpCache::Transaction::DoCacheReadResponse() { |
| next_state_ = STATE_CACHE_READ_RESPONSE_COMPLETE; |
| io_buf_len_ = entry_->disk_entry->GetDataSize(kResponseInfoIndex); |
| + if (io_buf_len_ > 0) { |
|
rvargas (doing something else)
2013/04/30 18:06:25
This doesn't look good to me. The disk cache is ne
pasko-google - do not use
2013/04/30 19:12:38
If the returned value is zero we create an IOBuffe
rvargas (doing something else)
2013/04/30 21:09:05
I'm sorry but I don't see where we would crash if
pasko-google - do not use
2013/04/30 22:13:33
I was wrong when assuming 0 size would fail, sorry
rvargas (doing something else)
2013/04/30 22:50:07
We don't need to disable the sandbox... we crash r
pasko-google - do not use
2013/05/02 16:56:37
We have the sandbox because the renderer, if trick
rvargas (doing something else)
2013/05/02 17:52:31
And that is why the sandbox has nothing to do with
|
| + UMA_HISTOGRAM_BOOLEAN("HttpCache.TruncatedHeader", false); |
| + } else { |
| + UMA_HISTOGRAM_BOOLEAN("HttpCache.TruncatedHeader", true); |
| + DLOG(WARNING) << "Truncated cache entry header encountered"; |
| + mode_ = NONE; |
| + if (partial_.get()) |
| + partial_->RestoreHeaders(&custom_request_->extra_headers); |
| + next_state_ = STATE_SEND_REQUEST; |
| + return OK; |
| + } |
| read_buf_ = new IOBuffer(io_buf_len_); |
| net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO); |
| @@ -1482,8 +1493,19 @@ int HttpCache::Transaction::DoCacheReadMetadata() { |
| DCHECK(!response_.metadata); |
| next_state_ = STATE_CACHE_READ_METADATA_COMPLETE; |
| - response_.metadata = |
| - new IOBufferWithSize(entry_->disk_entry->GetDataSize(kMetadataIndex)); |
| + int32 data_size = entry_->disk_entry->GetDataSize(kMetadataIndex); |
| + if (data_size > 0) { |
|
rvargas (doing something else)
2013/04/30 18:06:25
same here
|
| + UMA_HISTOGRAM_BOOLEAN("HttpCache.TruncatedMetadata", false); |
| + } else { |
| + UMA_HISTOGRAM_BOOLEAN("HttpCache.TruncatedMetadata", true); |
| + DLOG(WARNING) << "Truncated cache entry metadata encountered"; |
| + mode_ = NONE; |
| + if (partial_.get()) |
| + partial_->RestoreHeaders(&custom_request_->extra_headers); |
| + next_state_ = STATE_SEND_REQUEST; |
| + return OK; |
| + } |
| + response_.metadata = new IOBufferWithSize(data_size); |
| net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO); |
| ReportCacheActionStart(); |