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

Submitted by:  xuyao hong <shellstudio>
Submitted on:  Wed 25 Oct 2017 09:27:42 AM UTC  
 
Category: appsSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned 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>
Project AdministratorIn charge of this item.
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>

 

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
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by shellstudio (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 25 Oct 2017 07:59:28 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
    Wed 25 Oct 2017 09:27:42 AM UTCshellstudioAttached File-=>Added httpd.c, #42253

    Back to the top


    Powered by Savane 3.1-cleanup1