Coder Social home page Coder Social logo

warmcat / libwebsockets Goto Github PK

View Code? Open in Web Editor NEW
4.6K 222.0 1.4K 43.64 MB

canonical libwebsockets.org networking library

Home Page: https://libwebsockets.org

License: Other

Makefile 0.32% CMake 2.40% C 95.13% HTML 0.21% Shell 0.24% NSIS 0.02% C++ 0.65% Java 0.11% JavaScript 0.77% CSS 0.11% Roff 0.03% Standard ML 0.01%
websockets c-library portable-library client-server lightweight libwebsockets c embeddable libuv libev

libwebsockets's People

Contributors

abruines avatar amery avatar catalinr-m avatar davidgaleano avatar dbrnz avatar dosvald avatar edwin-oetelaar avatar ffontaine avatar fgasper avatar hashok avatar huming2207 avatar jedlu avatar joakimsoderberg avatar jwinarske avatar kristjanvalur avatar lws-team avatar mmilata avatar ondraco avatar orefkov avatar orgads avatar paroga avatar pavelxdd avatar perbothner avatar ppentchev avatar ralight avatar stephaneberle9 avatar stv0g avatar wonder-mice avatar zbroyar avatar zhiwenzheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libwebsockets's Issues

multipart data isn't fully received

I'm trying to upload files through multipart post data. However, when I upload a small file, everything is correctly received:

-----------------------------277742668829600
Content-Disposition:_form-data;_name] => foo


-----------------------------277742668829600
Content-Disposition: form-data; name=bar


-----------------------------277742668829600
Content-Disposition: form-data; name=file; filename=pilight-daemon.log
Content-Type: text/x-log

[Feb 04 22:56:19:214947] pilight-daemon: INFO: version 1.0, commit 
[Feb 04 22:56:19:219218] pilight-daemon: INFO: daemon started with pid: 25474
[Feb 04 22:56:52:856989] pilight-daemon: INFO: version 1.0, commit 
[Feb 04 22:56:52:861514] pilight-daemon: INFO: daemon started with pid: 25481
[Feb 04 22:57:16:968080] pilight-daemon: INFO: version 1.0, commit 
[Feb 04 22:57:16:974103] pilight-daemon: INFO: webserver listening to port: 81
[Feb 04 22:57:16:975695] pilight-daemon: INFO: daemon started with pid: 25488
-----------------------------277742668829600
Content-Disposition: form-data; name=submit

Submit
-----------------------------277742668829600--

But, when i send bigger files, the LWS_CALLBACK_HTTP_BODY gets truncated:

-----------------------------26044251201657
Content-Disposition:_form-data;_name] => foo


-----------------------------26044251201657
Content-Disposition: form-data; name=bar


-----------------------------26044251201657
Content-Disposition: form-data; name=file; filename=progressbar.gif
Content-Type: image/gif

GIF89aÜ

Add some getters.

Can we add some getters to imitate libwebsocket_callback_on_writable_all_protocol without using the private header (to go trough all connections and check if a flag is set in the user_space):

HEADER:
LWS_VISIBLE void *
libwebsockets_get_user_space(struct libwebsocket *wsi);

LWS_VISIBLE int
libwebsockets_get_fd_count(struct libwebsocket_context *context);

LWS_VISIBLE struct libwebsocket *
libwebsockets_get_wsi_at_index(struct libwebsocket_context *context, int index);

IMPLEMENTATION:

LWS_VISIBLE void *
libwebsockets_get_user_space(struct libwebsocket *wsi)
{
if (!wsi->protocol)
return NULL;

if (!wsi->protocol->per_session_data_size)
    return NULL;

return wsi->user_space;

}

LWS_VISIBLE int
libwebsockets_get_fd_count(struct libwebsocket_context *context)
{
return context->fds_count;
}

LWS_VISIBLE struct libwebsocket *
libwebsockets_get_wsi_at_index(struct libwebsocket_context *context, int index)
{
if (index >= context->fds_count)
{
return NULL;
}

return context->lws_lookup[context->fds[index].fd];

}

libwebsocket_write(): Unable to spill ext

I am getting the following printout error when I call libwebwsocket_write() for the first time.

[1374954782:4840] ERR: Unable to spill ext 7669 vs 5792

From tracing the code a little the error feels like I am trying to write too much in a message. However, i didn't think there was a limit on the message size.

Can you clue me into the meaning of the "unable to spill ext" error?

undefined reference to `inet_ntop'

when compiling the actual libwebsockets master branch with
MinGW-w64 (gcc 4.8.2) & CMake 2.8.12.2 on Win7 via

cmake .. -G "MinGW Makefiles" -DLWS_WITH_SSL=0 -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=1
mingw32-make.exe

the compilation fails at the make step with the error:

lib\libwebsockets_static.a(libwebsockets.c.obj):libwebsockets.c:
(.text+0x11cd):undefined reference to `inet_ntop'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\test-client.dir\build.make:169:
recipe for target 'bin/libwebsockets-test-client.exe' failed
mingw32-make.exe[2]: *** [bin/libwebsockets-test-client.exe] Error 1

Adding a timeout crashes LWS (+ pull request)

I just got into a situation where I think I found a bug in libwebsockets -- but it may also be a misunderstanding of the timeout mechanism, so any feedback is valid.

The idea here was to use libwebsockets timeouts to drop clients who never request anything (but keep the TCP session open), so they can not hold a file descriptor for too long, making poll queue longer, etc.

To get into this situation, run an unmodified libwebsockets-test-server, fire up a telnet to the address/port, and do nothing more -- the TCP session will remain open indefinitely. For comparison, do the same to an Apache/nginx webserver -- it will drop the connection after a while, freeing up the resources.

My approach was to set a timeout when the connection is established at network level (in callback LWS_CALLBACK_FILTER_NETWORK_CONNECTION) and remove it once a request or this socket is made in callback LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION -- see the branch I linked bellow for the sample code --, dropping any client who does nothing but hold a file descriptor for too long. I'm not dropping connections after the request is completed because my real application will handle timeouts after this point.

The problem is LWS also times out the main control socket, closing and removing it from the FD lookup table. In the next iteration, the library will try to index in and crash.

I'm not sure if I'm using the timeouts it the right way, but I'm searching a solution for this.

I pushed a branch to demonstrate the (possible) bug with lws-test-server: ittner@bc79fee

Also, follows the GDB traces pointing to it:

Program received signal SIGSEGV, Segmentation fault.
libwebsocket_service_fd (context=0x617010, pollfd=0x0)
    at /home/ittner/projetos/websocket-tests/libwebsockets/lib/libwebsockets.c:922
922                     listen_socket_fds_index = context->lws_lookup[
(gdb) bt
#0  libwebsocket_service_fd (context=0x617010, pollfd=0x0)
    at /home/ittner/projetos/websocket-tests/libwebsockets/lib/libwebsockets.c:922
#1  0x0000000000407dfa in libwebsocket_service (context=0x617010, timeout_ms=<optimized out>)
    at /home/ittner/projetos/websocket-tests/libwebsockets/lib/libwebsockets.c:1369
#2  0x0000000000403a75 in main (argc=<optimized out>, argv=<optimized out>)
    at /home/ittner/projetos/websocket-tests/libwebsockets/test-server/test-server.c:957
(gdb) list
917             int more = 1;
918     #endif
919             struct lws_tokens eff_buf;
920
921             if (context->listen_service_fd)
922                     listen_socket_fds_index = context->lws_lookup[
923                                  context->listen_service_fd]->position_in_fds_table;
924
925             /*
926              * you can call us with pollfd = NULL to just allow the once-per-second
(gdb) up
#1  0x0000000000407dfa in libwebsocket_service (context=0x617010, timeout_ms=<optimized out>)
    at /home/ittner/projetos/websocket-tests/libwebsockets/lib/libwebsockets.c:1369
1369                    libwebsocket_service_fd(context, NULL);
(gdb) list
1364            lws_idling_ppoll_tid = 0;
1365    #else
1366            n = poll(context->fds, context->fds_count, timeout_ms);
1367    #endif
1368            if (n == 0) /* poll timeout */ {
1369                    libwebsocket_service_fd(context, NULL);
1370                    return 0;
1371            }
1372
1373            if (n < 0) {
(gdb) up
#2  0x0000000000403a75 in main (argc=<optimized out>, argv=<optimized out>)
    at /home/ittner/projetos/websocket-tests/libwebsockets/test-server/test-server.c:957
957                     n = libwebsocket_service(context, 50);
(gdb) list
952                      *
953                      * If no socket needs service, it'll return anyway after
954                      * the number of ms in the second argument.
955                      */
956   
957                     n = libwebsocket_service(context, 50);
958     #endif
959             }
960   
961     #ifdef EXTERNAL_POLL
(gdb) up
Initial frame selected; you cannot go up.




(gdb) print context->listen_service_fd
$1 = 9
(gdb) print context->lws_lookup[9]
$2 = (struct libwebsocket *) 0x0

Comparing HTTP header field names is not case-insensitive.

Description:
According to RFC2616, all header field names in both HTTP requests and HTTP responses are case-insensitive. But libwebsockets uses a case-sensitive compare.

Reproduce:
Run libwebsockets against a server that sends all of its HTTP header field names in lower-case (for example: https://github.com/extend/cowboy). libwebsockets reports an error. The expected behavior is no errors reported and a successful handshake procedure.

Present at least in commit: dae94d8

vs2010 build error

libWebSockets - github 8/4/14 12.42pm GMT
CMake 2.9.12.2 - default config
Visual Studio 2010 Ult
Win7 Ult x64

Both debug/Release:

3>..\lib\client.c(154): error C2143: syntax error : missing ';' before 'const'

Quickfix: wrap the 3 lines 154-156 within a scope {}

pkg-config file libwebsockets.pc doesn't include version number

On Unix, libwebsockets.pc is installed. But it doesn't specify the version number; it's blank. E.g.:

prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libwebsockets
Description: Websockets server and client library
Version: 

Libs: -L${libdir} -lwebsockets

It would be good to put the version number in the Version: line.

test-client Connect to jetty/tomcat failed

test-client connect to test-server is ok, but connect to jetty/tomcat server failed. the web server is supported the websocket client of chrome.
jetty: 8.1.12
tomcat: 7.0.39

Compiling on windows

I made a visual studio 2013 project via cmake.

Then built it in VS, but get 58 errors and 63 warnings.

What have I done wrong?

Error list:

Warning 1   warning LNK4006: _gzdopen already defined in gzlib.obj; second definition ignored   C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 2   warning LNK4006: _gzsetparams already defined in gzwrite.obj; second definition ignored C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 3   warning LNK4006: _gzread already defined in gzread.obj; second definition ignored   C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 4   warning LNK4006: _gzwrite already defined in gzwrite.obj; second definition ignored C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 5   warning LNK4006: _gzprintf already defined in gzwrite.obj; second definition ignored    C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 6   warning LNK4006: _gzputs already defined in gzwrite.obj; second definition ignored  C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 7   warning LNK4006: _gzgets already defined in gzread.obj; second definition ignored   C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 8   warning LNK4006: _gzputc already defined in gzwrite.obj; second definition ignored  C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 9   warning LNK4006: _gzgetc already defined in gzread.obj; second definition ignored   C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 10  warning LNK4006: _gzungetc already defined in gzread.obj; second definition ignored C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 11  warning LNK4006: _gzflush already defined in gzwrite.obj; second definition ignored C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 12  warning LNK4006: _gzrewind already defined in gzlib.obj; second definition ignored  C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 13  warning LNK4006: _gzeof already defined in gzlib.obj; second definition ignored C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 14  warning LNK4006: _gzerror already defined in gzlib.obj; second definition ignored   C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 15  warning LNK4006: _gzclearerr already defined in gzlib.obj; second definition ignored    C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 16  warning LNK4006: _gzopen already defined in gzlib.obj; second definition ignored    C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 17  warning LNK4006: _gzseek already defined in gzlib.obj; second definition ignored    C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 18  warning LNK4006: _gztell already defined in gzlib.obj; second definition ignored    C:\Users\Wesley\Desktop\output\gzio.obj ZLIB
Warning 19  warning LNK4006: _gzclose already defined in gzio.obj; second definition ignored    C:\Users\Wesley\Desktop\output\gzclose.obj  ZLIB
Warning 20  warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library  C:\Users\Wesley\Desktop\output\gzclose.obj  ZLIB
Error   21  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   22  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   23  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   24  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Warning 25  warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data   C:\Users\Wesley\Desktop\libwebsockets\lib\service.c 253 1   websockets
Error   26  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   27  error C2065: '__func__' : undeclared identifier C:\Users\Wesley\Desktop\libwebsockets\lib\pollfd.c  98  1   websockets
Error   28  error C2065: '__func__' : undeclared identifier C:\Users\Wesley\Desktop\libwebsockets\lib\pollfd.c  206 1   websockets
Error   29  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Warning 30  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  58  1   websockets
Warning 31  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  64  1   websockets
Warning 32  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  71  1   websockets
Warning 33  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  158 1   websockets
Warning 34  warning C4244: '=' : conversion from 'short' to 'unsigned char', possible loss of data  C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  337 1   websockets
Error   35  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Warning 36  warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c 132 1   websockets
Warning 37  warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c 376 1   websockets
Warning 38  warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c 471 1   websockets
Warning 39  warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c 478 1   websockets
Error   40  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   41  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   42  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Warning 43  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\client.c  36  1   websockets
Error   44  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   45  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   46  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   47  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Warning 48  warning C4244: '=' : conversion from 'long' to 'SHORT', possible loss of data   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    143 1   websockets
Error   49  error C2079: 'alive' uses undefined struct 'tcp_keepalive'  C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    158 1   websockets
Error   50  error C2224: left of '.onoff' must have struct/union type   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    168 1   websockets
Error   51  error C2224: left of '.keepalivetime' must have struct/union type   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    169 1   websockets
Error   52  error C2224: left of '.keepaliveinterval' must have struct/union type   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    170 1   websockets
Error   53  error C2065: 'SIO_KEEPALIVE_VALS' : undeclared identifier   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    172 1   websockets
Warning 54  warning C4133: 'function' : incompatible types - from 'int *' to 'const char *' C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    180 1   websockets
Error   55  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   56  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   57  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   58  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   59  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets
Error   60  error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'   C:\Users\Wesley\Desktop\output\LINK test-client
Warning 61  warning C4013: 'getpid' undefined; assuming extern returning int    C:\Users\Wesley\Desktop\libwebsockets\test-server\test-echo.c   106 1   test-echo
Warning 62  warning C4013: 'gettimeofday' undefined; assuming extern returning int  C:\Users\Wesley\Desktop\libwebsockets\test-server\test-echo.c   339 1   test-echo
Error   63  error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'   C:\Users\Wesley\Desktop\output\LINK test-echo
Warning 64  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\test-server\test-fraggle.c    102 1   test-fraggle
Warning 65  warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data  C:\Users\Wesley\Desktop\libwebsockets\test-server\test-fraggle.c    188 1   test-fraggle
Warning 66  warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data  C:\Users\Wesley\Desktop\libwebsockets\test-server\test-fraggle.c    189 1   test-fraggle
Warning 67  warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data  C:\Users\Wesley\Desktop\libwebsockets\test-server\test-fraggle.c    190 1   test-fraggle
Error   68  error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'   C:\Users\Wesley\Desktop\output\LINK test-fraggle
Warning 69  warning C4013: 'gettimeofday' undefined; assuming extern returning int  C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c   154 1   test-ping
Warning 70  warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data  C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c   229 1   test-ping
Warning 71  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c   233 1   test-ping
Warning 72  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c   270 1   test-ping
Warning 73  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c   276 1   test-ping
Warning 74  warning C4244: '=' : conversion from 'double' to 'unsigned int', possible loss of data  C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c   378 1   test-ping
Error   75  error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'   C:\Users\Wesley\Desktop\output\LINK test-ping
Warning 76  warning C4013: 'gettimeofday' undefined; assuming extern returning int  C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c 313 1   test-server
Warning 77  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c 615 1   test-server
Error   78  error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'   C:\Users\Wesley\Desktop\output\LINK test-server
Warning 79  warning C4013: 'gettimeofday' undefined; assuming extern returning int  C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c 313 1   test-server-extpoll
Warning 80  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c 615 1   test-server-extpoll
Warning 81  warning C4133: 'function' : incompatible types - from 'pollfd *' to 'libwebsocket_pollfd *' C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c 930 1   test-server-extpoll
Error   82  error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'   C:\Users\Wesley\Desktop\output\LINK test-server-extpoll
Error   83  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   84  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   85  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   86  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Warning 87  warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data   C:\Users\Wesley\Desktop\libwebsockets\lib\service.c 253 1   websockets_shared
Error   88  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   89  error C2065: '__func__' : undeclared identifier C:\Users\Wesley\Desktop\libwebsockets\lib\pollfd.c  98  1   websockets_shared
Error   90  error C2065: '__func__' : undeclared identifier C:\Users\Wesley\Desktop\libwebsockets\lib\pollfd.c  206 1   websockets_shared
Error   91  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Warning 92  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  58  1   websockets_shared
Warning 93  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  64  1   websockets_shared
Warning 94  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  71  1   websockets_shared
Warning 95  warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  158 1   websockets_shared
Warning 96  warning C4244: '=' : conversion from 'short' to 'unsigned char', possible loss of data  C:\Users\Wesley\Desktop\libwebsockets\lib\output.c  337 1   websockets_shared
Error   97  error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Warning 98  warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c 132 1   websockets_shared
Warning 99  warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c 376 1   websockets_shared
Warning 100 warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c 471 1   websockets_shared
Warning 101 warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c 478 1   websockets_shared
Error   102 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   103 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   104 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Warning 105 warning C4018: '<' : signed/unsigned mismatch   C:\Users\Wesley\Desktop\libwebsockets\lib\client.c  36  1   websockets_shared
Error   106 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   107 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   108 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   109 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Warning 110 warning C4244: '=' : conversion from 'long' to 'SHORT', possible loss of data   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    143 1   websockets_shared
Error   111 error C2079: 'alive' uses undefined struct 'tcp_keepalive'  C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    158 1   websockets_shared
Error   112 error C2224: left of '.onoff' must have struct/union type   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    168 1   websockets_shared
Error   113 error C2224: left of '.keepalivetime' must have struct/union type   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    169 1   websockets_shared
Error   114 error C2224: left of '.keepaliveinterval' must have struct/union type   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    170 1   websockets_shared
Error   115 error C2065: 'SIO_KEEPALIVE_VALS' : undeclared identifier   C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    172 1   websockets_shared
Warning 116 warning C4133: 'function' : incompatible types - from 'int *' to 'const char *' C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c    180 1   websockets_shared
Error   117 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   118 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   119 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   120 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared
Error   121 error C2373: 'inet_ntop' : redefinition; different type modifiers   C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h   548 1   websockets_shared

Output:


------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
  Checking Build System
  CMake does not need to re-run because C:/Users/Wesley/Desktop/output/CMakeFiles/generate.stamp is up-to-date.
------ Build started: Project: ZLIB, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  adler32.c
  compress.c
  crc32.c
  deflate.c
  gzclose.c
  gzio.c
  gzlib.c
  gzread.c
  gzwrite.c
  infback.c
  inffast.c
  inflate.c
  inftrees.c
  trees.c
  uncompr.c
  zutil.c
  Generating Code...
gzio.obj : warning LNK4006: _gzdopen already defined in gzlib.obj; second definition ignored
gzio.obj : warning LNK4006: _gzsetparams already defined in gzwrite.obj; second definition ignored
gzio.obj : warning LNK4006: _gzread already defined in gzread.obj; second definition ignored
gzio.obj : warning LNK4006: _gzwrite already defined in gzwrite.obj; second definition ignored
gzio.obj : warning LNK4006: _gzprintf already defined in gzwrite.obj; second definition ignored
gzio.obj : warning LNK4006: _gzputs already defined in gzwrite.obj; second definition ignored
gzio.obj : warning LNK4006: _gzgets already defined in gzread.obj; second definition ignored
gzio.obj : warning LNK4006: _gzputc already defined in gzwrite.obj; second definition ignored
gzio.obj : warning LNK4006: _gzgetc already defined in gzread.obj; second definition ignored
gzio.obj : warning LNK4006: _gzungetc already defined in gzread.obj; second definition ignored
gzio.obj : warning LNK4006: _gzflush already defined in gzwrite.obj; second definition ignored
gzio.obj : warning LNK4006: _gzrewind already defined in gzlib.obj; second definition ignored
gzio.obj : warning LNK4006: _gzeof already defined in gzlib.obj; second definition ignored
gzio.obj : warning LNK4006: _gzerror already defined in gzlib.obj; second definition ignored
gzio.obj : warning LNK4006: _gzclearerr already defined in gzlib.obj; second definition ignored
gzio.obj : warning LNK4006: _gzopen already defined in gzlib.obj; second definition ignored
gzio.obj : warning LNK4006: _gzseek already defined in gzlib.obj; second definition ignored
gzio.obj : warning LNK4006: _gztell already defined in gzlib.obj; second definition ignored
gzclose.obj : warning LNK4006: _gzclose already defined in gzio.obj; second definition ignored
gzclose.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
  ZLIB.vcxproj -> C:\Users\Wesley\Desktop\output\lib\Debug\ZLIB.lib
------ Build started: Project: websockets, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  base64-decode.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  handshake.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  libwebsockets.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  service.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\service.c(253): warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
  pollfd.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\pollfd.c(98): error C2065: '__func__' : undeclared identifier
C:\Users\Wesley\Desktop\libwebsockets\lib\pollfd.c(206): error C2065: '__func__' : undeclared identifier
  output.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(58): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(64): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(71): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(158): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(337): warning C4244: '=' : conversion from 'short' to 'unsigned char', possible loss of data
  parsers.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c(132): warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c(376): warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c(471): warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c(478): warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data
  context.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  sha-1.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  client.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\client.c(36): warning C4018: '<' : signed/unsigned mismatch
  client-handshake.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  client-parser.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  ssl.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  lws-plat-win.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(143): warning C4244: '=' : conversion from 'long' to 'SHORT', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(158): error C2079: 'alive' uses undefined struct 'tcp_keepalive'
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(168): error C2224: left of '.onoff' must have struct/union type
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(169): error C2224: left of '.keepalivetime' must have struct/union type
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(170): error C2224: left of '.keepaliveinterval' must have struct/union type
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(172): error C2065: 'SIO_KEEPALIVE_VALS' : undeclared identifier
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(180): warning C4133: 'function' : incompatible types - from 'int *' to 'const char *'
  server.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  server-handshake.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  extension.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  extension-deflate-frame.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  extension-deflate-stream.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  Generating Code...
------ Build started: Project: test-client, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  test-client.c
  getopt.c
  getopt_long.c
  gettimeofday.c
  Generating Code...
LINK : fatal error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'
------ Build started: Project: test-echo, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  test-echo.c
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-echo.c(106): warning C4013: 'getpid' undefined; assuming extern returning int
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-echo.c(339): warning C4013: 'gettimeofday' undefined; assuming extern returning int
  getopt.c
  getopt_long.c
  gettimeofday.c
  Generating Code...
LINK : fatal error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'
------ Build started: Project: test-fraggle, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  test-fraggle.c
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-fraggle.c(102): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-fraggle.c(188): warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-fraggle.c(189): warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-fraggle.c(190): warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data
  getopt.c
  getopt_long.c
  gettimeofday.c
  Generating Code...
LINK : fatal error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'
------ Build started: Project: test-ping, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  test-ping.c
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c(154): warning C4013: 'gettimeofday' undefined; assuming extern returning int
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c(229): warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c(233): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c(270): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c(276): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-ping.c(378): warning C4244: '=' : conversion from 'double' to 'unsigned int', possible loss of data
  getopt.c
  getopt_long.c
  gettimeofday.c
  Generating Code...
LINK : fatal error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'
------ Build started: Project: test-server, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  test-server.c
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c(313): warning C4013: 'gettimeofday' undefined; assuming extern returning int
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c(615): warning C4018: '<' : signed/unsigned mismatch
  getopt.c
  getopt_long.c
  gettimeofday.c
  Generating Code...
LINK : fatal error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'
------ Build started: Project: test-server-extpoll, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  test-server.c
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c(313): warning C4013: 'gettimeofday' undefined; assuming extern returning int
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c(615): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\test-server\test-server.c(930): warning C4133: 'function' : incompatible types - from 'pollfd *' to 'libwebsocket_pollfd *'
  getopt.c
  getopt_long.c
  gettimeofday.c
  Generating Code...
LINK : fatal error LNK1104: cannot open file 'lib\Debug\websockets_static.lib'
------ Build started: Project: websockets_shared, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  base64-decode.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  handshake.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  libwebsockets.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  service.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\service.c(253): warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
  pollfd.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\pollfd.c(98): error C2065: '__func__' : undeclared identifier
C:\Users\Wesley\Desktop\libwebsockets\lib\pollfd.c(206): error C2065: '__func__' : undeclared identifier
  output.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(58): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(64): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(71): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(158): warning C4018: '<' : signed/unsigned mismatch
C:\Users\Wesley\Desktop\libwebsockets\lib\output.c(337): warning C4244: '=' : conversion from 'short' to 'unsigned char', possible loss of data
  parsers.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c(132): warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c(376): warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c(471): warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\lib\parsers.c(478): warning C4244: '=' : conversion from 'unsigned short' to 'unsigned char', possible loss of data
  context.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  sha-1.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  client.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\client.c(36): warning C4018: '<' : signed/unsigned mismatch
  client-handshake.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  client-parser.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  ssl.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  lws-plat-win.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(143): warning C4244: '=' : conversion from 'long' to 'SHORT', possible loss of data
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(158): error C2079: 'alive' uses undefined struct 'tcp_keepalive'
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(168): error C2224: left of '.onoff' must have struct/union type
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(169): error C2224: left of '.keepalivetime' must have struct/union type
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(170): error C2224: left of '.keepaliveinterval' must have struct/union type
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(172): error C2065: 'SIO_KEEPALIVE_VALS' : undeclared identifier
C:\Users\Wesley\Desktop\libwebsockets\lib\lws-plat-win.c(180): warning C4133: 'function' : incompatible types - from 'int *' to 'const char *'
  server.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  server-handshake.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  extension.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  extension-deflate-frame.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  extension-deflate-stream.c
C:\Program Files (x86)\Windows Kits\8.1\Include\um\ws2tcpip.h(548): error C2373: 'inet_ntop' : redefinition; different type modifiers
          c:\users\wesley\desktop\libwebsockets\lib\private-libwebsockets.h(86) : see declaration of 'inet_ntop'
  Generating Code...
------ Build started: Project: ALL_BUILD, Configuration: Debug Win32 ------
  Building Custom Rule C:/Users/Wesley/Desktop/libwebsockets/CMakeLists.txt
  CMake does not need to re-run because C:\Users\Wesley\Desktop\output\CMakeFiles\generate.stamp is up-to-date.
  Build all projects
------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 ------
Project not selected to build for this solution configuration 
------ Skipped Build: Project: PACKAGE, Configuration: Debug Win32 ------
Project not selected to build for this solution configuration 
------ Skipped Build: Project: dist, Configuration: Debug Win32 ------
Project not selected to build for this solution configuration 
========== Build: 3 succeeded, 8 failed, 0 up-to-date, 3 skipped ==========

unterminated #if in lws-plat-win.c

when compiling the actual libwebsockets master branch with
MinGW-w64 (gcc 4.8.2) & CMake 2.8.12.2 on Win7 via

cmake .. -G "MinGW Makefiles" -DLWS_WITH_SSL=0 -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=1
mingw32-make.exe

the compilation fails at the make step with the error:

D:\MinGW-w64\_home\libwebsockets-master\lib\lws-plat-win.c:4:0:
    error: unterminated #if
        #if defined(WIN32) || defined(_WIN32)
        ^

compile error in output.c: compatible_file_seek_cur(...) , SetFilePointer(...)

when compiling the actual libwebsockets master branch with
MinGW-w64 (gcc 4.8.2) & CMake 2.8.12.2 on Win7 via

cmake .. -G "MinGW Makefiles" -DLWS_WITH_SSL=0 -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=1 -DLWS_IPV6=0
mingw32-make.exe

the compilation fails at the make step with the error:

D:\MinGW-w64\_home\libwebsockets-master\lib\output.c:530:5: error: too few arguments to function 'SetFilePointer'
     compatible_file_seek_cur(wsi->u.http.fd, m - n);
     ^
In file included from
        d:\mingw-w64\mingw32\i686-w64-mingw32\include\winbase.h:18:0,
        d:\mingw-w64\mingw32\i686-w64-mingw32\include\windows.h:70,
        d:\mingw-w64\mingw32\i686-w64-mingw32\include\winsock2.h:23,
        D:\MinGW-w64\_home\libwebsockets-master\lib\private-libwebsockets.h:83,
        D:\MinGW-w64\_home\libwebsockets-master\lib\output.c:22:
d:\mingw-w64\mingw32\i686-w64-mingw32\include\fileapi.h:85:27: note: declared here
    WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
                            ^

WIn 7 - Visual Studio 2010 - 32 bits - Build failed

Hello,

CMake generated a VS2010 solution for me, however it does not build fine:
(I just kept the errors, not the warnings)

1>------ Build started: Project: ZERO_CHECK, Configuration: Release Win32 ------
2>------ Build started: Project: ZLIB, Configuration: Release Win32 ------
3>------ Skipped Build: Project: dist, Configuration: Release Win32 ------
4>------ Build started: Project: websockets, Configuration: Release Win32 ------
5>------ Build started: Project: websockets_shared, Configuration: Release Win32 ------
4>..\lib\libwebsockets.c(2107): error C2065: 'SIGUSR2' : undeclared identifier
4>..\lib\libwebsockets.c(2109): error C2065: 'sigset_t' : undeclared identifier
4>..\lib\libwebsockets.c(2109): error C2146: syntax error : missing ';' before identifier 'mask'
4>..\lib\libwebsockets.c(2109): error C2065: 'mask' : undeclared identifier
4>..\lib\libwebsockets.c(2110): error C2065: 'mask' : undeclared identifier
4>..\lib\libwebsockets.c(2111): error C2065: 'mask' : undeclared identifier
4>..\lib\libwebsockets.c(2111): error C2065: 'SIGUSR2' : undeclared identifier
4>..\lib\libwebsockets.c(2113): error C2065: 'SIG_BLOCK' : undeclared identifier
4>..\lib\libwebsockets.c(2113): error C2065: 'mask' : undeclared identifier
5>..\lib\libwebsockets.c(2107): error C2065: 'SIGUSR2' : undeclared identifier
5>..\lib\libwebsockets.c(2109): error C2065: 'sigset_t' : undeclared identifier
5>..\lib\libwebsockets.c(2109): error C2146: syntax error : missing ';' before identifier 'mask'
5>..\lib\libwebsockets.c(2109): error C2065: 'mask' : undeclared identifier
5>..\lib\libwebsockets.c(2110): error C2065: 'mask' : undeclared identifier
5>..\lib\libwebsockets.c(2111): warning C4013: 'sigaddset' undefined; assuming extern returning int
5>..\lib\libwebsockets.c(2111): error C2065: 'mask' : undeclared identifier
5>..\lib\libwebsockets.c(2111): error C2065: 'SIGUSR2' : undeclared identifier
5>..\lib\libwebsockets.c(2113): error C2065: 'SIG_BLOCK' : undeclared identifier
5>..\lib\libwebsockets.c(2113): error C2065: 'mask' : undeclared identifier

What do I do wrong? I'm not very familiar with SIGUSR2 for instance... isn't it unix-only?

PHP Session ID

I'm using libwebsockets in my pilight home automation server to serve a webgui. This is working perfectly. Currently i'm implementing a php server capability. Until know everything works fine except one thing. When using sessions, PHP is requesting a
Set-Cookie: PHPSESSID=...; path=/
This means php wants me to store the PHPSESSID somewere and serve it with the subsequent calls as
HTTP_COOKIE="PHPSESSID=...;
So it know we are using the same session.

This means that when a user opens a browser sessions, i need the ability to store something for this whole browser session. When i open a new browser instance (e.g. firefox and chrome) i need to be able to store two distinct PHPSESSID. Apache can handle this perfectly, however, i can't get libwebsockets to store something per browser sessions instead of per page session.

Can't use libwebsocket_set_timeout()

I am trying to call libwebsocket_set_timeout(), but it doesn't link (Ubuntu 13.10 64-bit).

I added LWS_VISIBLE to the libwebsocket_set_timeout() definition in libwebsockets.c, and rebuilt the library. Then I was able to use it. But I'm not sure if that's the right way to do it.

cmake: Argument not separated from preceding token by whitespace

when compiling the actual libwebsockets master branch with
MinGW-w64 (gcc 4.8.2) & CMake 2.8.12.2 on Win7 via:

cmake -DLWS_WITH_SSL=0 -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=1 -G "MinGW Makefiles" ..
mingw32-make.exe

the cmake step gives the syntax warning

Argument not separated from preceding token by whitespace

in line 722 of CMakeLists.txt

"prefix="${CMAKE_INSTALL_PREFIX}"

Crash when creating context with occupied port

libwebsocket_create_context(...) crashes on a line 2163 of libwebsockets.c while trying to create a context for a port that is taken by the other instance of libwebsockets (i.e. an instance of websocket server with a port 9000 is running in a separate process and I'm trying to create a new websocket server on the very same port)

if (n < 0) {
lwsl_err("ERROR on binding to port %d (%d %d)\n",
info->port, n, errno);
close(sockfd); // this line leads to the crash
goto bail;
}

commenting out the "close(sockfd);" line seems to solve the issue so libwebsocket_create_context is able to return NULL if a particular port is taken, but I don't think it's a proper way to solve this.

Cross compiling issue

I'm currently trying to cross compile libwebsockets (v1.23-chrome32-firefox24) on ubuntu using this toolchain.

http://wiki.blueocty.com/index.php?title=GNU_Toolchain

I've verifed that the toolchain works as I've compiled a sample binary for ARM.

As shown in README.build of libwebsockets, I've edited my cross-arm-linux-gnueabihf.cmake to the newly downloaded toolchain then ran CMake against it.

CMake runs successfully, although there's two things that concerns me.

-- The C compiler identification is GNU 4.3.2
-- The CXX compiler identification is GNU 4.3.2
-- Check for working C compiler: /usr/arm-2008q3/bin/arm-none-linux-gnueabi-gcc
-- Check for working C compiler: /usr/arm-2008q3/bin/arm-none-linux-gnueabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/arm-2008q3/bin/arm-none-linux-gnueabi-g++
-- Check for working CXX compiler: /usr/arm-2008q3/bin/arm-none-linux-gnueabi-g++ -- wor
ks
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- CMAKE_TOOLCHAIN_FILE='/home/l46kok/Desktop/libwebsockets-1.23-chrome32-firefox24/cros
s-arm-linux-gnueabihf.cmake'
...
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for vfork.h
-- Looking for vfork.h - not found
-- Looking for zlib.h
-- Looking for zlib.h - not found

I was under the impression that libwebsockets required zlib, but cmake finishes successfully for some reason.

Anyhow, now I try to do make. Immediately, I get an error.

Scanning dependencies of target websockets
[  3%] Building C object CMakeFiles/websockets.dir/lib/base64-decode.c.o
[  6%] Building C object CMakeFiles/websockets.dir/lib/handshake.c.o
[ 10%] Building C object CMakeFiles/websockets.dir/lib/libwebsockets.c.o
[ 13%] Building C object CMakeFiles/websockets.dir/lib/output.c.o
cc1: warnings being treated as errors
/home/l46kok/Desktop/libwebsockets-1.23-chrome32-firefox24/lib/output.c: In function 'lws_issue_raw':
/home/l46kok/Desktop/libwebsockets-1.23-chrome32-firefox24/lib/output.c:162: error: label 'handle_truncated_send' defined but not used
make[2]: *** [CMakeFiles/websockets.dir/lib/output.c.o] Error 1
make[1]: *** [CMakeFiles/websockets.dir/all] Error 2
make: *** [all] Error 2

It's strange, because I didn't get such label defined but not used errors when I compiled regularly instead of cross compiling. Anyhow, I turned off the -werror flag to stop warnings from halting my compilation, then tried make && make install, and the process successfully finishes (with the above error displayed as warning).

I've also verified that the library is compiled in ARM architecture.

root@ubuntu:/home/l46kok/Desktop/libwebsockets-1.23-chrome32-firefox24/build# file /usr/lib/libwebsockets.so.4.0.0
/usr/lib/libwebsockets.so.4.0.0: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, not stripped

Then finally, I try to compile a very simple example code. For some reason, the compiler isn't able to find the header file to the library.

root@ubuntu:/home/l46kok/Desktop/websocketserver# arm-linux-gcc test.c -lwebsockets -o test
test.c:4:27: error: libwebsockets.h: No such file or directory

So I include the directory containing the header for the library.. and thousands of errors are generated from the libwebsocket library. Clearly, something must've gone wrong in the build process.

l46kok@ubuntu:~/Desktop/websocketserver$ arm-linux-gcc test.c -lwebsockets -o test -I/usr/include
cc1: warning: include location "/usr/include" is unsafe for cross-compilation
In file included from test.c:1:
/usr/include/stdio.h: In function 'sprintf':
/usr/include/stdio.h:365: error: expected declaration specifiers before '__THROWNL'
/usr/include/stdio.h:372: error: storage class specified for parameter 'vfprintf'
/usr/include/stdio.h:377: error: storage class specified for parameter 'vprintf'
/usr/include/stdio.h:380: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__THROWNL'
/usr/include/stdio.h:388: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__THROWNL'
/usr/include/stdio.h:392: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__THROWNL'
/usr/include/stdio.h:414: error: storage class specified for parameter 'vdprintf'
/usr/include/stdio.h:416: error: storage class specified for parameter 'dprintf'
/usr/include/stdio.h:426: error: storage class specified for parameter 'fscanf'
/usr/include/stdio.h:431: error: storage class specified for parameter 'scanf'
/usr/include/stdio.h:434: error: storage class specified for parameter 'sscanf'
/usr/include/stdio.h:434: warning: '__nothrow__' attribute ignored
/usr/include/stdio.h:443: error: storage class specified for parameter 'fscanf'
/usr/include/stdio.h:443: error: redefinition of parameter 'fscanf'
/usr/include/stdio.h:425: error: previous definition of 'fscanf' was here
/usr/include/stdio.h:446: error: storage class specified for parameter 'scanf'
/usr/include/stdio.h:446: error: redefinition of parameter 'scanf'
/usr/include/stdio.h:431: error: previous definition of 'scanf' was here
...

Here's the sample application that compiled and ran without any issue on gcc 4.7.3

http://pastebin.com/PBnbdQiW

I'm genuinely not sure how to fix this issue. The warnings and zlib.h missing is suspicious, but I'm not sure what exactly they indicate and how it's relevant to my problem. Any help would be appreciated.

Memory leak when connecting from client using WS spec revision 0

[I'm posting here because libwebsockets.org seems to be down.]

Each time I connect to my WS server using Safari 5.1.9 under OS X 10.6.8, Libwebsockets complains "WARN: Unknown client spec version 0". That's fine, but when I quit after running using Valgrind, Valgrind complains about leaked memory.

Here's the output from a run with four failed connections:

valgrind --dsymutil=yes --leak-check=full ./server
==49568== Memcheck, a memory error detector
==49568== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==49568== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==49568== Command: ./server
==49568==
[1371238824:2459] NOTICE: Initial logging level 7
[1371238824:2677] NOTICE: Library version: 1.3 7cf6cb0
[1371238824:2720] NOTICE: Started with daemon pid 0
[1371238824:2748] NOTICE: static allocation: 4472 + (16 x 256 fds) = 8568 bytes
[1371238824:2796] NOTICE: canonical_hostname = octobanger
[1371238824:2805] NOTICE: Compiled without SSL support
[1371238824:2813] NOTICE: per-conn mem: 160 + 1360 headers + protocol rx buf
[1371238824:2951] NOTICE: Listening on port 7681
[1371238834:8789] WARN: Unknown client spec version 0
[1371238834:8970] WARN: Unknown client spec version 0
[1371238838:0604] WARN: Unknown client spec version 0
[1371238838:0718] WARN: Unknown client spec version 0

Cleaning up...
==49568==
==49568== HEAP SUMMARY:
==49568== in use at exit: 17,626 bytes in 40 blocks
==49568== total heap usage: 103 allocs, 63 frees, 28,746 bytes allocated
==49568==
==49568== 5,440 bytes in 4 blocks are definitely lost in loss record 37 of 37
==49568== at 0x100040C16: malloc (vg_replace_malloc.c:274)
==49568== by 0x100055C45: lws_allocate_header_table (in /usr/local/lib/libwebsockets.4.0.0.dylib)
==49568== by 0x100058D46: libwebsocket_create_new_server_wsi (in /usr/local/lib/libwebsockets.4.0.0.dylib)
==49568== by 0x100058F3A: lws_server_socket_service (in /usr/local/lib/libwebsockets.4.0.0.dylib)
==49568== by 0x100053DC8: libwebsocket_service_fd (in /usr/local/lib/libwebsockets.4.0.0.dylib)
==49568== by 0x1000540D7: libwebsocket_service (in /usr/local/lib/libwebsockets.4.0.0.dylib)
==49568== by 0x1000039DE: wsPoll() (wsServer.cpp:133)
==49568== by 0x100000A48: main (main.cpp:73)
==49568==
==49568== LEAK SUMMARY:
==49568== definitely lost: 5,440 bytes in 4 blocks
==49568== indirectly lost: 0 bytes in 0 blocks
==49568== possibly lost: 0 bytes in 0 blocks
==49568== still reachable: 12,098 bytes in 35 blocks
==49568== suppressed: 88 bytes in 1 blocks
==49568== Reachable blocks (those to which a pointer was found) are not shown.
==49568== To see them, rerun with: --leak-check=full --show-reachable=yes
==49568==
==49568== For counts of detected and suppressed errors, rerun with: -v
==49568== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

The problem: the header table isn't being freed. The fix is to make a change in handshake.c:230, changing:

default:
    lwsl_warn("Unknown client spec version %d\n",
                       wsi->ietf_spec_revision);
    goto bail;
}

to:

default:
    lwsl_warn("Unknown client spec version %d\n",
                       wsi->ietf_spec_revision);
    goto bail_nuke_ah;
}

The "bail_nuke_ah" label adds a free() of the header table:

bail_nuke_ah:
    /* drop the header info */
    if (wsi->u.hdr.ah)
        free(wsi->u.hdr.ah);
bail:
    lwsl_info("closing connection at libwebsocket_read bail:\n");

Note that the "goto bail"s and "goto bail_nuke_ah"s seem to be used almost interchangeably; someone should review them to make sure the right choices are being made.

Win7 MinGW-w64 compile error: 'ssize_t'

when compiling the actual libwebsockets master branch with
MinGW-w64 (gcc 4.8.2) & CMake 2.8.12.2 on Win7 via the steps:

cmake -DWITH_SSL=0 -G "MinGW Makefiles" ..
mingw32-make.exe

it breaks at the make step with the error conflicting types for 'ssize_t'

D:\MinGW-w64\_home\libwebsockets-master\lib\libwebsockets.h:49:17:
    error:conflicting types for 'ssize_t'
    typedef SSIZE_T ssize_t;
In file included from d:\mingw-w64\mingw32\i686-w64-mingw32\include\crtdefs.h:10:0,
    from d:\mingw-w64\mingw32\i686-w64-mingw32\include\stdio.h:9,
    from D:\MinGW-w64\_home\libwebsockets-master\lib\base64-decode.c:42:
d:\mingw-w64\mingw32\i686-w64-mingw32\include\_mingw.h:389:13:
    note: previous declaration of 'ssize_t' was here
    typedef int ssize_t;

compilation fails with TEST_SERVER_EXTPOLL

when compiling the actual libwebsockets master branch with
MinGW-w64 (gcc 4.8.2) & CMake 2.8.12.2 on Win7
without the cmake command line parameter

-DLWS_WITHOUT_TEST_SERVER_EXTPOLL=1

and just compiled via

cmake -DLWS_WITH_SSL=0 -G "MinGW Makefiles" ..
mingw32-make.exe

the compilation fails at the make step with the error:

Linking C executable bin\libwebsockets-test-server-extpoll.exe
lib\libwebsockets_static.a(libwebsockets.c.obj):
        libwebsockets.c:(.text+0x0):
                multiple definition of `emulated_poll@12'
CMakeFiles\test-server-extpoll.dir/objects.a(websock-w32.c.obj):
        websock-w32.c:(.text+0x0):
                first defined here
lib\libwebsockets_static.a(libwebsockets.c.obj):
        libwebsockets.c:(.bss+0x0):
                multiple definition of `poll'
CMakeFiles\test-server-extpoll.dir/objects.a(websock-w32.c.obj):
        websock-w32.c:(.bss+0x0):
            first defined here
d:/mingw-w64/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe:
        lib\libwebsockets_static.a(libwebsockets.c.obj):
            bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\test-server-extpoll.dir\build.make:195:
        recipe for target 'bin/libwebsockets-test-server-extpoll.exe' failed
mingw32-make.exe[2]: *** [bin/libwebsockets-test-server-extpoll.exe] Error 1
CMakeFiles\Makefile2:303:
        recipe for target 'CMakeFiles/test-server-extpoll.dir/all' failed
mingw32-make.exe[1]: *** [CMakeFiles/test-server-extpoll.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2

max frame size / rx buffer send limitation

why is libwebsocket_write limited by that, my previous build was not limited
now i get ERROR writing, solved by increasing the max frame size / rx buffer to the size im trying to send.

but this wont fix my problem because i have big variances in the sizes im sending.

About post file in a request

Dear warmcat,

I am working on sending a file with post request and find i have to parse the multipart http body myself and then record file, so is it possible libwebsocket realize this parse function?
This shouldn't be an issue, but i have no other way to submit, sorry.

Thanks
jessie

With new nonblocking socket setting on iOS socket fails on EISCONN

With new nonblocking socket setting on iOS websocket is closed with EISCONN 56. It appears that in client-handshake.c in line 87 (https://github.com/warmcat/libwebsockets/blob/master/lib/client-handshake.c#L87) only EALREADY and EINPROGRESS are checked. In my situation I get there first time with EINPROGRESS which is ok but the next time I get EISCONN which leads to fail. I have put simple check for EISCONN as quick and dirty fix but I haven't tested it thoroughly.

Bug with using clientside websocket

Hello,

I downloaded your lib today and I compiled it without the server support nor the SSL one:
"cmake -G "Visual Studio 10" -DLWS_WITH_SSL=0 -DLWS_WITHOUT_SERVER=1 -DLWS_WITHOUT_TEST_SERVER=1 -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=1 -DLWS_WITHOUT_DEBUG=1 .."

And figured out that the function "libwebsocket_client_connect_2" @ "client-handshake.c" called the function name "interface_to_sa" which is not defined with such options.
A solution could be:

  • Or to move this function in a common part.
  • Or to declare this function also clientside surrounded by "#ifdef LWS_NO_SERVER"

Also your README.build is outdated:
cmake -DWITH_SSL=0 ..
or
cmake -DWITH_SSL:BOOL=OFF ..

Should be:
cmake -DLWS_WITH_SSL=0 ..
or
cmake -DLWS_WITH_SSL:BOOL=OFF ..

Keep the hard work!
Best regards.

SSL_connect on iOS with http proxy fails when SSL_connect can't connect immediately (with blocking sockets, branched from 6c58228)

SSL_connect on iOS with http proxy fails when SSL_connect can't connect immediately. The problem is that nonblocking BIO is used so in case SSL_connect() can't finish in one turn wsi->mode doesn't change from LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY. So the next time we receive something on socket we fail on "HTTP/1.0 200" proxy connect check. I have made a quick fix. Please check here shyswork@b84971a
This is related to blocking sockets as of commit 6c58228. When I tried to use libwebsocket on iOS behind http proxy with nonblocking sockets I couldn't connect as well but I'm not sure if it is related to openssl or to the problem with libwebsockets and nonblocking sockets on iOS.

Use of -Werror in CMakeLists.txt causes build to fail on linux/gcc

-Werror is set in CMakeLists.txt line 312:

if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
if (UNIX)
set( CMAKE_C_FLAGS "-Wall -Werror -O4 -fvisibility=hidden ${CMAKE_C_FLAGS}" )

But this causes libwebsockets build to fail:

make
[ 2%] Building C object CMakeFiles/websockets.dir/lib/libwebsockets.c.o
/home/grrrwaaa/code/libwebsockets/lib/libwebsockets.c:1815:13: error: ‘lws_sigusr2’ defined but not used [-Werror=unused-function]
static void lws_sigusr2(int sig)
^
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/websockets.dir/lib/libwebsockets.c.o] Error 1
make[1]: *** [CMakeFiles/websockets.dir/all] Error 2
make: *** [all] Error 2

Adding -Wno-unused-function after -Werror resolves the issue. Throwing build errors for unused functions seems overkill...

compile error: unknown type name 'IN6_ADDR'

when compiling the actual libwebsockets master branch with
MinGW-w64 (gcc 4.8.2) & CMake 2.8.12.2 on Win7 via

cmake .. -G "MinGW Makefiles" -DLWS_WITH_SSL=0 -DLWS_WITHOUT_TEST_SERVER_EXTPOLL=1 -DLWS_IPV6=0
mingw32-make.exe

the compilation fails at the make step with the error:

In file included from D:\MinGW-w64\_home\libwebsockets-master\lib\private-libwebsockets.h:86:0,
                 from D:\MinGW-w64\_home\libwebsockets-master\lib\base64-decode.c:44:
d:\mingw-w64\mingw32\i686-w64-mingw32\include\mstcpip.h:101:1: error: unknown type name 'IN6_ADDR'
LPSTR NTAPI RtlIpv6AddressToStringA(const IN6_ADDR *Addr, LPSTR S);
^
d:\mingw-w64\mingw32\i686-w64-mingw32\include\mstcpip.h:102:1: error: unknown type name 'IN6_ADDR'
LPWSTR NTAPI RtlIpv6AddressToStringW(const IN6_ADDR *Addr, LPWSTR S);
^
d:\mingw-w64\mingw32\i686-w64-mingw32\include\mstcpip.h:104:1: error: unknown type name 'IN6_ADDR'
LONG NTAPI RtlIpv6AddressToStringExA(const IN6_ADDR *Address, ULONG ScopeId, USHORT Port, LPSTR AddressString, PULONG AddressStringLength);
^
In file included from D:\MinGW-w64\_home\libwebsockets-master\lib\private-libwebsockets.h:86:0,
             from D:\MinGW-w64\_home\libwebsockets-master\lib\base64-decode.c:44:
d:\mingw-w64\mingw32\i686-w64-mingw32\include\mstcpip.h:105:1: error: unknown type name 'IN6_ADDR'
LONG NTAPI RtlIpv6AddressToStringExW(const IN6_ADDR *Address, ULONG ScopeId, USHORT Port, LPWSTR AddressString, PULONG AddressStringLength);
^
d:\mingw-w64\mingw32\i686-w64-mingw32\include\mstcpip.h:124:59: error: unknown type name 'IN6_ADDR'
LONG NTAPI RtlIpv6StringToAddressExA(PCSTR AddressString, IN6_ADDR *Address, PULONG ScopeId, PUSHORT Port);
                                                          ^
d:\mingw-w64\mingw32\i686-w64-mingw32\include\mstcpip.h:125:60: error: unknown type name 'IN6_ADDR'
LONG NTAPI RtlIpv6StringToAddressExW(PCWSTR AddressString, IN6_ADDR *Address, PULONG ScopeId, PUSHORT Port);
                                                           ^

How to use this library?

I'm completely lost here...

Is there a SUPER SIMPLE working example of a websocket client that would go like this:

include libwebsockets

int main () {

websocket ws = new websocket();

ws.connect();

ws.send();

...

}

Thank you!

Support old web client

Why we remove the support for old websocket protocol? The previous release have full support but the latest not. Some web client still us old protocol such as webkit in QT 4.8.1

Windows 7 (32 bit) build problems

I just cloned the repo and followed the README.build file instructions to build for Win 7 64 bit (but targeting 32 bit) in Visual Studio 2010. 3 projects succeded 8 failed. Many errors were related to the wsockcompat.h file. If the "include wsockcompat.h" in private-libwebsockets.h is removed then 9 projects succeed and only one fails (test-echo) due to an "unresolved external symbol _lws_daemonize referenced in function _main". Can I expect that the library runs without the wsockcompat.h file? How to remove the last linker error?

Build failed Visual Studio 10 (32 bit)

I followed the building instructions for Visual Studio 10 with no SSL support. All but one projects could be built. Here is an excerpt of the error log:

8>ClCompile:
8> test-fraggle.c
6>ClCompile:
6> test-server.c
11>ClCompile:
11> test-echo.c
10>ClCompile:
10> test-client.c
9>ClCompile:
9> test-server.c
7>ClCompile:
7> test-ping.c
8>..\test-server\test-fraggle.c(109): warning C4018: '<' : signed/unsigned mismatch
8>..\test-server\test-fraggle.c(195): warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data
8>..\test-server\test-fraggle.c(196): warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data
8>..\test-server\test-fraggle.c(197): warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data
6>..\test-server\test-server.c(251): warning C4013: 'open' undefined; assuming extern returning int
6>..\test-server\test-server.c(285): warning C4013: 'close' undefined; assuming extern returning int
6>..\test-server\test-server.c(374): warning C4013: 'read' undefined; assuming extern returning int
6>..\test-server\test-server.c(391): warning C4013: 'lseek' undefined; assuming extern returning int
11>..\test-server\test-echo.c(106): warning C4013: 'getpid' undefined; assuming extern returning int
6>..\test-server\test-server.c(626): warning C4018: '<' : signed/unsigned mismatch
8> getopt.c
11> getopt.c
6> getopt.c
10> getopt.c
8> getopt_long.c
11> getopt_long.c
6> getopt_long.c
9>..\test-server\test-server.c(251): warning C4013: 'open' undefined; assuming extern returning int
9>..\test-server\test-server.c(285): warning C4013: 'close' undefined; assuming extern returning int
9>..\test-server\test-server.c(374): warning C4013: 'read' undefined; assuming extern returning int
9>..\test-server\test-server.c(391): warning C4013: 'lseek' undefined; assuming extern returning int
10> getopt_long.c
9>..\test-server\test-server.c(626): warning C4018: '<' : signed/unsigned mismatch
9> getopt.c
8> gettimeofday.c
11> gettimeofday.c
6> gettimeofday.c
7>..\test-server\test-ping.c(231): warning C4244: '=' : conversion from 'unsigned long' to 'unsigned char', possible loss of data
7>..\test-server\test-ping.c(235): warning C4018: '<' : signed/unsigned mismatch
7>..\test-server\test-ping.c(272): warning C4018: '<' : signed/unsigned mismatch
7>..\test-server\test-ping.c(278): warning C4018: '<' : signed/unsigned mismatch
7>..\test-server\test-ping.c(380): warning C4244: '=' : conversion from 'double' to 'unsigned int', possible loss of data
7> getopt.c
10> gettimeofday.c
9> getopt_long.c
7> getopt_long.c
9> gettimeofday.c
7> gettimeofday.c
6> Generating Code...
8> Generating Code...
11> Generating Code...
10> Generating Code...
9> websock-w32.c
7> Generating Code...
11>test-echo.obj : error LNK2019: unresolved external symbol _lws_daemonize referenced in function _main
11>K:\development\libraries\libwebsockets\build\bin\Debug\libwebsockets-test-echo.exe : fatal error LNK1120: 1 unresolved externals
11>
11>Build FAILED.

LWS_NO_EXTENSIONS=ON compilation failure

Compilation fails because the ifdef factors out an enum which as the return value of a function that is not factored out.

mkdir build
cd build
cmake ../ -DLWS_NO_EXTENSIONS=ON
make
pi@raspberrypi ~/pestermypet/libs/libwebsockets/build $ make
Scanning dependencies of target websockets
[  2%] Building C object CMakeFiles/websockets.dir/lib/base64-decode.c.o
[  5%] Building C object CMakeFiles/websockets.dir/lib/handshake.c.o
[  8%] Building C object CMakeFiles/websockets.dir/lib/libwebsockets.c.o
[ 11%] Building C object CMakeFiles/websockets.dir/lib/output.c.o
[ 13%] Building C object CMakeFiles/websockets.dir/lib/parsers.c.o
[ 16%] Building C object CMakeFiles/websockets.dir/lib/client.c.o
[ 19%] Building C object CMakeFiles/websockets.dir/lib/client-handshake.c.o
[ 22%] Building C object CMakeFiles/websockets.dir/lib/client-parser.c.o
[ 25%] Building C object CMakeFiles/websockets.dir/lib/server.c.o
[ 27%] Building C object CMakeFiles/websockets.dir/lib/server-handshake.c.o
[ 30%] Building C object CMakeFiles/websockets.dir/lib/extension.c.o
In file included from /home/pi/pestermypet/libs/libwebsockets/lib/extension.c:4:0:
/home/pi/pestermypet/libs/libwebsockets/lib/extension-deflate-frame.h:25:3: error: ‘enum libwebsocket_extension_callback_reasons’ declared inside parameter list [-Werror]
In file included from /home/pi/pestermypet/libs/libwebsockets/lib/extension.c:5:0:
/home/pi/pestermypet/libs/libwebsockets/lib/extension-deflate-stream.h:20:12: error: ‘enum libwebsocket_extension_callback_reasons’ declared inside parameter list [-Werror]
/home/pi/pestermypet/libs/libwebsockets/lib/extension.c:7:31: error: array type has incomplete element type
/home/pi/pestermypet/libs/libwebsockets/lib/extension.c: In function ‘libwebsocket_get_internal_extensions’:
/home/pi/pestermypet/libs/libwebsockets/lib/extension.c:34:1: error: control reaches end of non-void function [-Werror=return-type]
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/websockets.dir/lib/extension.c.o] Error 1
make[1]: *** [CMakeFiles/websockets.dir/all] Error 2
make: *** [all] Error 2

Missing lws_hdr_total_length/lws_hdr_copy declarations??

I'm using the current version of the library (v1.3). I'm using the lws_hdr_total_length/lws_hdr_copy functions to parse URI request and the both seg fault (11). lws_hdr_copy calls lws_hdr_total_length which seg faults.

I can find the function prototypes in libwebsockets.h but there's no corresponding functions declaration in libwebsockets.c.

lwsts[2821]: choked before able to send whole file (post)

Dear,

I downloaded the latest libwebsocket from github, yes, it supports http post now, but when i run libwebsocket-test-server and access to http://localhost:7681/test.html, i got
lwsts[2821]: choked before able to send whole file (post), and the server won't give any response any more.
But the former released version has no this issue, could u tell me how to solve this issue?

Thanks in advance
jessie

http problems across router

i just got a new router, previous problem of partial page load is still present

websocket is working fine

loading a 22414bytes page, the last 1kb is missing

im hoping if this can be resolved i can resolve an issue im having with my own library and mangled data across the router. no problems directly connecting to the modem.

test-server fail with LWS_IPV6

libWebSockets - github 8/4/14 12.42pm GMT
CMake 2.9.12.2 - default config
Visual Studio 2010 Ult
Win7 Ult x64

running test-server, browser can't connect and the log displays:

[118011:2400] WARN: getsockname: Unknown error

Quickfix: uncheck the LWS_IPV6 option in CMake, re-generate & re-build

The runtime warning log is generated by lib\server.c at line 103, because LWS_ERRNO has returned WSAEFAULT (10014), probably because the var 'sin' is not sufficient in size as the . Possibly change to a 'struct sockaddr_storage' with checking of its 'ss_family' member to determine what to cast it to.

Problem with Win compiler because variable after block

Can you please move the line

struct libwebsocket_pollargs pa = {wsi->sock, POLLIN, 0 };

in function insert_wsi_socket_into_fds(...) to the beginning of the function, otherwise it con not be compiled under/for Windows (not sure what exact settings they are using...).

there are also some other problems because first you are accessing wsi->sock and afterwards you are asserting wsi and wsi->sock (should be done before - right?)

thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.