| 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 parsing content-types were borrowed from Firefox: | 5 // The rules for parsing content-types were borrowed from Firefox: |
| 6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 | 6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 |
| 7 | 7 |
| 8 #include "net/http/http_util.h" | 8 #include "net/http/http_util.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 | 903 |
| 904 name_end_ = colon; | 904 name_end_ = colon; |
| 905 | 905 |
| 906 // If the name starts with LWS, it is an invalid line. | 906 // If the name starts with LWS, it is an invalid line. |
| 907 // Leading LWS implies a line continuation, and these should have | 907 // Leading LWS implies a line continuation, and these should have |
| 908 // already been joined by AssembleRawHeaders(). | 908 // already been joined by AssembleRawHeaders(). |
| 909 if (name_begin_ == name_end_ || IsLWS(*name_begin_)) | 909 if (name_begin_ == name_end_ || IsLWS(*name_begin_)) |
| 910 continue; | 910 continue; |
| 911 | 911 |
| 912 TrimLWS(&name_begin_, &name_end_); | 912 TrimLWS(&name_begin_, &name_end_); |
| 913 if (name_begin_ == name_end_) | 913 if (!IsToken(name_begin_, name_end_)) |
| 914 continue; // skip malformed header | 914 continue; // skip malformed header |
| 915 | 915 |
| 916 values_begin_ = colon + 1; | 916 values_begin_ = colon + 1; |
| 917 TrimLWS(&values_begin_, &values_end_); | 917 TrimLWS(&values_begin_, &values_end_); |
| 918 | 918 |
| 919 // if we got a header name, then we are done. | 919 // if we got a header name, then we are done. |
| 920 return true; | 920 return true; |
| 921 } | 921 } |
| 922 return false; | 922 return false; |
| 923 } | 923 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 return true; | 1072 return true; |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 bool HttpUtil::NameValuePairsIterator::IsQuote(char c) const { | 1075 bool HttpUtil::NameValuePairsIterator::IsQuote(char c) const { |
| 1076 if (strict_quotes_) | 1076 if (strict_quotes_) |
| 1077 return c == '"'; | 1077 return c == '"'; |
| 1078 return HttpUtil::IsQuote(c); | 1078 return HttpUtil::IsQuote(c); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 } // namespace net | 1081 } // namespace net |
| OLD | NEW |