-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
This is an issue that's come out of work for this PR raspberrypi/pico-examples#701
The current access point example generates a 404 response "HTTP/1.1 302 Redirect\nLocation: http:///ledtest\n\n" The gw address is in CYW43_DEFAULT_IP_AP_ADDRESS I think.
The sdk includes makefsdata.py (in src/rp2_common/pico_lwip/tools) which is run via the cmake function pico_set_lwip_httpd_content. You can generate a 404 response by adding a 404.html file to your content but crucially you can't modify the http headers, only the html page that's returned. This means you can't fully implement a captive portal (I think).
Add a parameter to makefsdata.py that generates a specific header response, e.g.
--header_response "404=HTTP/1.1 302 Redirect\nLocation: http://192.168.4.1/ledtest\n\n"
Have a look at process_file in makefsdata.py and how it generates the content for a file. In this case we would just generate 404.html with just the header response given. All the '\','n' sequences will have to be replaced with a real "\n". This will then need to be plumbed into cmake somehow via a new optional argument to the pico_set_lwip_httpd_content function.
Captive portal functionality might work then.