buglwIP - A Lightweight TCP/IP stack - Bugs: bug #50915, non-SSI files corruption with...

 
 

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

bug #50915: non-SSI files corruption with LWIP_HTTPD_DYNAMIC_FILE_READ = 1

Submitter:  Dmitry <gdi>
Submitted:  Tue 02 May 2017 12:45:16 PM 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:  git head

Wed 03 May 2017 08:05:23 AM UTC, comment #4: 

I've updated from git and it works good now, thanks.

Dmitry <gdi>
Wed 03 May 2017 07:57:27 AM UTC, comment #3: 

Alright, thanks for the hint. HTTP_IS_DATA_VOLATILE() was wrong if SSI is enabled. Should be fixed now.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 03 May 2017 07:34:50 AM UTC, comment #2: 

HTTP_IS_DATA_VOLATILE() isn't set specially. So it has default value in httpd.c:
((hs)->ssi ? TCP_WRITE_FLAG_COPY : 0)

Should I set it to something else for LWIP_HTTPD_DYNAMIC_FILE_READ = 1 with FatFs? And maybe it should be set as default in httpd.c under LWIP_HTTPD_DYNAMIC_FILE_READ = 1 since you support this setting?

Dmitry <gdi>
Tue 02 May 2017 06:56:29 PM UTC, comment #1: 

That should not be a problem since data read from an external file system must be copied (a 2nd time) by tcp anyway, since the single read buffer in httpd cannot guarantee to hold the data until it is ACKed - this would limit the tcp window to the read buffer size...

What is HTTP_IS_DATA_VOLATILE() set to in your application?

Simon Goldschmidt <goldsimon>
Group administrator
Tue 02 May 2017 12:45:16 PM UTC, original submission:  

non-SSI files are corrupting with LWIP_HTTPD_DYNAMIC_FILE_READ = 1 in httpserver_raw example. See the files in attachment where pure.css is an original file and pure-corrupted.css is the file which was received in browser.
Little debugging show me that it looks like file is corrupted because the buffer was rewritten before it was sent. In a function http_check_eof I see that hs->buf is filling by new data and a tail of new data sending before continue of old data. I'll try to explain in example:
NNNNNNNN-P-NNN-OOOOOOO, <-- here is a hs->buf and where 'N' representing new data '-P-' is a pointer to send data, '-OO' - old data, '-' just to separator for better look. So the issue looks like not all old data was sent before new data was written to the buffer.
You can do a diff between files in attachment and you will see the difference in corrupted file and also you can search the different data and you will see as it will be repeated later.

Dmitry <gdi>

 

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

Attached Files
file #40557:  pure.css added by gdi (33KiB - text/css)
file #40558:  pure-corrupted.css added by gdi (33KiB - text/css)

 

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 gdi (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-05-03 goldsimon StatusWorks For Me Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2017-05-02 goldsimon StatusNone Works For Me
    2017-05-02 gdi Attached File- Added pure.css, #40557
        Attached File- Added pure-corrupted.css, #40558

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code