Making HTTP2 requests

Luke Schlather via curl-users <[email protected]>
Newsgroups gmane.comp.web.curl.general
Message-ID <CAASssP8Q4210R6+20UnbHoXQO+WJ6DjDwS_NTWQ-CK04xja25A@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.