lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] How to send a large dynamic generated http page?


From: Andrew Xiang
Subject: Re: [lwip-users] How to send a large dynamic generated http page?
Date: Wed, 2 May 2012 11:04:39 -0400

Do you know file size in advance? In my case, I don't.

I had to use TCP_WRITE_FLAG_COPY to make it work.

#define TCP_FLAG TCP_WRITE_FLAG_COPY

static err_t
http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
{
  struct http_state *hs;

  hs = arg;

  if (hs->left > 0)
  {
    send_data(pcb, hs, TCP_FLAG);    
  }

  else if(more_data)
      {
 
          dump_data(0);

        hs->file = html_total;
        hs->left = strlen(html_total);
       
        send_data(pcb, hs, TCP_FLAG);   

       
          }
         
  else
      close_conn(pcb, hs);
  return ERR_OK;


}




On Wed, May 2, 2012 at 8:44 AM, Bill Auerbach <address@hidden> wrote:
>I've the same problem to solve. In my case they are log files with up to
>64KB. With the standard LwIP http server example it's not possible to
>send files with a size above the allowed buffer size. In most cases
>hs->left points just to the address in this buffer. So I think the best
>way is to create a other function which allows the "streaming" of the
>data (filling the buffer and sending and not to close the connection,
>even complete data was send).

It can be done because I've sent up to 800k files using the original
(non-SSI) httpd and note that I was basing this on the httpd_raw (sp?) demo.
Regardless of the file size the tcp_sent callback is used to continue to
send until the file end is reached.  I would expect 10k, 100k or 1MB to be
identical in the handling.

Bill



_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

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