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 | 20 |
21 // Convert a SpdyHeaderBlock into an HttpResponseInfo. | 21 // Convert a SpdyHeaderBlock into an HttpResponseInfo. |
22 // |headers| input parameter with the SpdyHeaderBlock. | 22 // |headers| input parameter with the SpdyHeaderBlock. |
23 // |response| output parameter for the HttpResponseInfo. | 23 // |response| output parameter for the HttpResponseInfo. |
24 // Returns true if successfully converted. False if the SpdyHeaderBlock is | 24 // Returns true if successfully converted. False if the SpdyHeaderBlock is |
25 // incomplete (e.g. missing 'status' or 'version'). | 25 // incomplete (e.g. missing 'status' or 'version'). |
26 bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers, | 26 bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers, |
27 int protocol_version, | 27 SpdyMajorVersion protocol_version, |
28 HttpResponseInfo* response); | 28 HttpResponseInfo* response); |
29 | 29 |
30 // Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from | 30 // Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from |
31 // HttpRequestInfo and HttpRequestHeaders. | 31 // HttpRequestInfo and HttpRequestHeaders. |
32 void NET_EXPORT_PRIVATE CreateSpdyHeadersFromHttpRequest( | 32 void NET_EXPORT_PRIVATE CreateSpdyHeadersFromHttpRequest( |
33 const HttpRequestInfo& info, | 33 const HttpRequestInfo& info, |
34 const HttpRequestHeaders& request_headers, | 34 const HttpRequestHeaders& request_headers, |
35 SpdyHeaderBlock* headers, | 35 SpdyHeaderBlock* headers, |
36 int protocol_version, | 36 SpdyMajorVersion protocol_version, |
37 bool direct); | 37 bool direct); |
38 | 38 |
39 // Returns the URL associated with the |headers| by assembling the | 39 // Returns the URL associated with the |headers| by assembling the |
40 // scheme, host and path from the protocol specific keys. | 40 // scheme, host and path from the protocol specific keys. |
41 GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, | 41 GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, |
42 int protocol_version, | 42 SpdyMajorVersion protocol_version, |
43 bool pushed); | 43 bool pushed); |
44 | 44 |
45 // Returns true if the value of this header should be displayed. | 45 // Returns true if the value of this header should be displayed. |
46 NET_EXPORT_PRIVATE bool ShouldShowHttpHeaderValue( | 46 NET_EXPORT_PRIVATE bool ShouldShowHttpHeaderValue( |
47 const std::string& header_name); | 47 const std::string& header_name); |
48 | 48 |
49 NET_EXPORT_PRIVATE SpdyPriority ConvertRequestPriorityToSpdyPriority( | 49 NET_EXPORT_PRIVATE SpdyPriority ConvertRequestPriorityToSpdyPriority( |
50 RequestPriority priority, | 50 RequestPriority priority, |
51 int protocol_version); | 51 SpdyMajorVersion protocol_version); |
52 | 52 |
53 NET_EXPORT_PRIVATE RequestPriority ConvertSpdyPriorityToRequestPriority( | 53 NET_EXPORT_PRIVATE RequestPriority ConvertSpdyPriorityToRequestPriority( |
54 SpdyPriority priority, | 54 SpdyPriority priority, |
55 int protocol_version); | 55 SpdyMajorVersion protocol_version); |
56 | 56 |
57 } // namespace net | 57 } // namespace net |
58 | 58 |
59 #endif // NET_SPDY_SPDY_HTTP_UTILS_H_ | 59 #endif // NET_SPDY_SPDY_HTTP_UTILS_H_ |
OLD | NEW |