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 25 matching lines...) Expand all Loading... |
36 // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, | 36 // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, |
37 // populating |trailers| with the key->value std:pairs found. | 37 // populating |trailers| with the key->value std:pairs found. |
38 // The final offset header will be excluded from |trailers|, and instead the | 38 // The final offset header will be excluded from |trailers|, and instead the |
39 // value will be copied to |final_byte_offset|. | 39 // value will be copied to |final_byte_offset|. |
40 // Returns true on success, false if parsing fails, or invalid keys are found. | 40 // Returns true on success, false if parsing fails, or invalid keys are found. |
41 static bool ParseTrailers(const char* data, | 41 static bool ParseTrailers(const char* data, |
42 uint32_t data_len, | 42 uint32_t data_len, |
43 size_t* final_byte_offset, | 43 size_t* final_byte_offset, |
44 SpdyHeaderBlock* trailers); | 44 SpdyHeaderBlock* trailers); |
45 | 45 |
| 46 // Returns URL composed from scheme, authority, and path header |
| 47 // values, or empty string if any of those fields are missing. |
| 48 static std::string GetUrlFromHeaderBlock(const net::SpdyHeaderBlock& headers); |
| 49 |
| 50 // Returns true if result of |GetUrlFromHeaderBlock()| is non-empty |
| 51 // and is a well-formed URL. |
| 52 static bool UrlIsValid(const net::SpdyHeaderBlock& headers); |
| 53 |
46 private: | 54 private: |
47 DISALLOW_COPY_AND_ASSIGN(SpdyUtils); | 55 DISALLOW_COPY_AND_ASSIGN(SpdyUtils); |
48 }; | 56 }; |
49 | 57 |
50 } // namespace net | 58 } // namespace net |
51 | 59 |
52 #endif // NET_QUIC_SPDY_UTILS_H_ | 60 #endif // NET_QUIC_SPDY_UTILS_H_ |
OLD | NEW |