+
Skip to content

Conversation

link2xt
Copy link
Collaborator

@link2xt link2xt commented Oct 13, 2025

This PR is for experiments in Desktop trying to route map requests over the core.

OpenStreetMap requires User-Agent to be set: https://operations.osmfoundation.org/policies/api/
Don't know if hyper sends anything at all when no User-Agent is set. OSM explicitly says that User-Agent should not be faked. We however don't want to send "chatmail" User-Agent in requests for images in HTML emails, so if this works we may need a switch to not fake the user agent for map requests and by default fake some browser User-Agent for privacy.

We may also just hardcode a domain name for which we send User-Agent, this will require no API changes at all.

@link2xt link2xt marked this pull request as draft October 13, 2025 14:52
@nicodh
Copy link
Contributor

nicodh commented Oct 14, 2025

I tested with the (rebased) branch of https://github.com/deltachat/deltachat-desktop/tree/maps-with-own-session and can confirm that this PR solves the problem of being blocked on openstreetmap.org. So it was obviously the missing User-Agent that caused the problem.

We may also just hardcode a domain name for which we send User-Agent, this will require no API changes at all.

At least for the tested map services in https://github.com/deltachat/maps/pull/6/files#diff-a333452cdd596c6103364e45efcd5bb8539164522389793fbc524cb74e27b625 I can confirm that only openstreetmap.org was blocked by the missing user agent

@link2xt link2xt force-pushed the link2xt/http-user-agent branch 2 times, most recently from 1a0b709 to 8e67682 Compare October 14, 2025 14:11
@link2xt link2xt changed the title feat: set User-Agent header on HTTP requests Meet OSM tile server policy requirements Oct 14, 2025
@link2xt link2xt marked this pull request as ready for review October 14, 2025 14:18
@link2xt link2xt force-pushed the link2xt/http-user-agent branch 2 times, most recently from 37d31e1 to 1744d0c Compare October 14, 2025 14:36
@link2xt link2xt requested review from Simon-Laux and nicodh October 14, 2025 15:19
@link2xt
Copy link
Collaborator Author

link2xt commented Oct 14, 2025

This should be good enough for now.

One problem is that read_url_blob does not do keep-alives, HTTP/2 or any sort of multiplexing. Each tile request is a new TLS connection. There is also no cancellation because of JSON-RPC, so if you start downloading a tile that you then move away from, it will still be downloaded, but at least cached.

Copy link
Contributor

@nicodh nicodh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this again with deltachat/deltachat-desktop#5455 and it works as expected

@link2xt link2xt force-pushed the link2xt/http-user-agent branch from 1744d0c to 99dc568 Compare October 14, 2025 18:08
@link2xt link2xt force-pushed the link2xt/http-user-agent branch from 99dc568 to 2b4195b Compare October 15, 2025 15:30
@link2xt link2xt enabled auto-merge (rebase) October 15, 2025 15:34
@link2xt link2xt disabled auto-merge October 15, 2025 16:45
@link2xt link2xt merged commit 1e0def8 into main Oct 15, 2025
53 of 54 checks passed
@link2xt link2xt deleted the link2xt/http-user-agent branch October 15, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载