fix(android): handle lowercase range header#8368
fix(android): handle lowercase range header#8368OS-pedrogustavobilro merged 3 commits intoionic-team:mainfrom
Conversation
|
Hey @bwees, thanks for the PR. I'm not getting any issues with the current code in Were you getting an issue with a particular request or situation? And if so can you share a reproduction app for us to check? |
|
I am getting this issue when working with MapLibre GL JS and using PMTiles as a source. An example app is here: https://github.com/bwees/range-request-capacitor-repro If you look at the PMTiles responses received by the client (viewed from Chrome Devtools debugging the running android app), you will see that the proper range response headers are only sent once these changes are added. On Note: Even with this fix, the map will not load as HTTP Range requests are quite broken on Capacitor. They do not currently follow spec which causes issues with the PMTiles decoder. I narrowed down the issue late last night, #8371 . |
OS-pedrogustavobilro
left a comment
There was a problem hiding this comment.
@bwees I wasn't able to check with your reproduction app, but I went back to a test app I had and was able to reproduce this issue now (without this fix was getting 200, now getting 206).
I think I wasn't able to reproduce a few days ago when I was testing with an Android 12 device, but tested now with Android 16 and getting the error. Strange because they have the same System WebView version, but maybe it's something in the OS that made the behavior different. Anyway, this fix does it.
I suggest you to re-look at the reproduction app, especially to test the other issue you shared. It fails when running npm run build, missing some UI files I think. I tried to add some, the map loaded but still wasn't getting range requests, so maybe it needs specific configuration.
|
Hey sorry about that! It appears I must have deleted the wrong map components while stripping my app to a minimum example. I have updated it and pushed to the branch so #8371 should be easy to reproduce now. Thanks for your help! |
This fixes issues with HTTP range requests when the range header is lowercase on Android.
iOS handles the case insensitivity via
urlSchemeTask.request.value(forHTTPHeaderField: "Range"). However on Android, headers are placed in a case sensitive Map that requires manual handling.