esp32 http server : how to get a wildcard in the uri ?

DannyBackx
Posts: 33
Joined: Wed Sep 19, 2018 7:17 pm

esp32 http server : how to get a wildcard in the uri ?

Postby DannyBackx » Mon Apr 22, 2019 10:22 am

Hi,

I can use the api to register specific URIs, but I can't find out how to use a wildcard.
None of what I tried (see below) works, I always get
acer: {24} curl http://hall/hello/this-tests-it ; echo " "
This URI doesn't exist
acer: {25}
with messages like these in debug :
W (9477) httpd_uri: httpd_uri: URI '/hello/this-tests-it' not found
W (9477) httpd_txrx: httpd_resp_send_err: 404 Not Found - This URI doesn't exist
Thanks,
Danny

Code: Select all

ESP_LOGI(webserver_tag, "Register URI handlers");
  httpd_uri_t u_hello = {
    "/hello",                   // URI handled
    HTTP_GET,                   // HTTP method
    hello_get_handler,          // Handler
    (void *)0                   // User context
  };
  httpd_register_uri_handler(server, &u_hello);
  u_hello.uri = "/hello/*";
  httpd_register_uri_handler(server, &u_hello);
  u_hello.uri = "/hello/%";
  httpd_register_uri_handler(server, &u_hello);
  u_hello.uri = "/index.html";

DannyBackx
Posts: 33
Joined: Wed Sep 19, 2018 7:17 pm

Re: esp32 http server : how to get a wildcard in the uri ?

Postby DannyBackx » Mon Apr 22, 2019 10:48 am

Apologies for being too brief, I am using esp-idf 3.2 and would like to use the builtin apis.

DannyBackx
Posts: 33
Joined: Wed Sep 19, 2018 7:17 pm

Re: esp32 http server : how to get a wildcard in the uri ?

Postby DannyBackx » Sat Apr 27, 2019 3:30 pm

I'll answer my own question : this is not available in esp-idf 3.2 yet, but it's in the master branch on github so I assume it'll be in 3.3.
Workarounds are possible in 3.2, see viewtopic.php?p=29992#p29992 .

See https://github.com/espressif/esp-idf/issues/3373 .

Who is online

Users browsing this forum: atx823 and 117 guests