Modify

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#21906 closed defect (fixed)

[PATCH] Properly use user set User-Agent header

Reported by: taylor.smock Owned by: Don-vip
Priority: normal Milestone:
Component: Plugin http2 Version:
Keywords: Cc:

Description

The attached patch ensures that only one user agent string is added to the request. This brings the HTTP2 client into feature parity with our HTTP1 client. It also implements Destroyable in the plugin main class.

I am, however, a bit ambivalent about the patch. A user initially reported this on the OSM World Discord server w.r.t. to non-default imagery. They did claim to have received permissions to use that imagery in OSM, but there were some additional restrictions w.r.t. nationality of the person using the imagery to do the mapping.

Options:

  • Apply the patch as is
  • Modify Http1Client so that users cannot override the User-Agent string

Either way, our handling of user-set User-Agent strings should be consistent.

Attachments (1)

21906.patch (3.4 KB ) - added by taylor.smock 2 years ago.
Only add User-Agent to the request headers once, preferring the user set User-Agent string, if any. Also implement Destroyable in the Plugin main class.

Download all attachments as: .zip

Change History (5)

by taylor.smock, 2 years ago

Attachment: 21906.patch added

Only add User-Agent to the request headers once, preferring the user set User-Agent string, if any. Also implement Destroyable in the Plugin main class.

comment:1 by stoecker, 2 years ago

Overriding user agent is sometimes a necessity. It shouldn't be easy for the average user, but it should be possible.

comment:2 by taylor.smock, 2 years ago

I kind of figured that would be the case. I'll go ahead and apply the patch and do a release once I get in to the office.

comment:3 by taylor.smock, 2 years ago

Resolution: fixed
Status: newclosed

In 35921/osm:

fix #21906: Properly use user set User-Agent header

This also enables the http2 plugin to be disabled without JOSM restart -- we
just set the HttpClient factory back to Http1Client::new. Ideally, users would
still restart JOSM to ensure that all classes are unloaded, but this should
make it easier to debug if an issue is due to http2 or something else.

comment:4 by taylor.smock, 2 years ago

In 35922/osm:

http2 (dist): see #21906: Properly use user set User-Agent header

This also enables the http2 plugin to be disabled without JOSM restart -- we
just set the HttpClient factory back to Http1Client::new. Ideally, users would
still restart JOSM to ensure that all classes are unloaded, but this should
make it easier to debug if an issue is due to http2 or something else.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Don-vip.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.