[Libwebsockets] Websocket redirect failed question

Andy Green andy at warmcat.com
Fri Feb 10 04:01:59 CET 2017



On 02/10/2017 10:29 AM, Wayne Huang wrote:
> I have found problem about this issue.
>
> The normal websocket package:
>  [Full request URI: 
> http://10.70.50.187/msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/Q2Cv8iXQQjwngo3heJlitZIXFxxQb3wqZfI3Jp0T]
>
> But the redirect websocket package:
> [Full request URI: 
> http://10.70.50.187msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/Q2Cv8iXQQjwngo3heJlitZIXFxxQb3wqZfI3Jp0T]
>
> Which missing '/' between '10.70.50.187' and 'msg'.

Does this help?

https://github.com/warmcat/libwebsockets/commit/0b3e9e62cbc4824a804fff403ccbcdb744770772

-Andy

>
> From log can see after lws_parse_uri, it get path without '/' :
> [2017/02/10 09:59:04:4009] ERR: 
> [lws_client_interpret_server_handshake] 477 
> p=http://10.70.50.187:8080/msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/1Z1urPLdWOlcjIy77kNtAL97qtX4cCIkpOqhOeEq
> [2017/02/10 09:59:04:4009] ERR: 
> [lws_client_interpret_server_handshake] 485 call lws_client_reset, 
> ads=10.70.50.187, port=8080, 
> path=msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/1Z1urPLdWOlcjIy77kNtAL97qtX4cCIkpOqhOeEq
>
> in lws_parse_uri(p, &prot, &ads, &port, &path) :
> *path = slash;
> if (*p) {
>    // print p='/msg/xx/xx/xx'
>    *p++ = '\0';
>    // print p='msg/xx/xx/xx'
>    if (*p)
>       *path = p;
> }
>
> I am not sure if it is intent to cut the '/' when parsing.
>
> If I manually mark //*p++ = '\0';, it can connect to server perfectly.
>
> Please help to clarify.
>
> Thanks,
> Wayne
>
> 2017-02-09 18:09 GMT+08:00 Andy Green <andy at warmcat.com 
> <mailto:andy at warmcat.com>>:
>
>
>
>     On 9 February 2017 18:02:59 GMT+08:00, Wayne Huang
>     <zweblack at gmail.com <mailto:zweblack at gmail.com>> wrote:
>     >Hello Andy,
>     >
>     >I use patch and test again, but get HS: ACCEPT missing.
>
>     What I confirmed worked was the test client going to
>     http://libwebsockets.org, and being redirected to
>     https://libwebsockets.org.
>
>     I appreciate you're sending me nice logs but it'd be great if you
>     could relate your problem to something I can reproduce.
>
>     That usually means one of the test apps and some server I can
>     reach, if necessary.
>
>     -Andy
>
>
>     >
>     >From server side's log:
>     >2017-02-09 17:46:07,764 DEBUG [WebSocketRedirect] -
>     WebSocketRedirect:
>     >(fa07c9f0-d2ed-4636-83ad-d6f3bee0f452,
>     >00000000-0001-0001-0001-000000000008) -> List(Location:
>     >http://10.70.50.187:8080/msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/ERMXuXQvvTRbOtAF7uPvufMOBWtTQNPErEL36uze
>     <http://10.70.50.187:8080/msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/ERMXuXQvvTRbOtAF7uPvufMOBWtTQNPErEL36uze>)
>     >
>     >2017-02-09 17:46:07,852 WARN [akka.actor.ActorSystemImpl] - Illegal
>     >request, responding with status '400 Bad Request': Illegal
>     >request-target:
>     >Invalid input '/', expected scheme-char, 'EOI', ':', UPPER_ALPHA,
>     '@',
>     >lower-reg-name-char, pct-encoded or userinfo-char (line 1, column 4):
>     >msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/ERMXuXQvvTRbOtAF7uPvufMOBWtTQNPErEL36uze
>     >
>     >It seems sent incorrect uri '/' ?
>     >
>     >If I stop client and change ip and port to redirect one then run
>     again,
>     >it
>     >still can connect to server successfully.
>     >
>     >Any advice or something I can try to print ?
>     >
>     >Wayne
>     >
>     >---Failed log-------------------------------------------------------
>     >[ws_start_service]: websocket service starting ...
>     >
>     >====== ws service info ======
>     >host=10.70.50.187
>     >port=80
>     >path=/msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/ERMXuXQvvTRbOtAF7uPvufMOBWtTQNPErEL36uze
>     >==================
>     >
>     >ws_callback: LWS_CALLBACK_PROTOCOL_INIT
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_ADD_POLL_FD
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_WSI_CREATE
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_GET_THREAD_ID
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >ws_callback: LWS_CALLBACK_GET_THREAD_ID
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER
>     >[2017/02/09 17:46:07:2095] NOTICE: Initial logging level 7
>     >[2017/02/09 17:46:07:2096] NOTICE: Libwebsockets version: 2.1.0
>     >wayne_huang at aynede-Mac-mini.local-v2.0.0-255-g31c5130
>     >[2017/02/09 17:46:07:2096] NOTICE: IPV6 not compiled in
>     >[2017/02/09 17:46:07:2096] NOTICE: libev support not compiled in
>     >[2017/02/09 17:46:07:2096] NOTICE: libuv support not compiled in
>     >[2017/02/09 17:46:07:2097] NOTICE:  Threads: 4 each 2560 fds
>     >[2017/02/09 17:46:07:2098] NOTICE:  mem: platform fd map: 81920 bytes
>     >[2017/02/09 17:46:07:2098] NOTICE:  Compiled with OpenSSL support
>     >[2017/02/09 17:46:07:2098] NOTICE:  SSL disabled: no
>     >LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT
>     >[2017/02/09 17:46:07:2098] NOTICE: Creating Vhost 'default' port
>     -1, 1
>     >protocols, IPv6 off
>     >[2017/02/09 17:46:07:2098] NOTICE:  mem: per-conn:       568 bytes +
>     >protocol rx buf
>     >[2017/02/09 17:46:07:2098] NOTICE:  canonical_hostname =
>     >aynede-Mac-mini.local
>     >[2017/02/09 17:46:07:2099] ERR: [lws_client_connect_via_info2]
>     731 call
>     >lws_client_connect_2
>     >[2017/02/09 17:46:07:2099] ERR: [lws_client_connect_2][18] enter ===
>     >[2017/02/09 17:46:07:2099] ERR: [lws_client_connect_2] 28
>     >[2017/02/09 17:46:07:2099] ERR: [lws_client_connect_2] 52 not proxy
>     >[2017/02/09 17:46:07:2099] ERR: [lws_client_connect_2] 60 socket
>     >server_addr4.sin_port=80
>     >[2017/02/09 17:46:07:2099] NOTICE: lws_client_connect_2: address
>     >10.70.50.187
>     >[2017/02/09 17:46:07:2099] ERR: [lws_client_connect_2] 67
>     >ads=10.70.50.187
>     >[2017/02/09 17:46:07:2099] ERR: [lws_client_connect_2] 119
>     >[2017/02/09 17:46:07:2108] ERR: [lws_client_connect_2] 173 socket
>     >invalid =
>     >null
>     >[2017/02/09 17:46:07:2108] ERR: [lws_client_connect_2] 185 socket
>     bind
>     >again, valid not null !!!
>     >[2017/02/09 17:46:07:2119] ERR: [lws_client_connect_2] 193 set
>     >wsi->mode =
>     >LWSCM_WSCL_WAITING_CONNECT
>     >[2017/02/09 17:46:07:2119] ERR: [lws_client_connect_2] 210 past here,
>     >we
>     >can't simply free the structs as error handling as oom4 does.  We
>     have
>     >to
>     >run the whole close flow.
>     >[2017/02/09 17:46:07:2120] ERR: [lws_client_connect_2] 245
>     nonblocking
>     >connect retry (errno = 36)
>     >[2017/02/09 17:46:07:2120] ERR: [lws_client_connect_2] 262 return wsi
>     >[2017/02/09 17:46:07:2122] ERR: [lws_service_fd_tsi] 1140 call
>     >lws_client_socket_service
>     >[2017/02/09 17:46:07:2122] ERR: [lws_client_socket_service] 85
>     >wsi->mode=34
>     >[2017/02/09 17:46:07:2122] ERR: [lws_client_socket_service] 89
>     >LWSCM_WSCL_WAITING_CONNECT=34, call lws_client_connect_2
>     >[2017/02/09 17:46:07:2122] ERR: we are under
>     >PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE timeout protection set in
>     >client-handshake.c
>     >[2017/02/09 17:46:07:2122] ERR: [lws_client_connect_2][18] enter ===
>     >[2017/02/09 17:46:07:2122] ERR: [lws_client_connect_2] 28
>     >[2017/02/09 17:46:07:2122] ERR: [lws_client_connect_2] 52 not proxy
>     >[2017/02/09 17:46:07:2122] ERR: [lws_client_connect_2] 60 socket
>     >server_addr4.sin_port=80
>     >[2017/02/09 17:46:07:2123] NOTICE: lws_client_connect_2: address
>     >10.70.50.187
>     >[2017/02/09 17:46:07:2123] ERR: [lws_client_connect_2] 67
>     >ads=10.70.50.187
>     >[2017/02/09 17:46:07:2123] ERR: [lws_client_connect_2] 119
>     >[2017/02/09 17:46:07:2129] ERR: [lws_client_connect_2] 225 socket
>     valid
>     >not
>     >null
>     >[2017/02/09 17:46:07:2129] ERR: [lws_client_connect_2] 272 connected
>     >[2017/02/09 17:46:07:2129] ERR: [lws_service_fd_tsi] 1140 call
>     >lws_client_socket_service
>     >[2017/02/09 17:46:07:2129] ERR: [lws_client_socket_service] 85
>     >wsi->mode=36
>     >[2017/02/09 17:46:07:2129] ERR: [lws_client_socket_service] 144
>     >LWSCM_WSCL_ISSUE_HANDSHAKE
>     >[2017/02/09 17:46:07:2158] ERR: [lws_service_fd_tsi] 1143 goto
>     handled
>     >[2017/02/09 17:46:07:2159] ERR: [lws_service_fd_tsi] 1143 goto
>     handled
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_DEL_POLL_FD
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_ADD_POLL_FD
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_WSI_CREATE
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >ws_callback: LWS_CALLBACK_GET_THREAD_ID
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >[2017/02/09 17:46:07:8150] ERR: [lws_service_fd_tsi] 1140 call
>     >lws_client_socket_service
>     >[2017/02/09 17:46:07:8150] ERR: [lws_client_socket_service] 85
>     >wsi->mode=40
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >ws_callback: LWS_CALLBACK_GET_THREAD_ID
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER
>     >[2017/02/09 17:46:07:8150] ERR: [lws_client_socket_service] 247
>     >LWSCM_WSCL_WAITING_SERVER_REPLY
>     >[2017/02/09 17:46:07:8153] ERR: [lws_client_socket_service] 315 call
>     >lws_client_interpret_server_handshake
>     >[2017/02/09 17:46:07:8153] ERR:
>     [lws_client_interpret_server_handshake]
>     >470
>     >http_response=301
>     >[2017/02/09 17:46:07:8153] NOTICE: ssl 0
>     >[2017/02/09 17:46:07:8153] ERR:
>     [lws_client_interpret_server_handshake]
>     >485
>     >call lws_client_reset, ads=10.70.50.187, port=8080,
>     >path=msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/ERMXuXQvvTRbOtAF7uPvufMOBWtTQNPErEL36uze
>     >[2017/02/09 17:46:07:8153] NOTICE: ssl 0 http
>     >[2017/02/09 17:46:07:8153] ERR: [lws_client_connect_2] 398 copy to
>     >protocol
>     >p=ws-protocol
>     >[2017/02/09 17:46:07:8153] NOTICE: redirect ads='10.70.50.187',
>     >port=8080,
>     >path='msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/ERMXuXQvvTRbOtAF7uPvufMOBWtTQNPErEL36uze',
>     >ssl = 0
>     >[2017/02/09 17:46:07:8154] NOTICE: [lws_client_connect_2] 428 check
>     >address=10.70.50.187,
>     >path=msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/ERMXuXQvvTRbOtAF7uPvufMOBWtTQNPErEL36uze,
>     >host=10.70.50.187
>     >[2017/02/09 17:46:07:8154] ERR: [lws_client_connect_2] 433
>     >lws_hdr_simple_create protocol = ws-protocol
>     >[2017/02/09 17:46:07:8154] NOTICE: [lws_client_reset] 441 call
>     >lws_client_connect_2
>     >[2017/02/09 17:46:07:8154] ERR: [lws_client_connect_2][18] enter ===
>     >[2017/02/09 17:46:07:8154] ERR: [lws_client_connect_2] 28
>     >[2017/02/09 17:46:07:8154] ERR: [lws_client_connect_2] 52 not proxy
>     >[2017/02/09 17:46:07:8154] ERR: [lws_client_connect_2] 60 socket
>     >server_addr4.sin_port=8080
>     >[2017/02/09 17:46:07:8154] NOTICE: lws_client_connect_2: address
>     >10.70.50.187
>     >[2017/02/09 17:46:07:8154] ERR: [lws_client_connect_2] 67
>     >ads=10.70.50.187
>     >[2017/02/09 17:46:07:8154] ERR: [lws_client_connect_2] 119
>     >[2017/02/09 17:46:07:8159] ERR: [lws_client_connect_2] 173 socket
>     >invalid =
>     >null
>     >[2017/02/09 17:46:07:8160] ERR: [lws_client_connect_2] 185 socket
>     bind
>     >again, valid not null !!!
>     >[2017/02/09 17:46:07:8160] ERR: [lws_client_connect_2] 193 set
>     >wsi->mode =
>     >LWSCM_WSCL_WAITING_CONNECT
>     >[2017/02/09 17:46:07:8160] ERR: [lws_client_connect_2] 210 past here,
>     >we
>     >can't simply free the structs as error handling as oom4 does.  We
>     have
>     >to
>     >run the whole close flow.
>     >[2017/02/09 17:46:07:8160] ERR: [lws_client_connect_2] 245
>     nonblocking
>     >connect retry (errno = 36)
>     >[2017/02/09 17:46:07:8161] ERR: [lws_client_connect_2] 262 return wsi
>     >[2017/02/09 17:46:07:8161] ERR: [lws_service_fd_tsi] 1143 goto
>     handled
>     >[2017/02/09 17:46:07:8162] ERR: [lws_service_fd_tsi] 1140 call
>     >lws_client_socket_service
>     >[2017/02/09 17:46:07:8162] ERR: [lws_client_socket_service] 85
>     >wsi->mode=34
>     >[2017/02/09 17:46:07:8162] ERR: [lws_client_socket_service] 89
>     >LWSCM_WSCL_WAITING_CONNECT=34, call lws_client_connect_2
>     >[2017/02/09 17:46:07:8162] ERR: we are under
>     >PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE timeout protection set in
>     >client-handshake.c
>     >[2017/02/09 17:46:07:8162] ERR: [lws_client_connect_2][18] enter ===
>     >[2017/02/09 17:46:07:8162] ERR: [lws_client_connect_2] 28
>     >[2017/02/09 17:46:07:8162] ERR: [lws_client_connect_2] 52 not proxy
>     >[2017/02/09 17:46:07:8162] ERR: [lws_client_connect_2] 60 socket
>     >server_addr4.sin_port=8080
>     >[2017/02/09 17:46:07:8162] NOTICE: lws_client_connect_2: address
>     >10.70.50.187
>     >[2017/02/09 17:46:07:8162] ERR: [lws_client_connect_2] 67
>     >ads=10.70.50.187
>     >[2017/02/09 17:46:07:8162] ERR: [lws_client_connect_2] 119
>     >[2017/02/09 17:46:07:8167] ERR: [lws_client_connect_2] 225 socket
>     valid
>     >not
>     >null
>     >[2017/02/09 17:46:07:8167] ERR: [lws_client_connect_2] 272 connected
>     >[2017/02/09 17:46:07:8167] ERR: [lws_service_fd_tsi] 1140 call
>     >lws_client_socket_service
>     >[2017/02/09 17:46:07:8167] ERR: [lws_client_socket_service] 85
>     >wsi->mode=36
>     >[2017/02/09 17:46:07:8167] ERR: [lws_client_socket_service] 144
>     >LWSCM_WSCL_ISSUE_HANDSHAKE
>     >[2017/02/09 17:46:07:8168] ERR: [lws_service_fd_tsi] 1143 goto
>     handled
>     >[2017/02/09 17:46:07:8168] ERR: [lws_service_fd_tsi] 1143 goto
>     handled
>     >ws_callback: LWS_CALLBACK_CLIENT_CONNECTION_ERROR
>     >[ws_callback] Connect with server error: HS: ACCEPT missing
>     >[2017/02/09 17:46:07:8548] ERR: [lws_service_fd_tsi] 1140 call
>     >lws_client_socket_service
>     >ws_callback: LWS_CALLBACK_CLOSED_CLIENT_HTTP
>     >ws_callback: LWS_CALLBACK_LOCK_POLL
>     >ws_callback: LWS_CALLBACK_DEL_POLL_FD
>     >ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >ws_callback: LWS_CALLBACK_WSI_DESTROY
>     >ws_callback: LWS_CALLBACK_PROTOCOL_DESTROY
>     >[2017/02/09 17:46:07:8548] ERR: [lws_client_socket_service] 85
>     >wsi->mode=40
>     >[2017/02/09 17:46:07:8548] ERR: [lws_client_socket_service] 247
>     >LWSCM_WSCL_WAITING_SERVER_REPLY
>     >[2017/02/09 17:46:07:8551] ERR: [lws_client_socket_service] 315 call
>     >lws_client_interpret_server_handshake
>     >[2017/02/09 17:46:07:8551] ERR:
>     [lws_client_interpret_server_handshake]
>     >470
>     >http_response=400
>     >[2017/02/09 17:46:07:8567] ERR: [lws_service_fd_tsi] 1142 retrun 1
>     >[2017/02/09 17:46:07:8567] NOTICE: lws_context_destroy: ctx
>     >0x7fa3dc803c00
>     >[2017/02/09 17:46:07:8567] NOTICE: lws_context_destroy2: ctx
>     >0x7fa3dc803c00
>     >
>     >
>     >2017-02-09 15:27 GMT+08:00 Andy Green <andy at warmcat.com
>     <mailto:andy at warmcat.com>>:
>     >
>     >>
>     >>
>     >> On 02/09/2017 02:40 PM, 黃小偉 wrote:
>     >>
>     >>> Hello,
>     >>>
>     >>> I have a problem when my client received websocket redirect
>     response
>     >from
>     >>> server.
>     >>>
>     >>> Scenario:
>     >>> a. Connect to server with ip:A, port:B
>     >>> b. Server response redirect information with ip:C, port:D
>     >>> c. libwebsocket try to connect with lws_client_reset but
>     failed due
>     >to
>     >>> LWS_ERRNO = 36 = LWS_EINPROGRESS and no more retry
>     >>> d. Client received LWS_CALLBACK_CLIENT_CONNECTION_ERROR with
>     reason
>     >"HS:
>     >>> Redirect failed."
>     >>>
>     >>> If I stop client and change ip to C and port to D then run it, it
>     >can
>     >>> connect to server successfully.
>     >>>
>     >>> I am using latest libwebsocket version.
>     >>>
>     >>> How can I deal with this situation ? Any advice or something
>     to try
>     >?
>     >>>
>     >>
>     >> I pushed a patch on master that should fix it
>     >>
>     >> https://github.com/warmcat/libwebsockets/commit/ce70d583d457
>     <https://github.com/warmcat/libwebsockets/commit/ce70d583d457>
>     >> 0f6c9c70177a47166c467ff60c7d
>     >>
>     >> Client redirect had rotted a bit anyway, but until this patch
>     it was
>     >also
>     >> missing the ability to redirect between http / https and vice
>     versa;
>     >that
>     >> should now work.
>     >>
>     >> -Andy
>     >>
>     >> Appreciate it.
>     >>>
>     >>> ----FAILED
>     >LOG-------------------------------------------------------
>     >>> [ws_start_service]: websocket service starting ...
>     >>>
>     >>> ====== ws service info ======
>     >>> host=10.70.50.187
>     >>> port=80
>     >>> path=/msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001
>     >>> -0001-0001-000000000008/BUZqudwFqzmwKF8fvMSu9FFb4TmTyqeb6RGf1ijd
>     >>> ==================
>     >>>
>     >>> ws_callback: LWS_CALLBACK_PROTOCOL_INIT
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_ADD_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_WSI_CREATE
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_GET_THREAD_ID
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_GET_THREAD_ID
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER
>     >>> [2017/02/09 13:40:08:4191] NOTICE: Initial logging level 7
>     >>> [2017/02/09 13:40:08:4191] NOTICE: Libwebsockets version: 2.1.0
>     >>> [2017/02/09 13:40:08:4191] NOTICE: IPV6 not compiled in
>     >>> [2017/02/09 13:40:08:4191] NOTICE: libev support not compiled in
>     >>> [2017/02/09 13:40:08:4191] NOTICE: libuv support not compiled in
>     >>> [2017/02/09 13:40:08:4191] NOTICE:  Threads: 4 each 2560 fds
>     >>> [2017/02/09 13:40:08:4193] NOTICE:  mem: platform fd map: 81920
>     >bytes
>     >>> [2017/02/09 13:40:08:4193] NOTICE:  Compiled with OpenSSL support
>     >>> [2017/02/09 13:40:08:4193] NOTICE:  SSL disabled: no
>     >>> LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT
>     >>> [2017/02/09 13:40:08:4193] NOTICE: Creating Vhost 'default'
>     port -1,
>     >1
>     >>> protocols, IPv6 off
>     >>> [2017/02/09 13:40:08:4193] NOTICE:  mem: per-conn:          568
>     >bytes +
>     >>> protocol rx buf
>     >>> [2017/02/09 13:40:08:4193] NOTICE: canonical_hostname =
>     >Mac-mini.local
>     >>> [2017/02/09 13:40:08:4194] ERR: [lws_client_connect_via_info2] 731
>     >call
>     >>> lws_client_connect_2
>     >>> [2017/02/09 13:40:08:4194] ERR: [lws_client_connect_2][18]
>     enter ===
>     >>> [2017/02/09 13:40:08:4194] ERR: [lws_client_connect_2] 28
>     >>> [2017/02/09 13:40:08:4194] ERR: [lws_client_connect_2] 52 not
>     proxy
>     >>> [2017/02/09 13:40:08:4194] ERR: [lws_client_connect_2] 60 socket
>     >>> server_addr4.sin_port=80
>     >>> [2017/02/09 13:40:08:4194] ERR: [lws_client_connect_2] 67
>     >ads=10.70.50.187
>     >>> [2017/02/09 13:40:08:4194] ERR: [lws_client_connect_2] 119
>     >>> [2017/02/09 13:40:08:4203] ERR: [lws_client_connect_2] 173 socket
>     >invalid
>     >>> = null
>     >>> [2017/02/09 13:40:08:4203] ERR: [lws_client_connect_2] 185 socket
>     >bind
>     >>> again, valid not null !!!
>     >>> [2017/02/09 13:40:08:4213] ERR: [lws_client_connect_2] 193 set
>     >wsi->mode
>     >>> = LWSCM_WSCL_WAITING_CONNECT
>     >>> [2017/02/09 13:40:08:4213] ERR: [lws_client_connect_2] 210 past
>     >here, we
>     >>> can't simply free the structs as error handling as oom4 does.  We
>     >have to
>     >>> run the whole close flow.
>     >>> [2017/02/09 13:40:08:4213] ERR: [lws_client_connect_2] 237 check
>     >again:
>     >>> socket valid o
>     >>> [2017/02/09 13:40:08:4214] ERR: [lws_client_connect_2] 245
>     >nonblocking
>     >>> connect retry (errno = 36)
>     >>> [2017/02/09 13:40:08:4214] ERR: [lws_client_connect_2] 262 return
>     >wsi
>     >>> [2017/02/09 13:40:08:4215] ERR: [lws_service_fd_tsi] 1140 call
>     >>> lws_client_socket_service
>     >>> [2017/02/09 13:40:08:4215] ERR: [lws_client_socket_service] 85
>     >>> wsi->mode=34
>     >>> [2017/02/09 13:40:08:4215] ERR: [lws_client_socket_service] 89
>     >>> LWSCM_WSCL_WAITING_CONNECT=34, call lws_client_connect_2
>     >>> [2017/02/09 13:40:08:4215] ERR: we are under
>     >>> PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE timeout protection set in
>     >>> client-handshake.c
>     >>> [2017/02/09 13:40:08:4215] ERR: [lws_client_connect_2][18]
>     enter ===
>     >>> [2017/02/09 13:40:08:4215] ERR: [lws_client_connect_2] 28
>     >>> [2017/02/09 13:40:08:4215] ERR: [lws_client_connect_2] 52 not
>     proxy
>     >>> [2017/02/09 13:40:08:4215] ERR: [lws_client_connect_2] 60 socket
>     >>> server_addr4.sin_port=80
>     >>> [2017/02/09 13:40:08:4215] ERR: [lws_client_connect_2] 67
>     >ads=10.70.50.187
>     >>> [2017/02/09 13:40:08:4215] ERR: [lws_client_connect_2] 119
>     >>> [2017/02/09 13:40:08:4219] ERR: [lws_client_connect_2] 225 socket
>     >valid
>     >>> not null
>     >>> [2017/02/09 13:40:08:4220] ERR: [lws_client_connect_2] 237 check
>     >again:
>     >>> socket valid o
>     >>> [2017/02/09 13:40:08:4220] ERR: [lws_client_connect_2] 272
>     connected
>     >>> [2017/02/09 13:40:08:4220] ERR: [lws_service_fd_tsi] 1140 call
>     >>> lws_client_socket_service
>     >>> [2017/02/09 13:40:08:4220] ERR: [lws_client_socket_service] 85
>     >>> wsi->mode=36
>     >>> [2017/02/09 13:40:08:4220] ERR: [lws_client_socket_service] 144
>     >>> LWSCM_WSCL_ISSUE_HANDSHAKE
>     >>> [2017/02/09 13:40:08:4312] ERR: [lws_service_fd_tsi] 1143 goto
>     >handled
>     >>> [2017/02/09 13:40:08:4312] ERR: [lws_service_fd_tsi] 1143 goto
>     >handled
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_DEL_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_ADD_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_WSI_CREATE
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_GET_THREAD_ID
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CLIENT_CONNECTION_ERROR
>     >>> [ws_callback] Connect with server error: HS: Redirect failed
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_DEL_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> [2017/02/09 13:40:08:4361] ERR: [lws_service_fd_tsi] 1140 call
>     >>> lws_client_socket_service
>     >>> [2017/02/09 13:40:08:4361] ERR: [lws_client_socket_service] 85
>     >>> wsi->mode=40
>     >>> [2017/02/09 13:40:08:4361] ERR: [lws_client_socket_service] 247
>     >>> LWSCM_WSCL_WAITING_SERVER_REPLY
>     >>> [2017/02/09 13:40:08:4365] ERR: [lws_client_socket_service]
>     315 call
>     >>> lws_client_interpret_server_handshake
>     >>> [2017/02/09 13:40:08:4365] ERR:
>     >[lws_client_interpret_server_handshake]
>     >>> 470 http_response=301
>     >>> [2017/02/09 13:40:08:4365] ERR:
>     >[lws_client_interpret_server_handshake]
>     >>> 485 call lws_client_reset, ads=10.70.50.187, port=8080,
>     >>> path=msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001-
>     >>> 0001-0001-000000000008/BUZqudwFqzmwKF8fvMSu9FFb4TmTyqeb6RGf1ijd
>     >>> [2017/02/09 13:40:08:4366] NOTICE: [lws_client_reset] 392 redirect
>     >>> ads='10.70.50.187', port=8080, path='msg/fa07c9f0-d2ed-4636-8
>     >>> 3ad-d6f3bee0f452/00000000-0001-0001-0001-000000000008/BUZqud
>     >>> wFqzmwKF8fvMSu9FFb4TmTyqeb6RGf1ijd'
>     >>> [2017/02/09 13:40:08:4366] NOTICE: [lws_client_reset] 410 call
>     >>> lws_client_connect_2
>     >>> [2017/02/09 13:40:08:4366] ERR: [lws_client_connect_2][18]
>     enter ===
>     >>> [2017/02/09 13:40:08:4366] ERR: [lws_client_connect_2] 28
>     >>> [2017/02/09 13:40:08:4366] ERR: [lws_client_connect_2] 52 not
>     proxy
>     >>> [2017/02/09 13:40:08:4366] ERR: [lws_client_connect_2] 60 socket
>     >>> server_addr4.sin_port=8080
>     >>> [2017/02/09 13:40:08:4366] ERR: [lws_client_connect_2] 67
>     >ads=10.70.50.187
>     >>> [2017/02/09 13:40:08:4366] ERR: [lws_client_connect_2] 119
>     >>> [2017/02/09 13:40:08:4370] ERR: [lws_client_connect_2] 173 socket
>     >invalid
>     >>> = null
>     >>> [2017/02/09 13:40:08:4370] ERR: [lws_client_connect_2] 185 socket
>     >bind
>     >>> again, valid not null !!!
>     >>> [2017/02/09 13:40:08:4370] ERR: [lws_client_connect_2] 193 set
>     >wsi->mode
>     >>> = LWSCM_WSCL_WAITING_CONNECT
>     >>> [2017/02/09 13:40:08:4370] ERR: [lws_client_connect_2] 210 past
>     >here, we
>     >>> can't simply free the structs as error handling as oom4 does.  We
>     >have to
>     >>> run the whole close flow.
>     >>> [2017/02/09 13:40:08:4371] ERR: [lws_client_connect_2] 237 check
>     >again:
>     >>> socket valid o
>     >>> [2017/02/09 13:40:08:4371] ERR: [lws_client_connect_2] 245
>     >nonblocking
>     >>> connect retry (errno = 36)
>     >>> [2017/02/09 13:40:08:4371] ERR: [lws_client_connect_2] 262 return
>     >wsi
>     >>> [2017/02/09 13:40:08:4371] ERR:
>     >[lws_client_interpret_server_handshake]
>     >>> 487 Redirect failed
>     >>> [2017/02/09 13:40:08:4371] ERR:
>     >[lws_client_interpret_server_handshake]
>     >>> 488 check wsi->mode=34
>     >>> ws_callback: LWS_CALLBACK_WSI_DESTROY
>     >>> [2017/02/09 13:40:08:4387] ERR: [lws_service_fd_tsi] 1142 retrun 1
>     >>>
>     >>> ----SUCCESS
>     >LOG-------------------------------------------------------
>     >>> [ws_start_service]: websocket service starting ...
>     >>>
>     >>> ====== ws service info ======
>     >>> host=10.70.50.187
>     >>> port=8080
>     >>> path=/msg/fa07c9f0-d2ed-4636-83ad-d6f3bee0f452/00000000-0001
>     >>> -0001-0001-000000000008/BUZqudwFqzmwKF8fvMSu9FFb4TmTyqeb6RGf1ijd
>     >>> ==================
>     >>>
>     >>> ws_callback: LWS_CALLBACK_PROTOCOL_INIT
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_ADD_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_WSI_CREATE
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_GET_THREAD_ID
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_GET_THREAD_ID
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_LOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CHANGE_MODE_POLL_FD
>     >>> ws_callback: LWS_CALLBACK_UNLOCK_POLL
>     >>> ws_callback: LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER
>     >>> [2017/02/09 13:38:17:8137] NOTICE: Initial logging level 7
>     >>> [2017/02/09 13:38:17:8137] NOTICE: Libwebsockets version: 2.1.0
>     >>> [2017/02/09 13:38:17:8137] NOTICE: IPV6 not compiled in
>     >>> [2017/02/09 13:38:17:8137] NOTICE: libev support not compiled in
>     >>> [2017/02/09 13:38:17:8137] NOTICE: libuv support not compiled in
>     >>> [2017/02/09 13:38:17:8138] NOTICE:  Threads: 4 each 2560 fds
>     >>> [2017/02/09 13:38:17:8140] NOTICE:  mem: platform fd map: 81920
>     >bytes
>     >>> [2017/02/09 13:38:17:8143] NOTICE:  Compiled with OpenSSL support
>     >>> [2017/02/09 13:38:17:8143] NOTICE:  SSL disabled: no
>     >>> LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT
>     >>> [2017/02/09 13:38:17:8143] NOTICE: Creating Vhost 'default'
>     port -1,
>     >1
>     >>> protocols, IPv6 off
>     >>> [2017/02/09 13:38:17:8143] NOTICE:  mem: per-conn:          568
>     >bytes +
>     >>> protocol rx buf
>     >>> [2017/02/09 13:38:17:8145] NOTICE: canonical_hostname =
>     >Mac-mini.local
>     >>> [2017/02/09 13:38:17:8147] ERR: [lws_client_connect_via_info2] 731
>     >call
>     >>> lws_client_connect_2
>     >>> [2017/02/09 13:38:17:8150] ERR: [lws_client_connect_2][18]
>     enter ===
>     >>> [2017/02/09 13:38:17:8150] ERR: [lws_client_connect_2] 28
>     >>> [2017/02/09 13:38:17:8150] ERR: [lws_client_connect_2] 52 not
>     proxy
>     >>> [2017/02/09 13:38:17:8150] ERR: [lws_client_connect_2] 60 socket
>     >>> server_addr4.sin_port=8080
>     >>> [2017/02/09 13:38:17:8150] ERR: [lws_client_connect_2] 67
>     >ads=10.70.50.187
>     >>> [2017/02/09 13:38:17:8150] ERR: [lws_client_connect_2] 119
>     >>> [2017/02/09 13:38:17:8161] ERR: [lws_client_connect_2] 173 socket
>     >invalid
>     >>> = null
>     >>> [2017/02/09 13:38:17:8162] ERR: [lws_client_connect_2] 185 socket
>     >bind
>     >>> again, valid not null !!!
>     >>> [2017/02/09 13:38:17:8170] ERR: [lws_client_connect_2] 193 set
>     >wsi->mode
>     >>> = LWSCM_WSCL_WAITING_CONNECT
>     >>> [2017/02/09 13:38:17:8171] ERR: [lws_client_connect_2] 210 past
>     >here, we
>     >>> can't simply free the structs as error handling as oom4 does.  We
>     >have to
>     >>> run the whole close flow.
>     >>> [2017/02/09 13:38:17:8171] ERR: [lws_client_connect_2] 237 check
>     >again:
>     >>> socket valid o
>     >>> [2017/02/09 13:38:17:8171] ERR: [lws_client_connect_2] 245
>     >nonblocking
>     >>> connect retry (errno = 36)
>     >>> [2017/02/09 13:38:17:8171] ERR: [lws_client_connect_2] 262 return
>     >wsi
>     >>> [2017/02/09 13:38:17:8172] ERR: [lws_service_fd_tsi] 1140 call
>     >>> lws_client_socket_service
>     >>> [2017/02/09 13:38:17:8172] ERR: [lws_client_socket_service] 85
>     >>> wsi->mode=34
>     >>> [2017/02/09 13:38:17:8172] ERR: [lws_client_socket_service] 89
>     >>> LWSCM_WSCL_WAITING_CONNECT=34, call lws_client_connect_2
>     >>> [2017/02/09 13:38:17:8173] ERR: we are under
>     >>> PENDING_TIMEOUT_SENT_CLIENT_HANDSHAKE timeout protection set in
>     >>> client-handshake.c
>     >>> [2017/02/09 13:38:17:8173] ERR: [lws_client_connect_2][18]
>     enter ===
>     >>> [2017/02/09 13:38:17:8173] ERR: [lws_client_connect_2] 28
>     >>> [2017/02/09 13:38:17:8173] ERR: [lws_client_connect_2] 52 not
>     proxy
>     >>> [2017/02/09 13:38:17:8173] ERR: [lws_client_connect_2] 60 socket
>     >>> server_addr4.sin_port=8080
>     >>> [2017/02/09 13:38:17:8173] ERR: [lws_client_connect_2] 67
>     >ads=10.70.50.187
>     >>> [2017/02/09 13:38:17:8173] ERR: [lws_client_connect_2] 119
>     >>> [2017/02/09 13:38:17:8177] ERR: [lws_client_connect_2] 225 socket
>     >valid
>     >>> not null
>     >>> [2017/02/09 13:38:17:8177] ERR: [lws_client_connect_2] 237 check
>     >again:
>     >>> socket valid o
>     >>> [2017/02/09 13:38:17:8177] ERR: [lws_client_connect_2] 272
>     connected
>     >>> [2017/02/09 13:38:17:8177] ERR: [lws_service_fd_tsi] 1140 call
>     >>> lws_client_socket_service
>     >>> [2017/02/09 13:38:17:8177] ERR: [lws_client_socket_service] 85
>     >>> wsi->mode=36
>     >>> [2017/02/09 13:38:17:8177] ERR: [lws_client_socket_service] 144
>     >>> LWSCM_WSCL_ISSUE_HANDSHAKE
>     >>> [2017/02/09 13:38:17:8222] ERR: [lws_service_fd_tsi] 1143 goto
>     >handled
>     >>> [2017/02/09 13:38:17:8223] ERR: [lws_service_fd_tsi] 1143 goto
>     >handled
>     >>> [2017/02/09 13:38:17:8336] ERR: [lws_service_fd_tsi] 1140 call
>     >>> lws_client_socket_service
>     >>> [2017/02/09 13:38:17:8336] ERR: [lws_client_socket_service] 85
>     >>> wsi->mode=40
>     >>> [2017/02/09 13:38:17:8336] ERR: [lws_client_socket_service] 247
>     >>> LWSCM_WSCL_WAITING_SERVER_REPLY
>     >>> [2017/02/09 13:38:17:8338] ERR: [lws_client_socket_service]
>     315 call
>     >>> lws_client_interpret_server_handshake
>     >>> [2017/02/09 13:38:17:8339] ERR:
>     >[lws_client_interpret_server_handshake]
>     >>> 470 http_response=101
>     >>> [2017/02/09 13:38:17:8339] ERR:
>     >[lws_client_interpret_server_handshake]
>     >>> 864 set LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH
>     >>> [2017/02/09 13:38:17:8339] ERR: [lws_service_fd_tsi] 1143 goto
>     >handled
>     >>> ws_callback: LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH
>     >>> ws_callback: LWS_CALLBACK_CLIENT_ESTABLISHED
>     >>> [ws_callback] Connect with server success.
>     >>>
>     >----------------------------------------------------------------------
>     >>>
>     >>> Wayne
>     >>>
>     >>>
>     >>> _______________________________________________
>     >>> Libwebsockets mailing list
>     >>> Libwebsockets at ml.libwebsockets.org
>     <mailto:Libwebsockets at ml.libwebsockets.org>
>     >>> https://libwebsockets.org/mailman/listinfo/libwebsockets
>     <https://libwebsockets.org/mailman/listinfo/libwebsockets>
>     >>>
>     >>
>     >>
>
>     --
>     Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
>




More information about the Libwebsockets mailing list