> 24. apr. 2024 kl. 15:34 skrev Andrea Aime <andrea.a...@geosolutionsgroup.com>:
> 
> On Wed, Apr 24, 2024 at 3:30 PM Roar Brænden <roar.brenden...@gmail.com 
> <mailto:roar.brenden...@gmail.com>> wrote:
> What I'm confused about is how the two classes should influence on what is 
> sent as Accept-header. Nothing in the code indicates something like that.
> 
> One is the built-in java client, the other the Apache one... I guess they 
> might have different defaults, if no accept-header is specified?
> Just thinking out loud
> 
> 

Hi,

You are absolutely right, Andrea, about that Accept-header being default for 
the Java built-in client.
Here I have provided extended logging of the HTTP traffic for the calls with 
SimpleHttpClient and MultithreadedHttpClient when they're used in combination 
with org.geotools.wms.WebMapServer:

[25.apr. 14:39:08] FINE <org.geotools.http.SimpleHttpClient get> URL is 
https://wms.gebco.net/mapserv?REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS
[25.apr. 14:39:08] FINE <org.geotools.http.SimpleHttpClient openConnection> 
Setting header User-Agent = GeoTools HTTPClient (32-SNAPSHOT)
[25.apr. 14:39:08] FINE <sun.net.www.protocol.http.HttpURLConnection 
writeRequests> sun.net.www.MessageHeader@589da3f35 pairs: 
{GET /mapserv?REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS HTTP/1.1: null}
{User-Agent: GeoTools HTTPClient (32-SNAPSHOT)}
{Host: wms.gebco.net}
{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}
{Connection: keep-alive}


[25.apr. 14:51:01] FINE <org.apache.http.headers onRequestSubmitted> 
http-outgoing-0 >> GET 
/mapserv?REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS HTTP/1.1
[25.apr. 14:51:01] FINE <org.apache.http.headers onRequestSubmitted> 
http-outgoing-0 >> Host: wms.gebco.net
[25.apr. 14:51:01] FINE <org.apache.http.headers onRequestSubmitted> 
http-outgoing-0 >> Connection: Keep-Alive
[25.apr. 14:51:01] FINE <org.apache.http.headers onRequestSubmitted> 
http-outgoing-0 >> User-Agent: GeoTools/32-SNAPSHOT (MultithreadedHttpClient)
[25.apr. 14:51:01] FINE <org.apache.http.headers onRequestSubmitted> 
http-outgoing-0 >> Accept-Encoding: gzip,deflate

Certainly that first Accept header seems a little out-dated, but as Ian 
mentioned it doesn't explain why we will get a 403 status code.

Regards Roar
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to