Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS - Allow changing of User-Agent #2293

Merged
merged 3 commits into from
Apr 19, 2024
Merged

iOS - Allow changing of User-Agent #2293

merged 3 commits into from
Apr 19, 2024

Conversation

hactar
Copy link
Collaborator

@hactar hactar commented Apr 18, 2024

MapLibre allows setting additional headers to be sent in network requests via MLNNativeNetworkManager.sharedManager.sessionConfiguration. Here a user could set up a User-Agent to be sent during requests. Unfortunately, in http_file_source.mm, we set a User-Agent without checking if a user might have set one too.

This prevents users from being able to set a User-Agent at all. In my use case for example, I have to talk to a service which expects a certain User-Agent, and currently I have no way to get MapLibre to use the required User-Agent.

This PR resolves the issue by checking if a custom User-Agent has been set in MLNNativeNetworkManager.sharedManager.sessionConfiguration first - if one is set, then that one is used, else MapLibre defaults to its own.

@louwers louwers added the iOS label Apr 18, 2024
@louwers louwers self-requested a review April 18, 2024 18:13
Copy link
Collaborator

@louwers louwers left a comment

Choose a reason for hiding this comment

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

Sounds reasonable.

If you want a release for this right away feel free to update platform/ios/VERSION and platform/ios/CHANGELOG.md (6.4.0).

Copy link

github-actions bot commented Apr 18, 2024

Bloaty Results (iOS) 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +56  [ = ]       0    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-2293-compared-to-main.txt

@hactar
Copy link
Collaborator Author

hactar commented Apr 18, 2024

@louwers Changelog and version updated. Thanks.

@louwers louwers enabled auto-merge (squash) April 19, 2024 11:49
@louwers louwers merged commit 7f2fbb6 into maplibre:main Apr 19, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants