Hi, On Fri, Sep 22, 2017 at 6:40 PM, Steven Schlansker <[email protected]> wrote: > Hi jetty-users, > > I am writing a HTTP proxy that calls remote services by jetty-client. > I do not want the proxy to modify user agent headers, it should be whatever > the incoming request says (we do UA-detection on the far side). > > HttpRequest does something reasonable: > > HttpField userAgentField = client.getUserAgentField(); > if (userAgentField != null) > headers.put(userAgentField); > > but HttpClient says no: > > public void setUserAgentField(HttpField agent) > { > if (agent.getHeader() != HttpHeader.USER_AGENT) > throw new IllegalArgumentException(); > this.agentField = agent; > } > > throws NPE. > > What's the right way to have the client not muck with UA? Should we > relax the setter to allow setUserAgentField(null)? I can subclass > but that's a little obnoxious just for this...
I don't understand. The user agent you set on HttpClient would be the default one to use. Why are you calling httpClient.setUserAgentField(null) ? -- Simone Bordet ---- http://cometd.org http://webtide.com Developer advice, training, services and support from the Jetty & CometD experts. _______________________________________________ jetty-users mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/jetty-users
