Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Side by Side Diff: webkit/glue/multipart_response_delegate.cc

Issue 9198: This fixes bug http://code.google.com/p/chromium/issues/detail?id=4076, which... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/glue/multipart_response_delegate_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 WebCore::String content_type = response.httpHeaderField("Content-Type"); 240 WebCore::String content_type = response.httpHeaderField("Content-Type");
241 std::string content_type_as_string = 241 std::string content_type_as_string =
242 webkit_glue::StringToStdString(content_type); 242 webkit_glue::StringToStdString(content_type);
243 243
244 size_t boundary_start_offset = content_type_as_string.find("boundary="); 244 size_t boundary_start_offset = content_type_as_string.find("boundary=");
245 if (boundary_start_offset == std::wstring::npos) { 245 if (boundary_start_offset == std::wstring::npos) {
246 return false; 246 return false;
247 } 247 }
248 248
249 boundary_start_offset += strlen("boundary="); 249 boundary_start_offset += strlen("boundary=");
250 size_t boundary_end_offset = content_type.length(); 250
251 size_t boundary_end_offset =
252 content_type_as_string.find(';', boundary_start_offset);
253
254 if (boundary_end_offset == std::string::npos)
255 boundary_end_offset = content_type_as_string.length();
251 256
252 size_t boundary_length = boundary_end_offset - boundary_start_offset; 257 size_t boundary_length = boundary_end_offset - boundary_start_offset;
253 258
254 *multipart_boundary = 259 *multipart_boundary =
255 content_type_as_string.substr(boundary_start_offset, boundary_length); 260 content_type_as_string.substr(boundary_start_offset, boundary_length);
256 return true; 261 return true;
257 } 262 }
258 263
259 bool MultipartResponseDelegate::ReadContentRanges( 264 bool MultipartResponseDelegate::ReadContentRanges(
260 const WebCore::ResourceResponse& response, 265 const WebCore::ResourceResponse& response,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 std::string byte_range_upper_bound = 306 std::string byte_range_upper_bound =
302 content_range.substr(byte_range_upper_bound_start_offset, 307 content_range.substr(byte_range_upper_bound_start_offset,
303 byte_range_upper_bound_characters); 308 byte_range_upper_bound_characters);
304 309
305 if (!StringToInt(byte_range_lower_bound, content_range_lower_bound)) 310 if (!StringToInt(byte_range_lower_bound, content_range_lower_bound))
306 return false; 311 return false;
307 if (!StringToInt(byte_range_upper_bound, content_range_upper_bound)) 312 if (!StringToInt(byte_range_upper_bound, content_range_upper_bound))
308 return false; 313 return false;
309 return true; 314 return true;
310 } 315 }
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/multipart_response_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698