1 /***************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at http://curl.haxx.se/docs/copyright.html.
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ***************************************************************************/
23 #include "curl_setup.h"
26 #define _MPRINTF_REPLACE
27 #include <curl/mprintf.h>
29 #include <nghttp2/nghttp2.h>
35 * Store nghttp2 version info in this buffer, Prefix with a space. Return
36 * total length written.
38 int Curl_http2_ver(char *p, size_t len)
40 nghttp2_info *h2 = nghttp2_version(0);
41 return snprintf(p, len, " nghttp2/%s", h2->version_str);
45 * Append headers to ask for a HTTP1.1 to HTTP2 upgrade.
47 CURLcode Curl_http2_request(Curl_send_buffer *req,
48 struct connectdata *conn)
50 const char *base64="AABBCC"; /* a fake string to start with */
53 "Connection: Upgrade, HTTP2-Settings\r\n"
54 "Upgrade: HTTP/2.0\r\n"
55 "HTTP2-Settings: %s\r\n",