You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Gary Gregory <ga...@gmail.com> on 2017/02/15 21:19:24 UTC

User-Agent

Hi All:

Right now our user agent logs as:

User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_80)

I think this would be more helpful when debugging:

User-Agent: Apache-HttpClient/4.5.2 Apache-HttpCore/4.4.5 Java/1.7.0_80

Thoughts?

Gary

-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: User-Agent

Posted by "info@flyingfischer.ch" <in...@flyingfischer.ch>.
Am 16.02.2017 um 16:02 schrieb Oleg Kalnichevski:
> On Wed, 2017-02-15 at 13:19 -0800, Gary Gregory wrote:
>> Hi All:
>>
>> Right now our user agent logs as:
>>
>> User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_80)
>>
>> I think this would be more helpful when debugging:
>>
>> User-Agent: Apache-HttpClient/4.5.2 Apache-HttpCore/4.4.5
>> Java/1.7.0_80
>>
>> Thoughts?
>>
>> Gary
>>
> 
> 
> Gary

I would not like to see these version details being transmitted by
default to any webserver out there.

Markus


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


Re: User-Agent

Posted by Jon Moore <jo...@apache.org>.
As an observation, since we use Maven, if we know the HttpClient (or
AsyncClient) version, that determines the other dependency versions, right?
While it's not as convenient to go look them up when debugging, I'm not
sure adding essentially redundant information to the header makes sense,
especially for production traffic.

The other change you illustrated, Gary, was putting the Java version as a
top-level "product" instead of in a comment. I could definitely see that
would be easier for folks to parse, and I do think the Java version is
useful to put in there, since it *can* vary separately from the HttpClient
version. Is that one of the particular details you were looking for?

Jon

On Thu, Feb 16, 2017 at 10:02 AM, Oleg Kalnichevski <ol...@apache.org>
wrote:

> On Wed, 2017-02-15 at 13:19 -0800, Gary Gregory wrote:
> > Hi All:
> >
> > Right now our user agent logs as:
> >
> > User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_80)
> >
> > I think this would be more helpful when debugging:
> >
> > User-Agent: Apache-HttpClient/4.5.2 Apache-HttpCore/4.4.5
> > Java/1.7.0_80
> >
> > Thoughts?
> >
> > Gary
> >
>
>
> Gary
>
>
> What would be the benefit of doing so?
>
> For instance for HttpAsyncClient we would have include HttpCore,
> HttpCore NIO, HttpClient and HttpAsyncClient versions. It seems to make
> more complex then necessary.
>
> Oleg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

Re: User-Agent

Posted by Gary Gregory <ga...@gmail.com>.
On Sat, Feb 18, 2017 at 1:56 AM, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Fri, 2017-02-17 at 09:38 -0800, Gary Gregory wrote:
> > On Fri, Feb 17, 2017 at 2:43 AM, Oleg Kalnichevski <ol...@apache.org>
> > wrote:
> >
> ...
>
> > > Gary
> > >
> > > It should be quite easy to plug in a custom protocol interceptor
> > > that
> > > generates a user agent header with additional runtime details.
> > > However,
> > > I am not sure it would really make sense to change the format used
> > > by
> > > default. I hope you agree.
> > >
> >
> > Sounds OK. Any hints as to where to allow this to be plugged in
> > exactly?
> >
> > Gary
> >
>
> Something like that should do the job, should not it?
>
> ---
> VersionInfo clientVersion = VersionInfo.loadVersionInfo("org.apache.http.client",
> Testing.class.getClassLoader());
> VersionInfo coreVersion = VersionInfo.loadVersionInfo("org.apache.http",
> Testing.class.getClassLoader());
> String javaVersion = System.getProperty("java.version");
>
> String agentInfo = String.format("HttpClient/%s HttpCore/%s Java/%s)",
>         clientVersion.getRelease(),
>         coreVersion.getRelease(),
>         javaVersion);
>
> CloseableHttpClient client = HttpClientBuilder.create()
>         .setUserAgent(agentInfo)
>         .build();
> ---
>

Perfect! Thank you Oleg. In my version I also added the "java.vendor"
property so I can see:

2017-02-20 15:10:36,390 DEBUG [main][org.apache.http.headers]
http-outgoing-0 >> User-Agent: HttpClient/4.5.3 HttpCore/4.4.6 Java/Oracle
Corporation 1.7.0_80)

Thank you!

Gary


> Oleg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: User-Agent

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2017-02-17 at 09:38 -0800, Gary Gregory wrote:
> On Fri, Feb 17, 2017 at 2:43 AM, Oleg Kalnichevski <ol...@apache.org>
> wrote:
> 
...

> > Gary
> > 
> > It should be quite easy to plug in a custom protocol interceptor
> > that
> > generates a user agent header with additional runtime details.
> > However,
> > I am not sure it would really make sense to change the format used
> > by
> > default. I hope you agree.
> > 
> 
> Sounds OK. Any hints as to where to allow this to be plugged in
> exactly?
> 
> Gary
> 

Something like that should do the job, should not it?

---
VersionInfo clientVersion = VersionInfo.loadVersionInfo("org.apache.http.client", Testing.class.getClassLoader());
VersionInfo coreVersion = VersionInfo.loadVersionInfo("org.apache.http", Testing.class.getClassLoader());
String javaVersion = System.getProperty("java.version");

String agentInfo = String.format("HttpClient/%s HttpCore/%s Java/%s)",
        clientVersion.getRelease(),
        coreVersion.getRelease(),
        javaVersion);

CloseableHttpClient client = HttpClientBuilder.create()
        .setUserAgent(agentInfo)
        .build();
---

Oleg

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


Re: User-Agent

Posted by Gary Gregory <ga...@gmail.com>.
On Fri, Feb 17, 2017 at 2:43 AM, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Thu, 2017-02-16 at 09:11 -0800, Gary Gregory wrote:
> > On Feb 16, 2017 7:02 AM, "Oleg Kalnichevski" <ol...@apache.org>
> > wrote:
> >
> > On Wed, 2017-02-15 at 13:19 -0800, Gary Gregory wrote:
> > > Hi All:
> > >
> > > Right now our user agent logs as:
> > >
> > > User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_80)
> > >
> > > I think this would be more helpful when debugging:
> > >
> > > User-Agent: Apache-HttpClient/4.5.2 Apache-HttpCore/4.4.5
> > > Java/1.7.0_80
> > >
> > > Thoughts?
> > >
> > > Gary
> > >
> >
> >
> > Gary
> >
> >
> > What would be the benefit of doing so?
> >
> >
> > At work we a ship a large server (and client libs) which is
> > configurable
> > out the wazoo. When we get debug logs from customers, and we need to
> > reproduce issues, it is always best to get the most accurate picture
> > of
> > what is going on so we can duplicate.
> >
>
> Gary
>
> It should be quite easy to plug in a custom protocol interceptor that
> generates a user agent header with additional runtime details. However,
> I am not sure it would really make sense to change the format used by
> default. I hope you agree.
>

Sounds OK. Any hints as to where to allow this to be plugged in exactly?

Gary

>
> Oleg
>
>
> >
> > For instance for HttpAsyncClient we would have include HttpCore,
> > HttpCore NIO, HttpClient and HttpAsyncClient versions. It seems to
> > make
> > more complex then necessary.
> >
> >
> > It is still a lot less complex than what a web browser submits ;-)
> >
> > I'm only looking to make debugging easier for myself without having
> > to do a
> > screenshare to pick apart a customers config.
> >
> > Gary
> >
> >
> > Oleg
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: User-Agent

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2017-02-16 at 09:11 -0800, Gary Gregory wrote:
> On Feb 16, 2017 7:02 AM, "Oleg Kalnichevski" <ol...@apache.org>
> wrote:
> 
> On Wed, 2017-02-15 at 13:19 -0800, Gary Gregory wrote:
> > Hi All:
> > 
> > Right now our user agent logs as:
> > 
> > User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_80)
> > 
> > I think this would be more helpful when debugging:
> > 
> > User-Agent: Apache-HttpClient/4.5.2 Apache-HttpCore/4.4.5
> > Java/1.7.0_80
> > 
> > Thoughts?
> > 
> > Gary
> > 
> 
> 
> Gary
> 
> 
> What would be the benefit of doing so?
> 
> 
> At work we a ship a large server (and client libs) which is
> configurable
> out the wazoo. When we get debug logs from customers, and we need to
> reproduce issues, it is always best to get the most accurate picture
> of
> what is going on so we can duplicate.
> 

Gary

It should be quite easy to plug in a custom protocol interceptor that
generates a user agent header with additional runtime details. However,
I am not sure it would really make sense to change the format used by
default. I hope you agree.

Oleg  


> 
> For instance for HttpAsyncClient we would have include HttpCore,
> HttpCore NIO, HttpClient and HttpAsyncClient versions. It seems to
> make
> more complex then necessary.
> 
> 
> It is still a lot less complex than what a web browser submits ;-)
> 
> I'm only looking to make debugging easier for myself without having
> to do a
> screenshare to pick apart a customers config.
> 
> Gary
> 
> 
> Oleg
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org

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


Re: User-Agent

Posted by Gary Gregory <ga...@gmail.com>.
On Feb 16, 2017 7:02 AM, "Oleg Kalnichevski" <ol...@apache.org> wrote:

On Wed, 2017-02-15 at 13:19 -0800, Gary Gregory wrote:
> Hi All:
>
> Right now our user agent logs as:
>
> User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_80)
>
> I think this would be more helpful when debugging:
>
> User-Agent: Apache-HttpClient/4.5.2 Apache-HttpCore/4.4.5
> Java/1.7.0_80
>
> Thoughts?
>
> Gary
>


Gary


What would be the benefit of doing so?


At work we a ship a large server (and client libs) which is configurable
out the wazoo. When we get debug logs from customers, and we need to
reproduce issues, it is always best to get the most accurate picture of
what is going on so we can duplicate.


For instance for HttpAsyncClient we would have include HttpCore,
HttpCore NIO, HttpClient and HttpAsyncClient versions. It seems to make
more complex then necessary.


It is still a lot less complex than what a web browser submits ;-)

I'm only looking to make debugging easier for myself without having to do a
screenshare to pick apart a customers config.

Gary


Oleg

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

Re: User-Agent

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2017-02-15 at 13:19 -0800, Gary Gregory wrote:
> Hi All:
> 
> Right now our user agent logs as:
> 
> User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_80)
> 
> I think this would be more helpful when debugging:
> 
> User-Agent: Apache-HttpClient/4.5.2 Apache-HttpCore/4.4.5
> Java/1.7.0_80
> 
> Thoughts?
> 
> Gary
> 


Gary


What would be the benefit of doing so?� 

For instance for HttpAsyncClient we would have include HttpCore,
HttpCore NIO, HttpClient and�HttpAsyncClient versions. It seems to make
more complex then necessary.  

Oleg

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


Re: User-Agent

Posted by Gary Gregory <ga...@gmail.com>.
On Wed, Feb 15, 2017 at 1:31 PM, Philippe Mouawad <
philippe.mouawad@gmail.com> wrote:

> Hi,
> Add Httpmime also ?
>

I guess, whatever HC jars happen to be in use.

Gary


> Regards
>
> On Wed, Feb 15, 2017 at 10:19 PM, Gary Gregory <ga...@gmail.com>
> wrote:
>
> > Hi All:
> >
> > Right now our user agent logs as:
> >
> > User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_80)
> >
> > I think this would be more helpful when debugging:
> >
> > User-Agent: Apache-HttpClient/4.5.2 Apache-HttpCore/4.4.5 Java/1.7.0_80
> >
> > Thoughts?
> >
> > Gary
> >
> > --
> > E-Mail: garydgregory@gmail.com | ggregory@apache.org
> > Java Persistence with Hibernate, Second Edition
> > <https://www.amazon.com/gp/product/1617290459/ref=as_li_
> > tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&
> > linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
> >
> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
> > 1617290459>
> > JUnit in Action, Second Edition
> > <https://www.amazon.com/gp/product/1935182021/ref=as_li_
> > tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&
> > linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de4
> 18%22
> > >
> >
> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
> > 1935182021>
> > Spring Batch in Action
> > <https://www.amazon.com/gp/product/1935182951/ref=as_li_
> > tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&
> > linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%
> > 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
> > 1935182951>
> > Blog: http://garygregory.wordpress.com
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
> >
>
>
>
> --
> Cordialement.
> Philippe Mouawad.
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
JUnit in Action, Second Edition
<https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>

<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
Spring Batch in Action
<https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
<http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: User-Agent

Posted by Philippe Mouawad <ph...@gmail.com>.
Hi,
Add Httpmime also ?

Regards

On Wed, Feb 15, 2017 at 10:19 PM, Gary Gregory <ga...@gmail.com>
wrote:

> Hi All:
>
> Right now our user agent logs as:
>
> User-Agent: Apache-HttpClient/4.5.2 (Java/1.7.0_80)
>
> I think this would be more helpful when debugging:
>
> User-Agent: Apache-HttpClient/4.5.2 Apache-HttpCore/4.4.5 Java/1.7.0_80
>
> Thoughts?
>
> Gary
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <https://www.amazon.com/gp/product/1617290459/ref=as_li_
> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&
> linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
>
> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
> 1617290459>
> JUnit in Action, Second Edition
> <https://www.amazon.com/gp/product/1935182021/ref=as_li_
> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&
> linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22
> >
>
> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
> 1935182021>
> Spring Batch in Action
> <https://www.amazon.com/gp/product/1935182951/ref=as_li_
> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&
> linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%
> 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
> 1935182951>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
Cordialement.
Philippe Mouawad.