Skip to content

makefsdata.py captive portal support #2646

@peterharperuk

Description

@peterharperuk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions