Open regbo opened 2 years ago
No way to manipulate this currently. I'm not even sure where we'd add that configuration option in our API.
No way to manipulate this currently. I'm not even sure where we'd add that configuration option in our API.
Perhaps just copy the value sent with the request initiating the connect?
That's the most obvious option. The drawback is that the request that creates the tunnel is arbitrary. If you have a connection that carries multiple requests, they may each use different user-agents. In general we're pretty allergic to data leakage like this.
For regular applications it's unlikely to matter but it's possible for OkHttp to be used inside a proxy or gateway where the requests are truly independent.
Right. What about a default user agent tied to the connection pool?
Or somehow allow intercepting on the Real connection?
Should User-Agent be configurable on OkHttpClient?
The hardcoded default seems like the issue here.
import okhttp3.internal.userAgent
@swankjesse would you object to allow setting the user agent on the client?
Forgive me if there is a solution for this, but I can't seem to find a way to change the User-Agent header on a connect request. It seems like it's hard coded to:
I can change it with reflection, but we have a situation where a server needs the user agent to match all requests moving forward. Is there a way to do it? Perhaps it could be acheived with this enhancement?
https://github.com/square/okhttp/issues/7297