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 "storage/browser/blob/blob_url_request_job.h" | 5 #include "storage/browser/blob/blob_url_request_job.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 // If we already return the headers on success, we can't change the headers | 246 // If we already return the headers on success, we can't change the headers |
247 // now. Instead, we just error out. | 247 // now. Instead, we just error out. |
248 DCHECK(!response_info_) << "Cannot NotifyFailure after headers."; | 248 DCHECK(!response_info_) << "Cannot NotifyFailure after headers."; |
249 | 249 |
250 net::HttpStatusCode status_code = net::HTTP_INTERNAL_SERVER_ERROR; | 250 net::HttpStatusCode status_code = net::HTTP_INTERNAL_SERVER_ERROR; |
251 switch (error_code) { | 251 switch (error_code) { |
252 case net::ERR_ACCESS_DENIED: | 252 case net::ERR_ACCESS_DENIED: |
253 status_code = net::HTTP_FORBIDDEN; | 253 status_code = net::HTTP_FORBIDDEN; |
254 break; | 254 break; |
255 case net::ERR_FILE_NOT_FOUND: | 255 case net::ERR_FILE_NOT_FOUND: |
256 case net::ERR_CACHE_READ_FAILURE: | |
257 case net::ERR_CACHE_CHECKSUM_READ_FAILURE: | |
jsbell
2016/09/14 22:03:13
Maybe this (these?) should be HTTP_INTERNAL_SERVER
dmurph
2016/09/14 22:07:19
Sure, not really picky here, just don't want to DC
| |
256 status_code = net::HTTP_NOT_FOUND; | 258 status_code = net::HTTP_NOT_FOUND; |
257 break; | 259 break; |
258 case net::ERR_METHOD_NOT_SUPPORTED: | 260 case net::ERR_METHOD_NOT_SUPPORTED: |
259 status_code = net::HTTP_METHOD_NOT_ALLOWED; | 261 status_code = net::HTTP_METHOD_NOT_ALLOWED; |
260 break; | 262 break; |
261 case net::ERR_REQUEST_RANGE_NOT_SATISFIABLE: | 263 case net::ERR_REQUEST_RANGE_NOT_SATISFIABLE: |
262 status_code = net::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE; | 264 status_code = net::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE; |
263 break; | 265 break; |
266 case net::ERR_INVALID_ARGUMENT: | |
267 status_code = net::HTTP_BAD_REQUEST; | |
268 break; | |
269 case net::ERR_UNEXPECTED: | |
264 case net::ERR_FAILED: | 270 case net::ERR_FAILED: |
265 break; | 271 break; |
266 default: | 272 default: |
267 DCHECK(false); | 273 DCHECK(false) << "Error code not supported: " << error_code; |
268 break; | 274 break; |
269 } | 275 } |
270 HeadersCompleted(status_code); | 276 HeadersCompleted(status_code); |
271 } | 277 } |
272 | 278 |
273 void BlobURLRequestJob::HeadersCompleted(net::HttpStatusCode status_code) { | 279 void BlobURLRequestJob::HeadersCompleted(net::HttpStatusCode status_code) { |
274 std::string status("HTTP/1.1 "); | 280 std::string status("HTTP/1.1 "); |
275 status.append(base::IntToString(status_code)); | 281 status.append(base::IntToString(status_code)); |
276 status.append(" "); | 282 status.append(" "); |
277 status.append(net::GetHttpReasonPhrase(status_code)); | 283 status.append(net::GetHttpReasonPhrase(status_code)); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 | 321 |
316 response_info_.reset(new net::HttpResponseInfo()); | 322 response_info_.reset(new net::HttpResponseInfo()); |
317 response_info_->headers = headers; | 323 response_info_->headers = headers; |
318 if (blob_reader_) | 324 if (blob_reader_) |
319 response_info_->metadata = blob_reader_->side_data(); | 325 response_info_->metadata = blob_reader_->side_data(); |
320 | 326 |
321 NotifyHeadersComplete(); | 327 NotifyHeadersComplete(); |
322 } | 328 } |
323 | 329 |
324 } // namespace storage | 330 } // namespace storage |
OLD | NEW |