OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef NET_TOOLS_BALSA_BALSA_HEADERS_H_ | 5 #ifndef NET_TOOLS_BALSA_BALSA_HEADERS_H_ |
6 #define NET_TOOLS_BALSA_BALSA_HEADERS_H_ | 6 #define NET_TOOLS_BALSA_BALSA_HEADERS_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 // accessors to work, use the Set* functions above this one. | 931 // accessors to work, use the Set* functions above this one. |
932 // SetFirstLine is stuff useful, however, if all you care about is correct | 932 // SetFirstLine is stuff useful, however, if all you care about is correct |
933 // serialization with the rest of the header object. | 933 // serialization with the rest of the header object. |
934 void SetFirstLine(const base::StringPiece& line); | 934 void SetFirstLine(const base::StringPiece& line); |
935 | 935 |
936 // Simple accessors to some of the internal state | 936 // Simple accessors to some of the internal state |
937 bool transfer_encoding_is_chunked() const { | 937 bool transfer_encoding_is_chunked() const { |
938 return transfer_encoding_is_chunked_; | 938 return transfer_encoding_is_chunked_; |
939 } | 939 } |
940 | 940 |
941 static bool ResponseCodeImpliesNoBody(int code) { | 941 static bool ResponseCodeImpliesNoBody(size_t code) { |
942 // From HTTP spec section 6.1.1 all 1xx responses must not have a body, | 942 // From HTTP spec section 6.1.1 all 1xx responses must not have a body, |
943 // as well as 204 No Content and 304 Not Modified. | 943 // as well as 204 No Content and 304 Not Modified. |
944 return ((code >= 100) && (code <= 199)) || (code == 204) || (code == 304); | 944 return ((code >= 100) && (code <= 199)) || (code == 204) || (code == 304); |
945 } | 945 } |
946 | 946 |
947 // Note: never check this for requests. Nothing bad will happen if you do, | 947 // Note: never check this for requests. Nothing bad will happen if you do, |
948 // but spec does not allow requests framed by connection close. | 948 // but spec does not allow requests framed by connection close. |
949 // TODO(vitaliyl): refactor. | 949 // TODO(vitaliyl): refactor. |
950 bool is_framed_by_connection_close() const { | 950 bool is_framed_by_connection_close() const { |
951 // We declare that response is framed by connection close if it has no | 951 // We declare that response is framed by connection close if it has no |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 size_t end_of_firstline_idx_; | 1129 size_t end_of_firstline_idx_; |
1130 | 1130 |
1131 bool transfer_encoding_is_chunked_; | 1131 bool transfer_encoding_is_chunked_; |
1132 | 1132 |
1133 HeaderLines header_lines_; | 1133 HeaderLines header_lines_; |
1134 }; | 1134 }; |
1135 | 1135 |
1136 } // namespace net | 1136 } // namespace net |
1137 | 1137 |
1138 #endif // NET_TOOLS_BALSA_BALSA_HEADERS_H_ | 1138 #endif // NET_TOOLS_BALSA_BALSA_HEADERS_H_ |
OLD | NEW |