buglwIP - A Lightweight TCP/IP stack - Bugs: bug #52279, httpd.c http_init_file() miss uri

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #52279: httpd.c http_init_file() miss uri

Submitter:  xuyao hong <shellstudio>
Submitted:  Wed 25 Oct 2017 09:27:42 AM UTC
   
 
Category:  apps Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  2.0.2

Wed 25 Oct 2017 07:59:28 PM UTC, comment #1: 

Fixed, thanks for reporting!

Simon Goldschmidt <goldsimon>
Group administrator
Wed 25 Oct 2017 09:27:42 AM UTC, original submission:  

http_find_error_file()
call
http_init_file(uri)
call
get_http_headers(uri)

when LWIP_HTTPD_DYNAMIC_HEADERS is enable,
if uri is null, get_http_headers() always set http response 404.
so if error_nr is not 404, http_find_error_file(error_nr) take
the bad response header!

static err_t
http_find_error_file(struct http_state *hs, u16_t error_nr)
{
  const char *uri1, *uri2, *uri3;
  const char *uri;
  err_t err;

  if (error_nr == 501) {
    uri1 = "/501.html";
    uri2 = "/501.htm";
    uri3 = "/501.shtml";
  } else {
    /* 400 (bad request is the default) */
    uri1 = "/400.html";
    uri2 = "/400.htm";
    uri3 = "/400.shtml";
  }
  err = fs_open(&hs->file_handle, uri = uri1);
  if (err != ERR_OK) {
    err = fs_open(&hs->file_handle, uri = uri2);
    if (err != ERR_OK) {
      err = fs_open(&hs->file_handle, uri = uri3);
      if (err != ERR_OK) {
        LWIP_DEBUGF(HTTPD_DEBUG, ("Error page for error %"U16_F" not found\n",
                                  error_nr));
        return ERR_ARG;
      }
    }
  }
  return http_init_file(hs, &hs->file_handle, 0, uri, 0, NULL);
}

xuyao hong <shellstudio>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #42253:  httpd.c added by shellstudio (90KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by shellstudio (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-10-25 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2017-10-25 shellstudio Attached File- Added httpd.c, #42253

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code