| 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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 mime_type->clear(); | 837 mime_type->clear(); |
| 838 charset->clear(); | 838 charset->clear(); |
| 839 | 839 |
| 840 std::string name = "content-type"; | 840 std::string name = "content-type"; |
| 841 std::string value; | 841 std::string value; |
| 842 | 842 |
| 843 bool had_charset = false; | 843 bool had_charset = false; |
| 844 | 844 |
| 845 void* iter = NULL; | 845 void* iter = NULL; |
| 846 while (EnumerateHeader(&iter, name, &value)) | 846 while (EnumerateHeader(&iter, name, &value)) |
| 847 HttpUtil::ParseContentType(value, mime_type, charset, &had_charset); | 847 HttpUtil::ParseContentType(value, mime_type, charset, &had_charset, NULL); |
| 848 } | 848 } |
| 849 | 849 |
| 850 bool HttpResponseHeaders::GetMimeType(std::string* mime_type) const { | 850 bool HttpResponseHeaders::GetMimeType(std::string* mime_type) const { |
| 851 std::string unused; | 851 std::string unused; |
| 852 GetMimeTypeAndCharset(mime_type, &unused); | 852 GetMimeTypeAndCharset(mime_type, &unused); |
| 853 return !mime_type->empty(); | 853 return !mime_type->empty(); |
| 854 } | 854 } |
| 855 | 855 |
| 856 bool HttpResponseHeaders::GetCharset(std::string* charset) const { | 856 bool HttpResponseHeaders::GetCharset(std::string* charset) const { |
| 857 std::string unused; | 857 std::string unused; |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 return true; | 1304 return true; |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 bool HttpResponseHeaders::IsChunkEncoded() const { | 1307 bool HttpResponseHeaders::IsChunkEncoded() const { |
| 1308 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1308 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
| 1309 return GetHttpVersion() >= HttpVersion(1, 1) && | 1309 return GetHttpVersion() >= HttpVersion(1, 1) && |
| 1310 HasHeaderValue("Transfer-Encoding", "chunked"); | 1310 HasHeaderValue("Transfer-Encoding", "chunked"); |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 } // namespace net | 1313 } // namespace net |
| OLD | NEW |