curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

help: can not make http2 request

From: peng xu via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 17 Dec 2019 17:09:38 +0800 (CST)

I write an http request using curl like this:
```
        curl_global_init(CURL_GLOBAL_ALL);
CURL* easy_handle = curl_easy_init();
curl_easy_setopt(easy_handle, CURLOPT_URL, "https://nghttp2.org/");
curl_easy_setopt(easy_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
data_chunk_t chunk;
chunk.data = malloc(1); /* will be grown as needed by the realloc above */
chunk.size = 0; /* no data at this point */
curl_easy_setopt(easy_handle, CURLOPT_WRITEDATA, &chunk);
curl_easy_setopt(easy_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_easy_setopt(easy_handle, CURLOPT_SSL_VERIFYPEER, 0L);//ºöÂÔÖ¤Êé¼ì²é
curl_easy_setopt(easy_handle, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(easy_handle, CURLOPT_PIPEWAIT, 1L);

curl_easy_setopt(easy_handle, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(easy_handle, CURLOPT_DEBUGFUNCTION, my_trace);

CURLcode code;
code = curl_easy_perform(easy_handle);
long retcode = 0;
code = curl_easy_getinfo(easy_handle, CURLINFO_RESPONSE_CODE, &retcode);
```

but the debug call back showed me that the request header is
```
GET / HTTP/1.1
Host: nghttp2.org
Accept: */*
```

it's not an http2 request, why? What should I do?

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-12-17