curl / Mailing Lists / curl-users / 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.

Making HTTP2 requests

From: Luke Schlather via curl-users <curl-users_at_lists.haxx.se>
Date: Fri, 14 Jul 2023 16:09:04 -0700

I am attempting to test a local .NET Kestrel server which only accepts
http2 requests. However it seems that even when I specify --http2 it sends
http1 requests.

> curl --http2 -i http://localhost:5000/health
HTTP/1.1 400 Bad Request
Connection: close
Content-Type: text/plain
Content-Length: 56

An HTTP/1.x request was sent to an HTTP/2 only endpoint.

> curl --http2-prior-knowledge -i http://localhost:5000/health
HTTP/1.1 400 Bad Request
Connection: close
Content-Type: text/plain
Content-Length: 56

An HTTP/1.x request was sent to an HTTP/2 only endpoint.

This is the ASP.NET config I'm using (the default for Protocols is
HttpProtocols.Http1AndHttp2):

builder.WebHost
.ConfigureKestrel(serverOptions =>
{
    serverOptions.Listen(IPAddress.Any, 5000, listenOptions =>
    {
        listenOptions.Protocols = HttpProtocols.Http2;
    });

    serverOptions.Listen(IPAddress.Any, 5443, listenOptions =>
    {
        listenOptions.Protocols = HttpProtocols.Http2;
        listenOptions.UseHttps(certificate);
    });
})


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-07-15