[Libwebsockets] lws_serve_http_file

Andy Green andy at warmcat.com
Mon Jan 30 23:57:30 CET 2017



On 31 January 2017 06:51:13 GMT+08:00, Srikar Vadlamani <SrikarVadlamani at trafficware.com> wrote:
>It is the same file, I tried to give an example, didn’t prune the files
>names correctly.
>
>Since it works on one computer/instance I don’t think it is permissions
>issue.

Add logging so you can know, if you do your own file handling.

>Developer tool, shows that it received good response headers, but no
>data itself and it times out.

The bit of the logs you sent tell that the lws side doesn't feel that ended for him by timing out.  The peer will close the connection if so.  But lws side thinks it went well.  Is it the right bit of the logs?

What are 'good headers'?  200? He's sending a ContentLength?

-Andy

>
>
>-----Original Message-----
>From: Andy Green [mailto:andy at warmcat.com] 
>Sent: Monday, January 30, 2017 4:38 PM
>To: libwebsockets at ml.libwebsockets.org; Srikar Vadlamani
><SrikarVadlamani at trafficware.com>
>Subject: Re: [Libwebsockets] lws_serve_http_file
>
>
>
>On 31 January 2017 04:30:04 GMT+08:00, Srikar Vadlamani
><SrikarVadlamani at trafficware.com> wrote:
>>I have a lws http server trying to send a binary json data over http, 
>>it does work without any issues on couple of computers, And on some 
>>laptops/computers it consistently fails, what can be the possible 
>>reasons.
>>Logs are attached below for both,
>>Is there something obvious you guys see?
>>
>>iRetLen =
>>lws_serve_http_file(pWs,cRspFileName,"application/json",NULL,0);
>>
>>WORKS:
>>: POST: Elapsed time:4332592 us
>>: fd=12, revents=4
>>(10092890,10093b10}LWS_CALLBACK_HTTP_WRITEABLE
>>: (10092890,10093b10}LWS_CALLBACK_HTTP_WRITEABLE:sending /home/Ret0
>>lws_set_timeout: 0x10092890: 20 secs
>>lws_set_timeout: 0x10092890: 20 secs
>>----- lots of lws_ser_timeout --------
>>: lws_set_timeout: 0x10092890: 20 secs
>>lws_set_timeout: 0x10092890: 20 secs
>>file completed
>>{10092890,10093b10}LWS_CALLBACK_HTTP_FILE_COMPLETION
>>lws_http_transaction_completed: wsi 0x10092890 
>>{10092890,10093b10}LWS_CALLBACK_HTTP_DROP_PROTOCOL
>>lws_ensure_user_space: 0x10092890 protocol 0x1001e224
>>lws_set_timeout: 0x10092890: 5 secs
>>lws_http_transaction_completed: wsi->more_rx_waiting=1
>>
>>
>>DOES NOT WORK:
>>(1004a860,1003fc80}LWS_CALLBACK_HTTP_WRITEABLE
>>(1004a860,1003fc80}LWS_CALLBACK_HTTP_WRITEABLE:sending
>>/home/Ret0
>This is not the same file as the first case.
>
>>lws_set_timeout: 0x1004a860: 20 secs
>>lws_set_timeout: 0x1004a860: 20 secs
>>lws_http_transaction_completed: wsi 0x1004a860
>
>He doesn't say 'file completed' but he ends well... he thinks he has
>finished dealing with what the client asked for.
>
>If you are opening the file yourself, how about it couldn't open the
>file due to permissions?
>
>What does the other side of the connection think happened?  If a
>browser the 'developer view' on modern browsers is very handy.
>
>-Andy
>
>>{1004a860,1003fc80}LWS_CALLBACK_HTTP_DROP_PROTOCOL
>>lws_ensure_user_space: 0x1004a860 protocol 0x1001e224
>>lws_set_timeout: 0x1004a860: 5 secs
>>lws_http_transaction_completed: wsi->more_rx_waiting=0
>>lws_header_table_detach: wsi 0x1004a860: ah 0x100283d8 (tsi=0, count =
>>1)
>>lws_header_table_detach: wsi 0x1004a860: ah held 7s, ah.rxpos 611, 
>>ah.rxlen 611, mode/state 0 0,wsi->more_rx_waiting 0
>>lws_header_table_detach: wsi 0x1004a860: ah 0x100283d8 (tsi=0, count =
>>0)
>>lws_http_transaction_completed: 0x1004a860: keep-alive await new 
>>transaction
>>_lws_rx_flow_control: no pending change
>
>--
>Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.



More information about the Libwebsockets mailing list