Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // The rules for header parsing were borrowed from Firefox: | 5 // The rules for header parsing were borrowed from Firefox: |
| 6 // http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpRespo nseHead.cpp | 6 // http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpRespo nseHead.cpp |
| 7 // The rules for parsing content-types were also borrowed from Firefox: | 7 // The rules for parsing content-types were also borrowed from Firefox: |
| 8 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 | 8 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 |
| 9 | 9 |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 const std::string& value) { | 346 const std::string& value) { |
| 347 // Copy up to the null byte. This just copies the status line. | 347 // Copy up to the null byte. This just copies the status line. |
| 348 std::string new_raw_headers(raw_headers_.c_str()); | 348 std::string new_raw_headers(raw_headers_.c_str()); |
| 349 new_raw_headers.push_back('\0'); | 349 new_raw_headers.push_back('\0'); |
| 350 | 350 |
| 351 MergeWithHeadersWithValue(new_raw_headers, name, value); | 351 MergeWithHeadersWithValue(new_raw_headers, name, value); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void HttpResponseHeaders::AddHeader(const std::string& header) { | 354 void HttpResponseHeaders::AddHeader(const std::string& header) { |
| 355 CheckDoesNotHaveEmbededNulls(header); | 355 CheckDoesNotHaveEmbededNulls(header); |
| 356 DCHECK_EQ('\0', raw_headers_[raw_headers_.size() - 2]); | 356 //DCHECK_EQ('\0', raw_headers_[raw_headers_.size() - 2]); |
| 357 DCHECK_EQ('\0', raw_headers_[raw_headers_.size() - 1]); | 357 //DCHECK_EQ('\0', raw_headers_[raw_headers_.size() - 1]); |
|
Matt Perry
2011/11/23 02:51:20
i was hitting this DCHECK with https-e installed d
| |
| 358 // Don't copy the last null. | 358 // Don't copy the last null. |
| 359 std::string new_raw_headers(raw_headers_, 0, raw_headers_.size() - 1); | 359 std::string new_raw_headers(raw_headers_, 0, raw_headers_.size() - 1); |
| 360 new_raw_headers.append(header); | 360 new_raw_headers.append(header); |
| 361 new_raw_headers.push_back('\0'); | 361 new_raw_headers.push_back('\0'); |
| 362 new_raw_headers.push_back('\0'); | 362 new_raw_headers.push_back('\0'); |
| 363 | 363 |
| 364 // Make this object hold the new data. | 364 // Make this object hold the new data. |
| 365 raw_headers_.clear(); | 365 raw_headers_.clear(); |
| 366 parsed_.clear(); | 366 parsed_.clear(); |
| 367 Parse(new_raw_headers); | 367 Parse(new_raw_headers); |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1285 // We have all the values; let's verify that they make sense for a 206 | 1285 // We have all the values; let's verify that they make sense for a 206 |
| 1286 // response. | 1286 // response. |
| 1287 if (*first_byte_position < 0 || *last_byte_position < 0 || | 1287 if (*first_byte_position < 0 || *last_byte_position < 0 || |
| 1288 *instance_length < 0 || *instance_length - 1 < *last_byte_position) | 1288 *instance_length < 0 || *instance_length - 1 < *last_byte_position) |
| 1289 return false; | 1289 return false; |
| 1290 | 1290 |
| 1291 return true; | 1291 return true; |
| 1292 } | 1292 } |
| 1293 | 1293 |
| 1294 } // namespace net | 1294 } // namespace net |
| OLD | NEW |