Never mind, the problem was that I was not specifying a Host on my request. 
This works:

curl -D - -H 'Host: localhost' --http2-prior-knowledge 
'http://[0:0:0:0:0:0:0:0]:8080/foo/bar'

> On Mar 22, 2023, at 12:27 PM, Shaw, Ryan <ryans...@unc.edu> wrote:
> 
> Hello,
> 
> I am trying to run the H2FileServerExample [1] and test it out using curl. 
> However, I only get empty responses back.
> 
> Starting the server, I see in the log:
> 
> Listening on /[0:0:0:0:0:0:0:0]:8080
> 
> Then I use curl to send a request:
> 
> curl --http2-prior-knowledge 'http://[0:0:0:0:0:0:0:0]:8080/foo/bar’
> 
> This results in:
> 
> curl: (52) Empty reply from server
> 
> And in the server log, I see:
> 
> /[0:0:0:0:0:0:0:1]:52142 (1) << :method: GET
> /[0:0:0:0:0:0:0:1]:52142 (1) << :path: /foo/bar
> /[0:0:0:0:0:0:0:1]:52142 (1) << :scheme: http
> /[0:0:0:0:0:0:0:1]:52142 (1) << :authority: [::]:8080
> /[0:0:0:0:0:0:0:1]:52142 (1) << user-agent: curl/8.0.1
> /[0:0:0:0:0:0:0:1]:52142 (1) << accept: */*
> /[0:0:0:0:0:0:0:1]:52142 (1) >> :status: 421
> /[0:0:0:0:0:0:0:1]:52142 (1) >> date: Wed, 22 Mar 2023 16:11:56 GMT
> /[0:0:0:0:0:0:0:1]:52142 (1) >> server: Apache-HttpCore/5.2.1 (Java/17.0.5)
> /[0:0:0:0:0:0:0:1]:52142 (1) >> content-type: text/plain; charset=ISO-8859-1
> 
> (Note that curl doesn’t show the 421 status code; it just gets an empty 
> reply.)
> 
> What do I need to do to run this example?
> 
> Thanks,
> Ryan
> 
> [1] 
> https://github.com/apache/httpcomponents-core/blob/master/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/H2FileServerExample.java




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to