| 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_SPDY_SPDY_HTTP_UTILS_H_ | 5 #ifndef NET_SPDY_SPDY_HTTP_UTILS_H_ |
| 6 #define NET_SPDY_SPDY_HTTP_UTILS_H_ | 6 #define NET_SPDY_SPDY_HTTP_UTILS_H_ |
| 7 | 7 |
| 8 #include "net/base/net_export.h" | 8 #include "net/base/net_export.h" |
| 9 #include "net/base/request_priority.h" | 9 #include "net/base/request_priority.h" |
| 10 #include "net/spdy/spdy_framer.h" | 10 #include "net/spdy/spdy_framer.h" |
| 11 #include "net/spdy/spdy_header_block.h" | 11 #include "net/spdy/spdy_header_block.h" |
| 12 #include "net/spdy/spdy_protocol.h" | 12 #include "net/spdy/spdy_protocol.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class HttpResponseInfo; | 17 class HttpResponseInfo; |
| 18 struct HttpRequestInfo; | 18 struct HttpRequestInfo; |
| 19 class HttpRequestHeaders; | 19 class HttpRequestHeaders; |
| 20 class HttpResponseHeaders; | 20 class HttpResponseHeaders; |
| 21 | 21 |
| 22 // Convert a SpdyHeaderBlock into an HttpResponseInfo. | 22 // Convert a SpdyHeaderBlock into an HttpResponseInfo. |
| 23 // |headers| input parameter with the SpdyHeaderBlock. | 23 // |headers| input parameter with the SpdyHeaderBlock. |
| 24 // |response| output parameter for the HttpResponseInfo. | 24 // |response| output parameter for the HttpResponseInfo. |
| 25 // Returns true if successfully converted. False if the SpdyHeaderBlock is | 25 // Returns true if successfully converted. False if the SpdyHeaderBlock is |
| 26 // incomplete (e.g. missing 'status' or 'version'). | 26 // incomplete (e.g. missing 'status' or 'version'). |
| 27 NET_EXPORT bool SpdyHeadersToHttpResponse( | 27 NET_EXPORT bool SpdyHeadersToHttpResponse( |
| 28 const SpdyHeaderBlock& headers, | 28 const SpdyHeaderBlock& headers, |
| 29 SpdyMajorVersion protocol_version, | |
| 30 HttpResponseInfo* response); | 29 HttpResponseInfo* response); |
| 31 | 30 |
| 32 // Create a SpdyHeaderBlock from HttpRequestInfo and HttpRequestHeaders. | 31 // Create a SpdyHeaderBlock from HttpRequestInfo and HttpRequestHeaders. |
| 33 NET_EXPORT void CreateSpdyHeadersFromHttpRequest( | 32 NET_EXPORT void CreateSpdyHeadersFromHttpRequest( |
| 34 const HttpRequestInfo& info, | 33 const HttpRequestInfo& info, |
| 35 const HttpRequestHeaders& request_headers, | 34 const HttpRequestHeaders& request_headers, |
| 36 SpdyMajorVersion protocol_version, | |
| 37 bool direct, | 35 bool direct, |
| 38 SpdyHeaderBlock* headers); | 36 SpdyHeaderBlock* headers); |
| 39 | 37 |
| 40 // Create a SpdyHeaderBlock from HttpResponseHeaders. | 38 // Create a SpdyHeaderBlock from HttpResponseHeaders. |
| 41 NET_EXPORT void CreateSpdyHeadersFromHttpResponse( | 39 NET_EXPORT void CreateSpdyHeadersFromHttpResponse( |
| 42 const HttpResponseHeaders& response_headers, | 40 const HttpResponseHeaders& response_headers, |
| 43 SpdyMajorVersion protocol_version, | |
| 44 SpdyHeaderBlock* headers); | 41 SpdyHeaderBlock* headers); |
| 45 | 42 |
| 46 // Create HttpRequestHeaders from SpdyHeaderBlock. | 43 // Create HttpRequestHeaders from SpdyHeaderBlock. |
| 47 NET_EXPORT void ConvertHeaderBlockToHttpRequestHeaders( | 44 NET_EXPORT void ConvertHeaderBlockToHttpRequestHeaders( |
| 48 const SpdyHeaderBlock& spdy_headers, | 45 const SpdyHeaderBlock& spdy_headers, |
| 49 HttpRequestHeaders* http_headers); | 46 HttpRequestHeaders* http_headers); |
| 50 | 47 |
| 51 // Returns the URL associated with the |headers| by assembling the | 48 // Returns the URL associated with the |headers| by assembling the |
| 52 // scheme, host and path from the protocol specific keys. | 49 // scheme, host and path from the protocol specific keys. |
| 53 NET_EXPORT GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, | 50 NET_EXPORT GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers); |
| 54 SpdyMajorVersion protocol_version); | |
| 55 | 51 |
| 56 NET_EXPORT SpdyPriority ConvertRequestPriorityToSpdyPriority( | 52 NET_EXPORT SpdyPriority |
| 57 RequestPriority priority, | 53 ConvertRequestPriorityToSpdyPriority(RequestPriority priority); |
| 58 SpdyMajorVersion protocol_version); | |
| 59 | 54 |
| 60 NET_EXPORT RequestPriority ConvertSpdyPriorityToRequestPriority( | 55 NET_EXPORT RequestPriority |
| 61 SpdyPriority priority, | 56 ConvertSpdyPriorityToRequestPriority(SpdyPriority priority); |
| 62 SpdyMajorVersion protocol_version); | |
| 63 | 57 |
| 64 } // namespace net | 58 } // namespace net |
| 65 | 59 |
| 66 #endif // NET_SPDY_SPDY_HTTP_UTILS_H_ | 60 #endif // NET_SPDY_SPDY_HTTP_UTILS_H_ |
| OLD | NEW |