[Libwebsockets] Choking on Windows in libwebsockets_serve_http_file()

Mark Hessling mark at rexx.org
Mon Nov 3 03:57:11 CET 2014


I'm running libwebsockets 1.3 under Windows.  I have a chat server 
serving HTTP and a websocket.  Below is the trace when I connect a 
Chrome session running on a different machine.  I use 
libwebsockets_serve_http_file() in the LWS_CALLBACK_HTTP callback. On 
some of the files I am getting:
[] INFO: choked before able to send whole file (post)
but it appears that the whole file is actually getting transferred.

Is the above INFO: message something to be concerned about?

If I run Chrome on the same machine as the server, then I get even more 
of the choking messages, and the complete file does NOT get sent to Chrome.

Should libwebsockets_serve_http_file() handle any choking internally and 
be reliable in delivering the whole file?

I noticed the comment in test-server.c regarding choking with Chrome 
running on the same Windows machine.

Running the same code on Linux with Chrome running on the same machine 
causes no problems.

Thanks, Mark

[96530:0181] INFO: HTTP GET request for '/chat.html'
[96530:0181] INFO: LWS_CALLBACK_HTTP closing
[96530:0181] DEBUG: closing connection at libwebsocket_read bail:
[96530:0181] DEBUG: closing http file
[96530:0337] DEBUG: close: just_kill_connection
[96530:0337] INFO: remove_wsi_socket_from_fds: wsi=01EB25A0, sock=372, 
fds pos=1
[96530:0337] DEBUG: calling back CLOSED_HTTP
[96530:0961] INFO: insert_wsi_socket_into_fds: wsi=01EB25A0, sock=372, 
fds pos=1
[96530:0961] INFO: inserted SSL accept into fds, trying SSL_accept
[96530:0961] DEBUG: accepted new SSL conn
[96530:0961] INFO: insert_wsi_socket_into_fds: wsi=01EB2670, sock=376, 
fds pos=2
[96530:0961] INFO: inserted SSL accept into fds, trying SSL_accept
[96530:0961] DEBUG: accepted new SSL conn
[96530:0961] INFO: insert_wsi_socket_into_fds: wsi=01EB2740, sock=320, 
fds pos=3
[96530:0961] INFO: inserted SSL accept into fds, trying SSL_accept
[96530:1117] DEBUG: accepted new SSL conn
[96530:1117] DEBUG: Session Socket 01EB25A0 (fd=372) dead
[96530:1117] DEBUG: close: just_kill_connection
[96530:1117] INFO: remove_wsi_socket_from_fds: wsi=01EB25A0, sock=372, 
fds pos=1
[96530:1273] DEBUG: not calling back closed
[96530:1273] DEBUG: Session Socket 01EB2670 (fd=376) dead
[96530:1273] DEBUG: close: just_kill_connection
[96530:1273] INFO: remove_wsi_socket_from_fds: wsi=01EB2670, sock=376, 
fds pos=2
[96530:1273] DEBUG: not calling back closed
[96530:1273] INFO: insert_wsi_socket_into_fds: wsi=01EB25A0, sock=376, 
fds pos=2
[96530:1273] INFO: inserted SSL accept into fds, trying SSL_accept
[96530:1429] DEBUG: accepted new SSL conn
[96530:1429] INFO: insert_wsi_socket_into_fds: wsi=01EB2670, sock=372, 
fds pos=3
[96530:1429] INFO: inserted SSL accept into fds, trying SSL_accept
[96530:1429] DEBUG: accepted new SSL conn
[96530:1429] INFO: insert_wsi_socket_into_fds: wsi=01EB2810, sock=380, 
fds pos=4
[96530:1429] INFO: inserted SSL accept into fds, trying SSL_accept
[96530:1429] DEBUG: accepted new SSL conn
[96530:1429] INFO: insert_wsi_socket_into_fds: wsi=01EB28E0, sock=384, 
fds pos=5
[96530:1429] INFO: inserted SSL accept into fds, trying SSL_accept
[96530:1585] DEBUG: accepted new SSL conn
[96530:1585] INFO: HTTP GET request for '/js/jquery.mobile-1.3.2.min.css'
[96530:1585] INFO: LWS_CALLBACK_HTTP closing
[96530:1585] DEBUG: closing connection at libwebsocket_read bail:
[96530:1585] DEBUG: closing http file
[96530:1585] DEBUG: close: just_kill_connection
[96530:1585] INFO: remove_wsi_socket_from_fds: wsi=01EB2740, sock=320, 
fds pos=1
[96530:1741] DEBUG: calling back CLOSED_HTTP
[96530:1741] INFO: insert_wsi_socket_into_fds: wsi=01EB2740, sock=320, 
fds pos=5
[96530:1741] INFO: inserted SSL accept into fds, trying SSL_accept
[96530:1741] DEBUG: accepted new SSL conn
[96530:1741] DEBUG: Session Socket 01EB2670 (fd=372) dead
[96530:1741] DEBUG: close: just_kill_connection
[96530:1741] INFO: remove_wsi_socket_from_fds: wsi=01EB2670, sock=372, 
fds pos=3
[96530:1741] DEBUG: not calling back closed
[96530:1741] INFO: HTTP GET request for '/js/jquery-1.10.2.min.js'
[96530:1897] INFO: choked before able to send whole file (post)
[96530:1897] DEBUG: Session Socket 01EB2810 (fd=380) dead
[96530:1897] DEBUG: close: just_kill_connection
[96530:1897] INFO: remove_wsi_socket_from_fds: wsi=01EB2810, sock=380, 
fds pos=4
[96530:1897] DEBUG: not calling back closed
[96530:1897] INFO: HTTP GET request for '/js/jquery.mobile-1.3.2.min.js'
[96530:2053] INFO: choked before able to send whole file (post)
[96530:2053] INFO: choked before able to send whole file (post)
[96530:2053] INFO: HTTP GET request for '/js/reconnecting-websocket.js'
[96530:2053] INFO: LWS_CALLBACK_HTTP closing
[96530:2053] DEBUG: closing connection at libwebsocket_read bail:
[96530:2053] DEBUG: closing http file
[96530:2053] DEBUG: close: just_kill_connection
[96530:2053] INFO: remove_wsi_socket_from_fds: wsi=01EB2740, sock=320, 
fds pos=3
[96530:2053] DEBUG: calling back CLOSED_HTTP
[96530:2209] INFO: choked before able to send whole file (post)
[96530:2209] INFO: choked before able to send whole file (post)
[96530:2209] INFO: choked before able to send whole file (post)
[96530:2209] INFO: choked before able to send whole file (post)
[96530:2209] INFO: choked before able to send whole file (post)
[96530:2365] INFO: choked before able to send whole file (post)
[96530:2365] DEBUG: closing http file
[96530:2365] DEBUG: close: just_kill_connection
[96530:2365] INFO: remove_wsi_socket_from_fds: wsi=01EB28E0, sock=384, 
fds pos=1
[96530:2365] DEBUG: calling back CLOSED_HTTP
[96530:2365] INFO: choked before able to send whole file (post)
[96530:2365] DEBUG: closing http file
[96530:2521] DEBUG: close: just_kill_connection
[96530:2521] INFO: remove_wsi_socket_from_fds: wsi=01EB25A0, sock=376, 
fds pos=1
[96530:2521] DEBUG: calling back CLOSED_HTTP
[96531:3613] INFO: insert_wsi_socket_into_fds: wsi=01EB25A0, sock=376, 
fds pos=1
[96531:3613] INFO: inserted SSL accept into fds, trying SSL_accept
[96531:3613] DEBUG: accepted new SSL conn
[96531:3613] DEBUG: Session Socket 01EB25A0 (fd=376) dead
[96531:3613] DEBUG: close: just_kill_connection
[96531:3613] INFO: remove_wsi_socket_from_fds: wsi=01EB25A0, sock=376, 
fds pos=1
[96531:3613] DEBUG: not calling back closed
[96531:3769] INFO: insert_wsi_socket_into_fds: wsi=01EB25A0, sock=376, 
fds pos=1
[96531:3769] INFO: inserted SSL accept into fds, trying SSL_accept
[96531:3769] DEBUG: accepted new SSL conn
[96531:3769] INFO: HTTP GET request for '/js/images/ajax-loader.gif'
[96531:3769] INFO: LWS_CALLBACK_HTTP closing
[96531:3769] DEBUG: closing connection at libwebsocket_read bail:
[96531:3769] DEBUG: close: just_kill_connection
[96531:3769] INFO: remove_wsi_socket_from_fds: wsi=01EB25A0, sock=376, 
fds pos=1
[96531:3925] DEBUG: calling back CLOSED_HTTP
[96531:4081] INFO: insert_wsi_socket_into_fds: wsi=01EB25A0, sock=376, 
fds pos=1
[96531:4081] INFO: inserted SSL accept into fds, trying SSL_accept
[96531:4081] DEBUG: accepted new SSL conn
[96531:4081] DEBUG: Session Socket 01EB25A0 (fd=376) dead
[96531:4081] DEBUG: close: just_kill_connection
[96531:4081] INFO: remove_wsi_socket_from_fds: wsi=01EB25A0, sock=376, 
fds pos=1
[96531:4081] DEBUG: not calling back closed
[96531:4237] INFO: insert_wsi_socket_into_fds: wsi=01EB25A0, sock=376, 
fds pos=1
[96531:4237] INFO: inserted SSL accept into fds, trying SSL_accept
[96531:4237] DEBUG: accepted new SSL conn
HTTP/1.1 101 Switching Protocols
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Accept: QbbPvJO1uaOtVK8uyy3ZAq9SQ10=
Sec-WebSocket-Protocol: chat

[96531:4393] INFO: Allocating RX buffer 50022


Files being served: (file size is first column)
  93113  jquery-1.10.2.min.js
  94681  jquery.mobile-1.3.2.min.css
145404  jquery.mobile-1.3.2.min.js
   5895  reconnecting-websocket.js

-- 
------------------------------------------------------------------------
* Mark Hessling, mark at rexx.org http://www.rexx.org/
* Author of THE, a Free XEDIT/KEDIT editor and, Rexx/SQL, Rexx/CURL, etc.
* Maintainer of Regina Rexx interpreter
* Use Rexx? join the Rexx Language Association: http://www.rexxla.org/
------------------------------------------------------------------------




More information about the Libwebsockets mailing list