Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / net / spdy / spdy_http_utils.h
bloba0db4752f63c5ff87ce149f759caec83597c7da8
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
3 // found in the LICENSE file.
5 #ifndef NET_SPDY_SPDY_HTTP_UTILS_H_
6 #define NET_SPDY_SPDY_HTTP_UTILS_H_
8 #include "net/base/net_export.h"
9 #include "net/base/request_priority.h"
10 #include "net/spdy/spdy_framer.h"
11 #include "net/spdy/spdy_header_block.h"
12 #include "net/spdy/spdy_protocol.h"
13 #include "url/gurl.h"
15 namespace net {
17 class HttpResponseInfo;
18 struct HttpRequestInfo;
19 class HttpRequestHeaders;
20 class HttpResponseHeaders;
22 // Convert a SpdyHeaderBlock into an HttpResponseInfo.
23 // |headers| input parameter with the SpdyHeaderBlock.
24 // |response| output parameter for the HttpResponseInfo.
25 // Returns true if successfully converted. False if the SpdyHeaderBlock is
26 // incomplete (e.g. missing 'status' or 'version').
27 NET_EXPORT bool SpdyHeadersToHttpResponse(
28 const SpdyHeaderBlock& headers,
29 SpdyMajorVersion protocol_version,
30 HttpResponseInfo* response);
32 // Create a SpdyHeaderBlock from HttpRequestInfo and HttpRequestHeaders.
33 NET_EXPORT void CreateSpdyHeadersFromHttpRequest(
34 const HttpRequestInfo& info,
35 const HttpRequestHeaders& request_headers,
36 SpdyMajorVersion protocol_version,
37 bool direct,
38 SpdyHeaderBlock* headers);
40 // Create a SpdyHeaderBlock from HttpResponseHeaders.
41 NET_EXPORT void CreateSpdyHeadersFromHttpResponse(
42 const HttpResponseHeaders& response_headers,
43 SpdyMajorVersion protocol_version,
44 SpdyHeaderBlock* headers);
46 // Returns the URL associated with the |headers| by assembling the
47 // scheme, host and path from the protocol specific keys.
48 NET_EXPORT GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers,
49 SpdyMajorVersion protocol_version,
50 bool pushed);
52 NET_EXPORT SpdyPriority ConvertRequestPriorityToSpdyPriority(
53 RequestPriority priority,
54 SpdyMajorVersion protocol_version);
56 NET_EXPORT RequestPriority ConvertSpdyPriorityToRequestPriority(
57 SpdyPriority priority,
58 SpdyMajorVersion protocol_version);
60 } // namespace net
62 #endif // NET_SPDY_SPDY_HTTP_UTILS_H_