[Libwebsockets] lws_add_http_header_by_token

Andy Green andy at warmcat.com
Mon May 7 10:33:47 CEST 2018

On 05/07/2018 03:30 PM, Chanson Shen wrote:
> Hi all,
> In `minimal-http_server-form-get.c`, after `lws_http_redirect`, the 
> comment shows that we can add more headers after calling 
> `lws_http_redirect`.
> But in `lws_http_redirect`, the code already calls 
> `lws_finalize_http_header` and `lws_write`. Is that correct? And in the 
> example code, it calls `lws_finalize_http_header` and `lws_write` again 
> after `lws_http_redirect`. Does this violate `single lws_write` 
> principle in 
> https://libwebsockets.org/lws-api-doc-master/html/md_READMEs_README_8coding.html#writeable ?

Yeah... somebody spotted this already on the -post example, I fixed it 
there already along with the reference in -post-form-file a couple of 
weeks ago.


Unfortunately these minimal examples mean copying a load of code 
around... when the code is perfect that's not so bad.  But it's a pain 
if it needs changing... I missed fixing -get and that's the one you 
happened across.

I pushed a fix on v3.0-stable and master.


> Thanks,
> Chanson
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list