how to populate uri field in httpd_req_t?

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

how to populate uri field in httpd_req_t?

Postby mzimmers » Wed Dec 01, 2021 1:33 am

Hi all -

I'm using the httpd_req_t struct. I need to edit the uri field (to decode characters from the %NN formatting), but it's a const. I've looked at creating a new struct, and initializing it like this:

Code: Select all

esp_err_t wildcard_handler(httpd_req_t *req)
{
    const struct fluidra_http_page_t *page = ap_web_pages;
//    ESP_LOGI(TAG, "wildcard_handler: starting.");
    static char buff[513];
    
    if (page->url != 0x0) {
//        buff = malloc(strlen(req->uri));
        uri_decode((void *) req->uri, strlen(req->uri), buff);
        httpd_req_t newReq = {
            .handle = req->handle,
            .method = req->method,
//            .uri = buff,
But this doesn't work.

So, how does one go about dynamically creating such a struct?

Thanks...

Who is online

Users browsing this forum: No registered users and 121 guests