Andrew Canaday
74b4a65745
Added optional per-header length limits:
...
- libwebsockets.h:
- * added struct lws_token_limits
* added token limits pointer to lws_context_creation_info
- private-libwebsockets.h: added token limits pointer to lws_context_creation_info
- context.c: copy token limits in create_context
- client.c / server.c: pass context when invoking libwebsocket_parse
- parsers.c:
- * libwebsocket_parse takes context pointer
* issue_char takes context pointer and checks header length against context limits, if defined
* issue_char returns 1 (not -1/0) for header too long, and spill: sets the state to WSI_TOKEN_SKIPPING
2014-07-06 09:33:40 +08:00
vpeter4
7c00fc3d9d
Disable compile error: statement with no effect
2014-04-27 13:35:28 +02:00
Andy Green
1b2fc03f24
libev stub macros need to reflect void when disabled
...
Reported-by: Michael Harberler <mail17@mah.priv.at>
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-21 07:59:44 +09:00
Patrick Gansterer
a6b019aaee
Declare the lws_ssl_capable_*_no_ssl function outside the SSL #ifdef
...
This avoids a compiler warning about a not declared function.
2014-04-15 18:40:31 +02:00
Patrick Gansterer
6bb4b62ede
Fix compilation on Windows CE after cleanup
2014-04-15 18:39:26 +02:00
Patrick Gansterer
1077e1f4d2
Fix include statement of in6addr.h
...
Only include it when CMake can find it. This works with MinGW and WinCE.
2014-04-15 18:38:54 +02:00
Andy Green
0f58db3940
windows ipv6 add necessary header
...
Thanks to Marjan and Joakim
https://github.com/warmcat/libwebsockets/issues/108#issuecomment-40075600
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-12 11:31:40 +08:00
Andy Green
cdb9bf9bdd
refactor move ssl server service to ssl.c
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-12 10:07:02 +08:00
Andy Green
a717df2739
refactor libev eliminate all code ifdefs
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-11 13:14:37 +08:00
Andy Green
a1a24d26a6
close should flush any truncated send before really closing
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-10 14:25:24 +08:00
Andy Green
d7340c141f
clean=various ifdef reduction
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-10 14:08:10 +08:00
Andy Green
1a308e4176
define LWS_SSL_CAPPABLE return codes even when no SSL enabled
...
Reported by fuzzy
https://github.com/warmcat/libwebsockets/issues/107
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-08 07:26:30 +01:00
spayton
5b94c3b449
Update private-libwebsockets.h
...
fixes windows http file serve - macro compatible_file_read() incorrectly used 'amount' instead of '_amount'
2014-04-08 07:22:53 +01:00
Joakim Soderberg
d2f5b199bc
windows Fix build.
2014-04-07 13:13:45 +01:00
Andy Green
e9b61b5ba5
windows clean out redundant inet_ntop prototype
...
Suggested by Joakim Soderberg https://github.com/warmcat/libwebsockets/issues/103#issuecomment-39684559
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-07 06:25:07 +01:00
Andy Green
02138126f2
refactor add ssl read write single implementation
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-06 06:26:35 +01:00
Andy Green
b25b85f606
windows allow syslog log target to mao to stderr
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 23:34:09 +08:00
Andy Green
a5fe1192cf
windows fix SetFilePointer args
...
This restricts it to 4GB files on 32-bit Windows but it'll do for now.
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 19:52:37 +08:00
Andy Green
2eedea9884
http2 add initial alpn support
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 14:33:48 +08:00
Andy Green
c57037a555
refactor ssl related code into ssl.c
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 10:17:00 +08:00
Andy Green
b49a995a8d
clean small additional ifdef reduction
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 10:11:04 +08:00
Andy Green
aad2eac48e
refactor handshake client and server handling into client.c and server.c
...
Eliminate more #ifdefs
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 09:03:37 +08:00
Andy Green
d99476b2b3
refactor move flow control to server.c
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 08:40:05 +08:00
Andy Green
e38031a394
refactor migrate client and server specific context init into client.c and server.c
...
Eliminate some NO_CLIENT and NO_SERVER
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 08:24:29 +08:00
Andy Green
34f3dd2082
refactor pollfd related functions into pollfd.c
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 07:43:42 +08:00
Andy Green
3d67f515db
refactor context related functions into context.c
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 07:29:50 +08:00
Andy Green
a654fc0d50
clean move lws_plat externs
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 07:16:40 +08:00
Andy Green
5266f66f50
win32 inet_top
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-02 21:31:07 +08:00
Andy Green
e40aa9b920
plat change to build selection by cmake
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-02 21:04:03 +08:00
Andy Green
2c24ec0211
refactor out most NO_EXTENSIONS
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-02 19:45:42 +08:00
Andy Green
158e804cb7
refactor out WIN32 tests from code
...
This gets rid of all the platform-dependent #ifdef stuff and
migrates it into the new lws-plat-xxx.c files.
These are then included in a one-time test in libwebsockets.c
according basically to Windows or not.
The idea is from now on, all Windows-specific code should go in
lws-plat-win.c, where any kind of Windows perversion like DWORD
is fine.
Any new functions going in there should be named lws_plat_...
and be defined in all the lws-plat-xxx.c file (currently just
win32 and unix platforms are supported).
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-02 14:25:10 +08:00
Patrick Gansterer
b13eed4dcc
Cleanup header includes
2014-03-30 10:19:23 +02:00
Patrick Gansterer
b47f87b04b
Introduce LWS_POLLIN, LWS_POLLOUT and LWS_POLLHUP
2014-03-30 09:18:05 +02:00
Patrick Gansterer
73882e49fc
Remove websock-w32.h
2014-03-29 08:25:58 +01:00
Patrick Gansterer
0fc37b64f6
windows Use WSAWaitForMultipleEvents() instead of poll() on Windows
2014-03-29 09:54:40 +08:00
Andy Green
055f2979ec
ipv6 integration fixes
...
Disable for build using -DLWS_IPV6= on the cmake line
2014-03-24 23:08:38 +08:00
James Devine
3f13ea2264
add ipv6 support
...
(changed to support runtime disable + integration by andy@warmcat.com )
2014-03-24 16:09:25 +08:00
Andrew Canaday
9769f4f293
libev port
...
merged by andy@warmcat.com via https://github.com/gaby64/libwebsockets-libev
To use, you need to both
- cmake ---> -DLWS_USE_LIBEV=1
- info->options must have LWS_SERVER_OPTION_LIBEV set when creating the context
this is so a single library can be built for distros to support apps that use
normal polling and apps that use libev polling.
2014-03-23 13:25:07 +08:00
Andy Green
e254d9589d
truncated send keep and grow truncation buffer
...
Also change from looking at wsi->truncated_send_malloc to see if we are in the middle of
dealing with a truncated send to looking for nonzero wsi->truncated_send_len
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-03-23 11:41:15 +08:00
Patrick Gansterer
1ee57f6fe8
Add libwebsocket_cancel_service() to let a pending libwebsocket_service() return
...
Use poll() with a pipe instead of ppoll() to allow the stop polling
on all UNIX platforms.
2014-03-08 09:31:49 +08:00
Patrick Gansterer
4a83727bf6
Remove duplicated implementations for bzero()
...
Define bzero() in a central place if HAVE_BZERO is not set
2014-02-28 20:28:06 +08:00
Patrick Gansterer
2dbd837c41
WSAGetLastError() instead of errno on Windows
...
Error codes set by Windows Sockets are not made available through the errno
variable. Checking them via WSAGetLastError() is the corret solution.
2014-02-28 20:08:55 +08:00
Andy Green
02684c54fb
fix missing include for time
...
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-02-28 09:09:17 +08:00
Patrick Gansterer
9d614917c3
Add dummy implementation when strerror() is missing
...
Use a simple empty string for platforms without an implementation.
2014-02-28 08:57:01 +08:00
Patrick Gansterer
e5720a347e
Cleanup include statements
...
Remove useless includes and add some preprocessor conditions for platform specific headers.
2014-02-28 08:51:35 +08:00
Patrick Gansterer
81338aa886
Use native file functions on Windows
...
Add a special implementation with CreateFile(), ReadFile() and CloseFile()
for serving HTTP file request to allow compilation on all Windows platforms.
2014-02-27 21:20:36 +08:00
Patrick Gansterer
92792b4eef
Avoid calls to gettimeofday()
...
Add a new function to get the current time in microseconds, since gettimeofday() does not exist on Windows.
Keep the current implementation for the test applications.
2014-02-27 21:04:18 +08:00
Mattias Lundberg
03bb8f9045
Add support to binding client to interface.
2014-02-19 08:38:08 +08:00
Andy Green
3b3fa9e208
Use ppoll to allow signals to wake service loop early on change of pollfd event
...
To enable this code you need to force LWS_HAS_PPOLL to de defined.
#defining it at the top of libwebsockets.c is enough.
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-12-25 16:34:37 +08:00
Andy Green
91f19d8d79
unify all pollfd lock management
...
This provides a single place for pollfd event changing,
external locking for that and extpoll management.
It saves about 85 lines of duplication and simplifies the callers.
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-12-21 11:18:34 +08:00