Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / net / spdy / spdy_http_utils.h
bloba5c907b2afac71587a5c1e602664ae7a04c387a7
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 bool SpdyHeadersToHttpResponse(const SpdyHeaderBlock& headers,
28 SpdyMajorVersion protocol_version,
29 HttpResponseInfo* response);
31 // Create a SpdyHeaderBlock from HttpRequestInfo and HttpRequestHeaders.
32 NET_EXPORT_PRIVATE void CreateSpdyHeadersFromHttpRequest(
33 const HttpRequestInfo& info,
34 const HttpRequestHeaders& request_headers,
35 SpdyMajorVersion protocol_version,
36 bool direct,
37 SpdyHeaderBlock* headers);
39 // Create a SpdyHeaderBlock from HttpResponseHeaders.
40 NET_EXPORT_PRIVATE void CreateSpdyHeadersFromHttpResponse(
41 const HttpResponseHeaders& response_headers,
42 SpdyMajorVersion protocol_version,
43 SpdyHeaderBlock* headers);
45 // Returns the URL associated with the |headers| by assembling the
46 // scheme, host and path from the protocol specific keys.
47 NET_EXPORT_PRIVATE GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers,
48 SpdyMajorVersion protocol_version,
49 bool pushed);
51 NET_EXPORT_PRIVATE SpdyPriority ConvertRequestPriorityToSpdyPriority(
52 RequestPriority priority,
53 SpdyMajorVersion protocol_version);
55 NET_EXPORT_PRIVATE RequestPriority ConvertSpdyPriorityToRequestPriority(
56 SpdyPriority priority,
57 SpdyMajorVersion protocol_version);
59 } // namespace net
61 #endif // NET_SPDY_SPDY_HTTP_UTILS_H_