| 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 // 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 raw_headers_ = "HTTP/0.9"; | 446 raw_headers_ = "HTTP/0.9"; |
| 447 } else if (parsed_http_version_ >= HttpVersion(1, 1)) { | 447 } else if (parsed_http_version_ >= HttpVersion(1, 1)) { |
| 448 http_version_ = HttpVersion(1, 1); | 448 http_version_ = HttpVersion(1, 1); |
| 449 raw_headers_ = "HTTP/1.1"; | 449 raw_headers_ = "HTTP/1.1"; |
| 450 } else { | 450 } else { |
| 451 // Treat everything else like HTTP 1.0 | 451 // Treat everything else like HTTP 1.0 |
| 452 http_version_ = HttpVersion(1, 0); | 452 http_version_ = HttpVersion(1, 0); |
| 453 raw_headers_ = "HTTP/1.0"; | 453 raw_headers_ = "HTTP/1.0"; |
| 454 } | 454 } |
| 455 if (parsed_http_version_ != http_version_) { | 455 if (parsed_http_version_ != http_version_) { |
| 456 DLOG(INFO) << "assuming HTTP/" << http_version_.major() << "." | 456 DLOG(INFO) << "assuming HTTP/" << http_version_.major_version() << "." |
| 457 << http_version_.minor(); | 457 << http_version_.minor_version(); |
| 458 } | 458 } |
| 459 | 459 |
| 460 // TODO(eroman): this doesn't make sense if ParseVersion failed. | 460 // TODO(eroman): this doesn't make sense if ParseVersion failed. |
| 461 string::const_iterator p = find(line_begin, line_end, ' '); | 461 string::const_iterator p = find(line_begin, line_end, ' '); |
| 462 | 462 |
| 463 if (p == line_end) { | 463 if (p == line_end) { |
| 464 DLOG(INFO) << "missing response status; assuming 200 OK"; | 464 DLOG(INFO) << "missing response status; assuming 200 OK"; |
| 465 raw_headers_.append(" 200 OK"); | 465 raw_headers_.append(" 200 OK"); |
| 466 raw_headers_.push_back('\0'); | 466 raw_headers_.push_back('\0'); |
| 467 response_code_ = 200; | 467 response_code_ = 200; |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 int64 result; | 929 int64 result; |
| 930 bool ok = StringToInt64(content_length_val, &result); | 930 bool ok = StringToInt64(content_length_val, &result); |
| 931 if (!ok || result < 0) | 931 if (!ok || result < 0) |
| 932 return -1; | 932 return -1; |
| 933 | 933 |
| 934 return result; | 934 return result; |
| 935 } | 935 } |
| 936 | 936 |
| 937 } // namespace net | 937 } // namespace net |
| 938 | 938 |
| OLD | NEW |