| 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 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 493 |
| 494 // Can't start with LWS (this would imply the segment is a continuation) | 494 // Can't start with LWS (this would imply the segment is a continuation) |
| 495 if (HttpUtil::IsLWS(*name_begin)) | 495 if (HttpUtil::IsLWS(*name_begin)) |
| 496 return false; | 496 return false; |
| 497 | 497 |
| 498 return true; | 498 return true; |
| 499 } | 499 } |
| 500 | 500 |
| 501 // Helper used by AssembleRawHeaders, to find the end of the status line. | 501 // Helper used by AssembleRawHeaders, to find the end of the status line. |
| 502 static const char* FindStatusLineEnd(const char* begin, const char* end) { | 502 static const char* FindStatusLineEnd(const char* begin, const char* end) { |
| 503 size_t i = StringPiece(begin, end - begin).find_first_of("\r\n"); | 503 size_t i = base::StringPiece(begin, end - begin).find_first_of("\r\n"); |
| 504 if (i == StringPiece::npos) | 504 if (i == base::StringPiece::npos) |
| 505 return end; | 505 return end; |
| 506 return begin + i; | 506 return begin + i; |
| 507 } | 507 } |
| 508 | 508 |
| 509 // Helper used by AssembleRawHeaders, to skip past leading LWS. | 509 // Helper used by AssembleRawHeaders, to skip past leading LWS. |
| 510 static const char* FindFirstNonLWS(const char* begin, const char* end) { | 510 static const char* FindFirstNonLWS(const char* begin, const char* end) { |
| 511 for (const char* cur = begin; cur != end; ++cur) { | 511 for (const char* cur = begin; cur != end; ++cur) { |
| 512 if (!HttpUtil::IsLWS(*cur)) | 512 if (!HttpUtil::IsLWS(*cur)) |
| 513 return cur; | 513 return cur; |
| 514 } | 514 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 TrimLWS(&value_begin_, &value_end_); | 671 TrimLWS(&value_begin_, &value_end_); |
| 672 | 672 |
| 673 // bypass empty values. | 673 // bypass empty values. |
| 674 if (value_begin_ != value_end_) | 674 if (value_begin_ != value_end_) |
| 675 return true; | 675 return true; |
| 676 } | 676 } |
| 677 return false; | 677 return false; |
| 678 } | 678 } |
| 679 | 679 |
| 680 } // namespace net | 680 } // namespace net |
| OLD | NEW |