Open tripflex opened 6 years ago
Seems to also be an issue related to GZIP files .. when trying to access the gzip version of file on device it does not load, non-gzip version does
Maybe, this is the solution: https://community.arubanetworks.com/t5/Wireless-Access/Samsung-Captive-Portal-Detection/m-p/405934#M78972
The Samsung expect a 204 response, with no content against http://connectivitycheck.gstatic.com/generate_204, but the portal send an 302 redirect:
* Trying 192.168.4.1...
* TCP_NODELAY set
* Connected to connectivitycheck.gstatic.com (192.168.4.1) port 80 (#0)
> GET /generate_204 HTTP/1.1
> Host: connectivitycheck.gstatic.com
> User-Agent: curl/7.63.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Server: Mongoose/6.13
< Location: http://connectivitycheck.gstatic.com
< Content-Type: text/html
< Content-Length: 67
< Cache-Control: no-cache
@marciopamplona AHHHH okay awesome! Thanks for this info! So yeah everything else works perfectly fine with 302 redirect, EXCEPT for Samsung devices ... ugh ... which expect a valid 204 response but just not an empty response.
Need to think about this a bit and test to see best way to handle this, and see if just returning data in 204 works with other devices as well, or if we just have to come up with some compatibility handling for samsung devices on the 204, going to test this out here in a bit and see what I can come up with.
Thanks again for these details!
https://en.wikipedia.org/wiki/Captive_portal
Even wikipedia on this says
If the device receives a HTTP 204 status code, it assumes it has unlimited internet access. Captive portal prompts are displayed when you are able to manipulate this first HTTP message to return a HTTP status code of 302 (redirect) to the captive portal of your choice.
Which is weird because that means that this is something samsung specific ... ugh
I'm testing this myself. This information below make more sense:
@marciopamplona yeah that gives a bit more information. So this library already handles all the DNS related stuff mentioned in that article, need to test if other devices still prompt the captive portal splash page when we return the HTML in the generate_204
will try and do it this week
@marciopamplona please try out the new library, I think this should be fixed with my new handling .. i don't have a samsung device to test with .. but it should: https://github.com/tripflex/captive-portal-wifi-stack
IS a combination of all of these libs: https://github.com/tripflex/captive-portal https://github.com/tripflex/captive-portal-wifi-setup https://github.com/tripflex/captive-portal-wifi-rpc https://github.com/tripflex/captive-portal-wifi-web
Testing on Samsung Galaxy S7, does not show "Login to Network" prompt, even though 302 redirect is sent when querying
/generate_204
...On device it shows "Testing internet connection...." and then when editing wifi network shows "Manage router" but never shows login prompt.
Wondering if these devices expect a different kind of response to the
/generate_204
, or maybe the "Testing internet connection..." has something to do with it (since we reply with DNS query for anything) and maybe it thinks there "might" be internet connection since it's able to get a DNS response ... need to do more testing