| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_QUIC_SPDY_UTILS_H_ | 5 #ifndef NET_QUIC_SPDY_UTILS_H_ |
| 6 #define NET_QUIC_SPDY_UTILS_H_ | 6 #define NET_QUIC_SPDY_UTILS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, | 27 // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, |
| 28 // populating |headers| with the key->value std:pairs found. | 28 // populating |headers| with the key->value std:pairs found. |
| 29 // |content_length| will be populated with the value of the content-length | 29 // |content_length| will be populated with the value of the content-length |
| 30 // header if one or more are present. | 30 // header if one or more are present. |
| 31 // Returns true on success, false if parsing fails, or invalid keys are found. | 31 // Returns true on success, false if parsing fails, or invalid keys are found. |
| 32 static bool ParseHeaders(const char* data, | 32 static bool ParseHeaders(const char* data, |
| 33 uint32_t data_len, | 33 uint32_t data_len, |
| 34 int64_t* content_length, | 34 int64_t* content_length, |
| 35 SpdyHeaderBlock* headers); | 35 SpdyHeaderBlock* headers); |
| 36 | 36 |
| 37 // Populate |content length| with the value of the content-length header if | 37 // Populate |content length| with the value of the content-length header. |
| 38 // one or more are present in the headers. Returns true on success, false if | 38 // Returns true on success, false if parsing fails or content-length header is |
| 39 // parsing fails. | 39 // missing. |
| 40 static bool ExtractContentLengthFromHeaders(int64_t* content_length, | 40 static bool ExtractContentLengthFromHeaders(int64_t* content_length, |
| 41 SpdyHeaderBlock* headers); | 41 SpdyHeaderBlock* headers); |
| 42 | 42 |
| 43 // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, | 43 // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, |
| 44 // populating |trailers| with the key->value std:pairs found. | 44 // populating |trailers| with the key->value std:pairs found. |
| 45 // The final offset header will be excluded from |trailers|, and instead the | 45 // The final offset header will be excluded from |trailers|, and instead the |
| 46 // value will be copied to |final_byte_offset|. | 46 // value will be copied to |final_byte_offset|. |
| 47 // Returns true on success, false if parsing fails, or invalid keys are found. | 47 // Returns true on success, false if parsing fails, or invalid keys are found. |
| 48 static bool ParseTrailers(const char* data, | 48 static bool ParseTrailers(const char* data, |
| 49 uint32_t data_len, | 49 uint32_t data_len, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 78 static bool PopulateHeaderBlockFromUrl(const std::string url, | 78 static bool PopulateHeaderBlockFromUrl(const std::string url, |
| 79 SpdyHeaderBlock* headers); | 79 SpdyHeaderBlock* headers); |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 DISALLOW_COPY_AND_ASSIGN(SpdyUtils); | 82 DISALLOW_COPY_AND_ASSIGN(SpdyUtils); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace net | 85 } // namespace net |
| 86 | 86 |
| 87 #endif // NET_QUIC_SPDY_UTILS_H_ | 87 #endif // NET_QUIC_SPDY_UTILS_H_ |
| OLD | NEW |