| 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 // 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 new_raw_headers.append(header); | 347 new_raw_headers.append(header); |
| 348 new_raw_headers.push_back('\0'); | 348 new_raw_headers.push_back('\0'); |
| 349 new_raw_headers.push_back('\0'); | 349 new_raw_headers.push_back('\0'); |
| 350 | 350 |
| 351 // Make this object hold the new data. | 351 // Make this object hold the new data. |
| 352 raw_headers_.clear(); | 352 raw_headers_.clear(); |
| 353 parsed_.clear(); | 353 parsed_.clear(); |
| 354 Parse(new_raw_headers); | 354 Parse(new_raw_headers); |
| 355 } | 355 } |
| 356 | 356 |
| 357 void HttpResponseHeaders::AddCookie(const std::string& cookie_string) { |
| 358 AddHeader("Set-Cookie: " + cookie_string); |
| 359 } |
| 360 |
| 357 void HttpResponseHeaders::ReplaceStatusLine(const std::string& new_status) { | 361 void HttpResponseHeaders::ReplaceStatusLine(const std::string& new_status) { |
| 358 CheckDoesNotHaveEmbededNulls(new_status); | 362 CheckDoesNotHaveEmbededNulls(new_status); |
| 359 // Copy up to the null byte. This just copies the status line. | 363 // Copy up to the null byte. This just copies the status line. |
| 360 std::string new_raw_headers(new_status); | 364 std::string new_raw_headers(new_status); |
| 361 new_raw_headers.push_back('\0'); | 365 new_raw_headers.push_back('\0'); |
| 362 | 366 |
| 363 HeaderSet empty_to_remove; | 367 HeaderSet empty_to_remove; |
| 364 MergeWithHeaders(new_raw_headers, empty_to_remove); | 368 MergeWithHeaders(new_raw_headers, empty_to_remove); |
| 365 } | 369 } |
| 366 | 370 |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 return true; | 1467 return true; |
| 1464 } | 1468 } |
| 1465 | 1469 |
| 1466 bool HttpResponseHeaders::IsChunkEncoded() const { | 1470 bool HttpResponseHeaders::IsChunkEncoded() const { |
| 1467 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1471 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
| 1468 return GetHttpVersion() >= HttpVersion(1, 1) && | 1472 return GetHttpVersion() >= HttpVersion(1, 1) && |
| 1469 HasHeaderValue("Transfer-Encoding", "chunked"); | 1473 HasHeaderValue("Transfer-Encoding", "chunked"); |
| 1470 } | 1474 } |
| 1471 | 1475 |
| 1472 } // namespace net | 1476 } // namespace net |
| OLD | NEW |