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 26 matching lines...) Expand all Loading... | |
37 // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, | 37 // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, |
38 // populating |trailers| with the key->value std:pairs found. | 38 // populating |trailers| with the key->value std:pairs found. |
39 // The final offset header will be excluded from |trailers|, and instead the | 39 // The final offset header will be excluded from |trailers|, and instead the |
40 // value will be copied to |final_byte_offset|. | 40 // value will be copied to |final_byte_offset|. |
41 // Returns true on success, false if parsing fails, or invalid keys are found. | 41 // Returns true on success, false if parsing fails, or invalid keys are found. |
42 static bool ParseTrailers(const char* data, | 42 static bool ParseTrailers(const char* data, |
43 uint32_t data_len, | 43 uint32_t data_len, |
44 size_t* final_byte_offset, | 44 size_t* final_byte_offset, |
45 SpdyHeaderBlock* trailers); | 45 SpdyHeaderBlock* trailers); |
46 | 46 |
47 | |
ramant (doing other things)
2016/04/21 21:00:27
overly nit: extra blank line (not sure if git cl f
Ryan Hamilton
2016/04/21 21:49:55
Not sure either, but it seems to be gone in the fi
| |
47 // Copies a list of headers to a SpdyHeaderBlock. Performs similar validation | 48 // Copies a list of headers to a SpdyHeaderBlock. Performs similar validation |
48 // to SpdyFramer::ParseHeaderBlockInBuffer. | 49 // to SpdyFramer::ParseHeaderBlockInBuffer and ParseHeaders, above. |
50 static bool CopyAndValidateHeaders(const QuicHeaderList& header_list, | |
51 int64_t* content_length, | |
52 SpdyHeaderBlock* headers); | |
53 | |
54 // Copies a list of headers to a SpdyHeaderBlock. Performs similar validation | |
55 // to SpdyFramer::ParseHeaderBlockInBuffer and ParseTrailers, above. | |
49 static bool CopyAndValidateTrailers(const QuicHeaderList& header_list, | 56 static bool CopyAndValidateTrailers(const QuicHeaderList& header_list, |
50 size_t* final_byte_offset, | 57 size_t* final_byte_offset, |
51 SpdyHeaderBlock* trailers); | 58 SpdyHeaderBlock* trailers); |
52 | 59 |
53 // Returns URL composed from scheme, authority, and path header | 60 // Returns URL composed from scheme, authority, and path header |
54 // values, or empty string if any of those fields are missing. | 61 // values, or empty string if any of those fields are missing. |
55 static std::string GetUrlFromHeaderBlock(const net::SpdyHeaderBlock& headers); | 62 static std::string GetUrlFromHeaderBlock(const net::SpdyHeaderBlock& headers); |
56 | 63 |
57 // Returns hostname, or empty std::string if missing. | 64 // Returns hostname, or empty std::string if missing. |
58 static std::string GetHostNameFromHeaderBlock(const SpdyHeaderBlock& headers); | 65 static std::string GetHostNameFromHeaderBlock(const SpdyHeaderBlock& headers); |
59 | 66 |
60 // Returns true if result of |GetUrlFromHeaderBlock()| is non-empty | 67 // Returns true if result of |GetUrlFromHeaderBlock()| is non-empty |
61 // and is a well-formed URL. | 68 // and is a well-formed URL. |
62 static bool UrlIsValid(const net::SpdyHeaderBlock& headers); | 69 static bool UrlIsValid(const net::SpdyHeaderBlock& headers); |
63 | 70 |
64 private: | 71 private: |
65 DISALLOW_COPY_AND_ASSIGN(SpdyUtils); | 72 DISALLOW_COPY_AND_ASSIGN(SpdyUtils); |
66 }; | 73 }; |
67 | 74 |
68 } // namespace net | 75 } // namespace net |
69 | 76 |
70 #endif // NET_QUIC_SPDY_UTILS_H_ | 77 #endif // NET_QUIC_SPDY_UTILS_H_ |
OLD | NEW |