| 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 <map> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 11 #include "net/quic/quic_protocol.h" | 12 #include "net/quic/quic_protocol.h" |
| 12 #include "net/spdy/spdy_framer.h" | 13 #include "net/spdy/spdy_framer.h" |
| 13 | 14 |
| 14 namespace net { | 15 namespace net { |
| 15 | 16 |
| 16 class NET_EXPORT_PRIVATE SpdyUtils { | 17 class NET_EXPORT_PRIVATE SpdyUtils { |
| 17 public: | 18 public: |
| 18 static std::string SerializeUncompressedHeaders( | 19 static std::string SerializeUncompressedHeaders( |
| 19 const SpdyHeaderBlock& headers); | 20 const SpdyHeaderBlock& headers); |
| 20 | 21 |
| 22 // Parses |data| as a std::string containing serialized HTTP/2 HEADERS frame, |
| 23 // populating |headers| with the key->value std:pairs found. |
| 24 // |content_length| will be populated with the value of the content-length |
| 25 // header if one or more are present. |
| 26 // Returns true on success, false if parsing fails, or invalid keys are found. |
| 27 static bool ParseHeaders(const char* data, |
| 28 uint32 data_len, |
| 29 int* content_length, |
| 30 SpdyHeaderBlock* headers); |
| 31 |
| 21 private: | 32 private: |
| 22 DISALLOW_COPY_AND_ASSIGN(SpdyUtils); | 33 DISALLOW_COPY_AND_ASSIGN(SpdyUtils); |
| 23 }; | 34 }; |
| 24 | 35 |
| 25 } // namespace net | 36 } // namespace net |
| 26 | 37 |
| 27 #endif // NET_QUIC_SPDY_UTILS_H_ | 38 #endif // NET_QUIC_SPDY_UTILS_H_ |
| OLD | NEW |