[Libwebsockets] lws_serve_http_file

Srikar Vadlamani SrikarVadlamani at trafficware.com
Mon Jan 30 23:51:13 CET 2017


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.

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



-----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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Capture.JPG
Type: image/jpeg
Size: 61373 bytes
Desc: Capture.JPG
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20170130/bde243a8/attachment-0002.jpe>


More information about the Libwebsockets mailing list