You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Question
I am testing out an option to set a custom authority pseudo header with Jetty http2 client as described in separate question. I am attempting to set :authority to foo.bar, however the resulting pseudohader is :authority foo.bar:80 (the port is included).
The reason seems to be that HttpRequest used internally uses default port for scheme when not specified:
The only way I found to remove the port from the pseudoheader is to use a URI with unknown scheme such as baz://foo.bar which has no default port and thus port is not included in the pseudohader. This however causes the internal URI to be invalid, e.g. calling the methods of org.eclipse.jetty.client#Result such as result.getRequest().getURI() throws
java.lang.IllegalArgumentException: port out of range:-1
My question is: is there a legit way to omit the port from authority pseudoheader?
The text was updated successfully, but these errors were encountered:
@moscicky it's not entirely clear to me what you are trying to do.
Can you detail why you want to set a "custom" authority?
In your original question in #11923, it was shown how to send a request through the destination (which should be a special case), but probably your question was better answered by sending the request through a forward proxy.
You mention in this issue you are using the HTTP/2 client (implying the low-level HTTP2Client class), but then reference classes and methods of the high-level HttpClient.
If you're trying to send a request to foo.com through a forward proxy at localhost:5000, then you should configure HttpClient with an HttpProxy (the forward proxy).
If the server at localhost:5000isfoo.com but for some reason you don't have proper DNS resolution, then use the "send-through-destination" solution detailed in #11923.
Jetty Version
12
Jetty Environment
core
Java Version
17
Question
I am testing out an option to set a custom
authority
pseudo header with Jetty http2 client as described in separate question. I am attempting to set :authority tofoo.bar
, however the resulting pseudohader is:authority foo.bar:80
(the port is included).The reason seems to be that HttpRequest used internally uses default port for scheme when not specified:
Per HTTP2 RFC section 8.3.1 which points to URI RFC section 3.2 it seems that port should be optional for authority. Jetty client however sets it forcefully.
The only way I found to remove the port from the pseudoheader is to use a URI with unknown scheme such as
baz://foo.bar
which has no default port and thus port is not included in the pseudohader. This however causes the internal URI to be invalid, e.g. calling the methods oforg.eclipse.jetty.client#Result
such asresult.getRequest().getURI()
throwsMy question is: is there a legit way to omit the port from authority pseudoheader?
The text was updated successfully, but these errors were encountered: