OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 | 9 |
10 MSVC_PUSH_WARNING_LEVEL(0); | 10 MSVC_PUSH_WARNING_LEVEL(0); |
(...skipping 15 matching lines...) Expand all Loading... |
26 WebCore::ResourceHandle* job, | 26 WebCore::ResourceHandle* job, |
27 const WebCore::ResourceResponse& response, | 27 const WebCore::ResourceResponse& response, |
28 const std::string& boundary) | 28 const std::string& boundary) |
29 : client_(client), | 29 : client_(client), |
30 job_(job), | 30 job_(job), |
31 original_response_(response), | 31 original_response_(response), |
32 boundary_("--"), | 32 boundary_("--"), |
33 first_received_data_(true), | 33 first_received_data_(true), |
34 processing_headers_(false), | 34 processing_headers_(false), |
35 stop_sending_(false) { | 35 stop_sending_(false) { |
36 boundary_.append(boundary); | 36 // Some servers report a boundary prefixed with "--". See bug 5786. |
| 37 if (StartsWithASCII(boundary, "--", true)) { |
| 38 boundary_.assign(boundary); |
| 39 } else { |
| 40 boundary_.append(boundary); |
| 41 } |
37 } | 42 } |
38 | 43 |
39 void MultipartResponseDelegate::OnReceivedData(const char* data, int data_len) { | 44 void MultipartResponseDelegate::OnReceivedData(const char* data, int data_len) { |
40 // stop_sending_ means that we've already received the final boundary token. | 45 // stop_sending_ means that we've already received the final boundary token. |
41 // The server should stop sending us data at this point, but if it does, we | 46 // The server should stop sending us data at this point, but if it does, we |
42 // just throw it away. | 47 // just throw it away. |
43 if (stop_sending_) | 48 if (stop_sending_) |
44 return; | 49 return; |
45 | 50 |
46 // TODO(tc): Figure out what to use for length_received. Maybe we can just | 51 // TODO(tc): Figure out what to use for length_received. Maybe we can just |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 std::string byte_range_upper_bound = | 314 std::string byte_range_upper_bound = |
310 content_range.substr(byte_range_upper_bound_start_offset, | 315 content_range.substr(byte_range_upper_bound_start_offset, |
311 byte_range_upper_bound_characters); | 316 byte_range_upper_bound_characters); |
312 | 317 |
313 if (!StringToInt(byte_range_lower_bound, content_range_lower_bound)) | 318 if (!StringToInt(byte_range_lower_bound, content_range_lower_bound)) |
314 return false; | 319 return false; |
315 if (!StringToInt(byte_range_upper_bound, content_range_upper_bound)) | 320 if (!StringToInt(byte_range_upper_bound, content_range_upper_bound)) |
316 return false; | 321 return false; |
317 return true; | 322 return true; |
318 } | 323 } |
OLD | NEW |