[Libwebsockets] Very minor bugs(?) in protocol_post_demo.c

Andy Green andy at warmcat.com
Sat May 21 09:19:41 CEST 2016



On 05/21/2016 03:08 PM, Colin Adams wrote:
> First the header line:
>
> ws protocol handler plugin for "dumb increment"
>
> s/dumb increment/post demo/
>
> I wouldn't have nothered reporting that if I wasn't also going to
> mention this code:
>
> case LWS_CALLBACK_HTTP:
> lwsl_debug("LWS_CALLBACK_HTTP\n");
> if (lws_hdr_total_length(wsi, WSI_TOKEN_POST_URI))
> return 0;
> break;
>
> This appears to me to be a big no-op (modulo debugging message), as:
>
> Should the conditional evaluate to true, then we return 0. Otherwise we
> fall out of the switch and return 0. So the whole thing is equivalent to
> the default case.
>
> Or does lws_hdr_total_length have necessary side effects?

Yes it's just some escaped cut-and-paste.

The whole case is not needed as you say; thanks for pointing it out.

I pushed a patch removing it and correcting the filename comment at the 
top on master.

-Andy

>
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets
>



More information about the Libwebsockets mailing list