[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] httpserver_raw and custom files in SD card
From: |
Emiliano Idà |
Subject: |
Re: [lwip-users] httpserver_raw and custom files in SD card |
Date: |
Thu, 18 Apr 2013 21:04:09 +0200 |
Hi,
finally, i made it.
I suggest a couple of modifications in httpd.c to get the things work.
This one tells httpd to make a copy of each allocated buffer when calling
tcp_write.
#define HTTP_IS_DATA_VOLATILE(hs) ((hs)->ssi ? TCP_WRITE_FLAG_COPY :
hs->file->is_custom_file)
The next one fixes a (possible) bug in http_init_file function
If the file is a custom file, we have to tell httpd that the file buffer still
has to be filled, so we myst set:
hs->left = 0
instead of
hs->left = file->len
hs->handle = file;
hs->file = (char*)file->data;
LWIP_ASSERT("File length must be positive!", (file->len >= 0));
- hs->left = file->len;
+ if (file->is_custom_file == 0)
+ hs->left = file->len;
+ else
+ hs->left = 0;
hs->retries = 0;