Home | History | Annotate | Download | only in spdy
      1 // Copyright (c) 2010 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.
      4 
      5 #ifndef NET_SPDY_SPDY_HTTP_UTILS_H_
      6 #define NET_SPDY_SPDY_HTTP_UTILS_H_
      7 #pragma once
      8 
      9 #include "net/base/request_priority.h"
     10 #include "net/spdy/spdy_framer.h"
     11 
     12 namespace net {
     13 
     14 class HttpResponseInfo;
     15 struct HttpRequestInfo;
     16 class HttpRequestHeaders;
     17 
     18 // Convert a SpdyHeaderBlock into an HttpResponseInfo.
     19 // |headers| input parameter with the SpdyHeaderBlock.
     20 // |info| output parameter for the HttpResponseInfo.
     21 // Returns true if successfully converted.  False if the SpdyHeaderBlock is
     22 // incomplete (e.g. missing 'status' or 'version').
     23 bool SpdyHeadersToHttpResponse(const spdy::SpdyHeaderBlock& headers,
     24                                HttpResponseInfo* response);
     25 
     26 // Create a SpdyHeaderBlock for a Spdy SYN_STREAM Frame from
     27 // HttpRequestInfo and HttpRequestHeaders.
     28 void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
     29                                       const HttpRequestHeaders& request_headers,
     30                                       spdy::SpdyHeaderBlock* headers,
     31                                       bool direct);
     32 
     33 int ConvertRequestPriorityToSpdyPriority(RequestPriority priority);
     34 
     35 }  // namespace net
     36 
     37 #endif  // NET_SPDY_SPDY_HTTP_UTILS_H_
     38