[Libwebsockets] [libwebsockets] #95: Reading client IPAddress within library

Trac trac at libwebsockets.org
Thu Nov 27 01:38:53 CET 2014


#95: Reading client IPAddress within library
------------------------------------+------------------------
  Reporter:  Shantanuk              |      Owner:
      Type:  task                   |     Status:  new
  Priority:  major                  |  Milestone:  milestone1
 Component:  libwebsockets library  |    Version:  1.0
Resolution:                         |   Keywords:
------------------------------------+------------------------

Comment (by agreen):

 1)
  *      LWS_CALLBACK_FILTER_NETWORK_CONNECTION: called when a client
 connects to
  *              the server at network level; the connection is accepted
 but then
  *              passed to this callback to decide whether to hang up
 immediately
  *              or not, based on the client IP.  @in contains the
 connection
  *              socket's descriptor. Since the client connection
 information is
  *              not available yet, @wsi still pointing to the main server
 socket.
  *              Return non-zero to terminate the connection before sending
 or
  *              receiving anything. Because this happens immediately after
 the
  *              network connection from the client, there's no websocket
 protocol
  *              selected yet so this callback is issued only to protocol
 0.

 2)

 Yes URI args are split out into their own "header"
 WSI_TOKEN_HTTP_URI_ARGS.  See the test server sources for how to access
 headers -- but notice http headers are deleted before the WS connection is
 established, so you have to read them at an earlier callback like
 LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION.

--
Ticket URL: <http://libwebsockets.org/trac/libwebsockets/ticket/95#comment:1>
libwebsockets <http://libwebsockets.org>
libwebsockets C library



More information about the Libwebsockets mailing list