| 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 #ifndef NET_HTTP_HTTP_UTIL_H_ | 5 #ifndef NET_HTTP_HTTP_UTIL_H_ |
| 6 #define NET_HTTP_HTTP_UTIL_H_ | 6 #define NET_HTTP_HTTP_UTIL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 // Assemble "raw headers" in the format required by HttpResponseHeaders. | 195 // Assemble "raw headers" in the format required by HttpResponseHeaders. |
| 196 // This involves normalizing line terminators, converting [CR]LF to \0 and | 196 // This involves normalizing line terminators, converting [CR]LF to \0 and |
| 197 // handling HTTP line continuations (i.e., lines starting with LWS are | 197 // handling HTTP line continuations (i.e., lines starting with LWS are |
| 198 // continuations of the previous line). |buf_len| indicates the position of | 198 // continuations of the previous line). |buf_len| indicates the position of |
| 199 // the end-of-headers marker as defined by LocateEndOfHeaders. | 199 // the end-of-headers marker as defined by LocateEndOfHeaders. |
| 200 // If a \0 appears within the headers themselves, it will be stripped. This | 200 // If a \0 appears within the headers themselves, it will be stripped. This |
| 201 // is a workaround to avoid later code from incorrectly interpreting it as | 201 // is a workaround to avoid later code from incorrectly interpreting it as |
| 202 // a line terminator. | 202 // a line terminator. |
| 203 // | 203 // |
| 204 // TODO(eroman): we should use \n as the canonical line separator rather than | 204 // TODO(crbug.com/671799): Should remove or internalize this to |
| 205 // \0 to avoid this problem. Unfortunately the persistence layer | 205 // HttpResponseHeaders. |
| 206 // is already dependent on newlines being replaced by NULL so | |
| 207 // this is hard to change without breaking things. | |
| 208 static std::string AssembleRawHeaders(const char* buf, int buf_len); | 206 static std::string AssembleRawHeaders(const char* buf, int buf_len); |
| 209 | 207 |
| 210 // Converts assembled "raw headers" back to the HTTP response format. That is | 208 // Converts assembled "raw headers" back to the HTTP response format. That is |
| 211 // convert each \0 occurence to CRLF. This is used by DevTools. | 209 // convert each \0 occurence to CRLF. This is used by DevTools. |
| 212 // Since all line continuations info is already lost at this point, the result | 210 // Since all line continuations info is already lost at this point, the result |
| 213 // consists of status line and then one line for each header. | 211 // consists of status line and then one line for each header. |
| 214 static std::string ConvertHeadersBackToHTTPResponse(const std::string& str); | 212 static std::string ConvertHeadersBackToHTTPResponse(const std::string& str); |
| 215 | 213 |
| 216 // Given a comma separated ordered list of language codes, return | 214 // Given a comma separated ordered list of language codes, return |
| 217 // the list with a qvalue appended to each language. | 215 // the list with a qvalue appended to each language. |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 // True if quotes values are required to be properly quoted; false if | 454 // True if quotes values are required to be properly quoted; false if |
| 457 // mismatched quotes and other problems with quoted values should be more | 455 // mismatched quotes and other problems with quoted values should be more |
| 458 // or less gracefully treated as valid. | 456 // or less gracefully treated as valid. |
| 459 bool strict_quotes_; | 457 bool strict_quotes_; |
| 460 }; | 458 }; |
| 461 }; | 459 }; |
| 462 | 460 |
| 463 } // namespace net | 461 } // namespace net |
| 464 | 462 |
| 465 #endif // NET_HTTP_HTTP_UTIL_H_ | 463 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |