lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #52279] httpd.c http_init_file() miss uri


From: xuyao hong
Subject: [lwip-devel] [bug #52279] httpd.c http_init_file() miss uri
Date: Wed, 25 Oct 2017 05:27:44 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 OPR/48.0.2685.50

URL:
  <http://savannah.nongnu.org/bugs/?52279>

                 Summary: httpd.c http_init_file() miss uri 
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: shellstudio
            Submitted on: Wed 25 Oct 2017 09:27:42 AM UTC
                Category: apps
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.0.2

    _______________________________________________________

Details:

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);
}



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 25 Oct 2017 09:27:42 AM UTC  Name: httpd.c  Size: 90KiB   By:
shellstudio

<http://savannah.nongnu.org/bugs/download.php?file_id=42253>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?52279>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]