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

Submitted by:  Dmitry <gdi>
Submitted on:  Tue 02 May 2017 12:45:16 PM UTC  
 
Category: appsSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned 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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>

 

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
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by gdi (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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 03 May 2017 07:57:27 AM UTCgoldsimonStatusWorks For Me=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed
    Tue 02 May 2017 06:56:29 PM UTCgoldsimonStatusNone=>Works For Me
    Tue 02 May 2017 12:45:16 PM UTCgdiAttached File-=>Added pure.css, #40557
      Attached File-=>Added pure-corrupted.css, #40558

    Back to the top


    Powered by Savane 3.1-cleanup1