Chromium Code Reviews| 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/http/http_response_headers.h" | |
| 10 #include "net/spdy/spdy_framer.h" | 11 #include "net/spdy/spdy_framer.h" |
| 11 #include "net/spdy/spdy_header_block.h" | 12 #include "net/spdy/spdy_header_block.h" |
| 12 #include "net/spdy/spdy_protocol.h" | 13 #include "net/spdy/spdy_protocol.h" |
| 13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 | 17 |
| 17 class HttpResponseInfo; | 18 class HttpResponseInfo; |
| 18 struct HttpRequestInfo; | 19 struct HttpRequestInfo; |
| 19 class HttpRequestHeaders; | 20 class HttpRequestHeaders; |
| 20 | 21 |
| 21 // Convert a SpdyHeaderBlock into an HttpResponseInfo. | 22 // Convert a SpdyHeaderBlock into an HttpResponseInfo. |
| 22 // |headers| input parameter with the SpdyHeaderBlock. | 23 // |headers| input parameter with the SpdyHeaderBlock. |
| 23 // |response| output parameter for the HttpResponseInfo. | 24 // |response| output parameter for the HttpResponseInfo. |
| 24 // Returns true if successfully converted. False if the SpdyHeaderBlock is | 25 // Returns true if successfully converted. False if the SpdyHeaderBlock is |
| 25 // incomplete (e.g. missing 'status' or 'version'). | 26 // incomplete (e.g. missing 'status' or 'version'). |
| 26 bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers, | 27 bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers, |
| 27 SpdyMajorVersion protocol_version, | 28 SpdyMajorVersion protocol_version, |
| 28 HttpResponseInfo* response); | 29 HttpResponseInfo* response); |
| 29 | 30 |
| 30 // Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from | 31 // Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from |
|
Ryan Hamilton
2014/06/19 00:15:44
I suspect this is actually for a SYN_REPLY since t
dmz
2014/06/19 21:17:02
Ah, yes.
| |
| 32 // HttpResponseHeaders. | |
| 33 void NET_EXPORT_PRIVATE CreateSpdyHeadersFromHttpResponse( | |
| 34 scoped_refptr<HttpResponseHeaders> response_headers, | |
| 35 SpdyHeaderBlock* headers, | |
| 36 SpdyMajorVersion protocol_version); | |
|
Ryan Hamilton
2014/06/19 00:15:44
In-params should come before out-params.
dmz
2014/06/19 21:17:03
I was imitating CreateSpdyHeadersFromHttpRequest.
Ryan Hamilton
2014/06/20 00:24:09
Doh! yeah, that'd be great, thanks.
dmziegler
2014/06/20 01:16:40
Done.
| |
| 37 | |
| 38 // Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from | |
|
Ryan Hamilton
2014/06/19 00:15:44
SYN_STREAM is *so* SPDY/3. All the cool kids used
dmz
2014/06/19 21:17:02
Haha, done.
| |
| 31 // HttpRequestInfo and HttpRequestHeaders. | 39 // HttpRequestInfo and HttpRequestHeaders. |
| 32 void NET_EXPORT_PRIVATE CreateSpdyHeadersFromHttpRequest( | 40 void NET_EXPORT_PRIVATE CreateSpdyHeadersFromHttpRequest( |
| 33 const HttpRequestInfo& info, | 41 const HttpRequestInfo& info, |
| 34 const HttpRequestHeaders& request_headers, | 42 const HttpRequestHeaders& request_headers, |
| 35 SpdyHeaderBlock* headers, | 43 SpdyHeaderBlock* headers, |
| 36 SpdyMajorVersion protocol_version, | 44 SpdyMajorVersion protocol_version, |
| 37 bool direct); | 45 bool direct); |
| 38 | 46 |
| 39 // Returns the URL associated with the |headers| by assembling the | 47 // Returns the URL associated with the |headers| by assembling the |
| 40 // scheme, host and path from the protocol specific keys. | 48 // scheme, host and path from the protocol specific keys. |
| 41 NET_EXPORT_PRIVATE GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, | 49 NET_EXPORT_PRIVATE GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, |
| 42 SpdyMajorVersion protocol_version, | 50 SpdyMajorVersion protocol_version, |
| 43 bool pushed); | 51 bool pushed); |
| 44 | 52 |
| 45 NET_EXPORT_PRIVATE SpdyPriority ConvertRequestPriorityToSpdyPriority( | 53 NET_EXPORT_PRIVATE SpdyPriority ConvertRequestPriorityToSpdyPriority( |
| 46 RequestPriority priority, | 54 RequestPriority priority, |
| 47 SpdyMajorVersion protocol_version); | 55 SpdyMajorVersion protocol_version); |
| 48 | 56 |
| 49 NET_EXPORT_PRIVATE RequestPriority ConvertSpdyPriorityToRequestPriority( | 57 NET_EXPORT_PRIVATE RequestPriority ConvertSpdyPriorityToRequestPriority( |
| 50 SpdyPriority priority, | 58 SpdyPriority priority, |
| 51 SpdyMajorVersion protocol_version); | 59 SpdyMajorVersion protocol_version); |
| 52 | 60 |
| 53 } // namespace net | 61 } // namespace net |
| 54 | 62 |
| 55 #endif // NET_SPDY_SPDY_HTTP_UTILS_H_ | 63 #endif // NET_SPDY_SPDY_HTTP_UTILS_H_ |
| OLD | NEW |