Andy Green [Tue, 29 Jul 2014 15:02:07 +0000 (23:02 +0800)]
avoid crash if we dont have new wsi
Signed-off-by: Andy Green <andy.green@linaro.org>
Aurelian Pop [Tue, 29 Jul 2014 12:36:06 +0000 (15:36 +0300)]
Fix TCP keepalive use in UNIX systems
Andrew Canaday [Fri, 18 Jul 2014 23:01:10 +0000 (07:01 +0800)]
Keep-alive: disable timeout and let TCP ka kill.
This is required for streaming HTTP connections.
Not sure if there's a more graceful way to handle this
(maybe resetting the timeout in the 'send'-side code?
Andrew Canaday [Fri, 18 Jul 2014 23:00:52 +0000 (07:00 +0800)]
Make sure headers are parsed before proceeding.
Andrew Canaday [Fri, 18 Jul 2014 22:58:53 +0000 (06:58 +0800)]
Only check for '?' URI args during URI path parse
Andy Green [Fri, 18 Jul 2014 22:52:39 +0000 (06:52 +0800)]
handle client protocol lists properly
We fail to deal with lists of protocols sent by the client
by picking one from the list properly. This fixes that and
adds protocol lists to the test client for regression testing.
Signed-off-by: Andy Green <andy.green@linaro.org>
Andrew Canaday [Mon, 14 Jul 2014 12:19:50 +0000 (20:19 +0800)]
Don't need 'content_remain' in libwebsocket_read
Andrew Canaday [Sun, 13 Jul 2014 05:07:36 +0000 (01:07 -0400)]
HTTP Version, Keep-alive support, No-copy POST
This is a squashed commit from https://github.com/andrew-canaday/libwebsockets,
dev/http_keepalive branch (strategies changed a few times, so the commit
history is clutteread). This branch is submitted for clarity, but the other
can be used as a reference or alternative.
* added **enum http_version** to track HTTP/1.0 vs HTTP/1.1 requests
* added **enum http_connection_type** to track keep-alive vs close
* replaced content_length_seen and body_index with **content_remain**
* removed **post_buffer** (see handshake.c modifications)
* removed post_buffer free
* switch state to WSI_TOKEN_SKIPPING after URI is complete to store version
* delete *spill* label (unused)
* add vars to track HTTP version and connection type
* HTTP version defaults to 1.0
* connection type defaults to 'close' for 1.0, keep-alive for 1.1
* additional checks in **cleanup:** label:
* if HTTP version string is present and valid, set enum val appropriately
* override connection default with the "Connection:" header, if present
* set state to WSI_STATE_HTTP_BODY if content_length > 0
* return 0 on HTTP requests, unless LWS_CALLBACK_HTTP indicates otherwise
* add vars to track remaining content_length and body chunk size
* re-arrange switch case order to facilitate creation of jump-table
* added new labels:
* **read_ok**: normal location reach on break from switch; just return 0
* **http_complete**: check for keep-alive + init state, mode, hdr table
* **http_new**: jump location for keep-alive when http_complete sees len>0
* after libwebsocket_parse, jump to one of those labels based on state
* POST body handling:
* don't bother iterating over input byte-by-byte or using memcpy
* just pass the relevant portion of the context->service_buffer to callback
Andrew Canaday [Mon, 7 Jul 2014 22:10:02 +0000 (18:10 -0400)]
libwebsockets_read: update 'len' after lws_handshake_server invocation
Andy Green [Sun, 6 Jul 2014 01:56:11 +0000 (09:56 +0800)]
update changelog for 1.3
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 5 Jul 2014 03:52:58 +0000 (11:52 +0800)]
test server dumb increment fix once per second duplicate
Signed-off-by: Andy Green <andy.green@linaro.org>
AndyMcG [Sat, 5 Jul 2014 03:25:11 +0000 (11:25 +0800)]
Trac 75: fix uxexpected ssl connection close
Andy Green [Sat, 5 Jul 2014 02:59:59 +0000 (10:59 +0800)]
add runtime context flag to enforce defeat of OS CA CERTS even if build option selected
Signed-off-by: Andy Green <andy.green@linaro.org>
Cong Ma [Sat, 5 Jul 2014 02:50:47 +0000 (10:50 +0800)]
fix confusion ull in latency reporting
kolis [Sat, 5 Jul 2014 02:43:54 +0000 (10:43 +0800)]
partial send handling
Andy Green [Sat, 5 Jul 2014 02:31:12 +0000 (10:31 +0800)]
dont free externally allocated user_space when closing connection
Signed-off-by: Andy Green <andy.green@linaro.org>
geq [Wed, 28 May 2014 04:52:18 +0000 (04:52 +0000)]
fix build on OpenBSD
Andrew Canaday [Sat, 5 Jul 2014 02:04:19 +0000 (10:04 +0800)]
Added HTTP OPTIONS support:
- added options to minilex.c
- regenerated lextable.h
- added WSI_TOKEN_OPTIONS_URI to libwebsockets.h
- tweaked parsers.c to accommodate OPTIONS token
- tweaked server.c to set uri_ptr and uri_len for HTTP callback on OPTIONS as well
Andrew Canaday [Sun, 29 Jun 2014 05:34:24 +0000 (01:34 -0400)]
Reducing CPU cycles spent calculating per-header length limit.
Andrew Canaday [Sun, 29 Jun 2014 04:30:45 +0000 (00:30 -0400)]
Added docs for token limits.
Andrew Canaday [Sun, 29 Jun 2014 04:25:19 +0000 (00:25 -0400)]
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
Andrew Canaday [Sun, 29 Jun 2014 23:14:43 +0000 (19:14 -0400)]
Added HTTP_STATUS_NO_CONTENT == 204
Andrew Canaday [Mon, 30 Jun 2014 09:54:16 +0000 (05:54 -0400)]
Added comma after if-none-match...
Andrew Canaday [Sun, 29 Jun 2014 00:19:57 +0000 (20:19 -0400)]
Added new HTTP headers and WSI tokens:
- "access-control-request-headers:" <-- WSI_TOKEN_HTTP_AC_REQUEST_HEADERS
- "if-none-match:" <-- WSI_TOKEN_HTTP_IF_NONE_MATCH
Andy Green [Thu, 22 May 2014 03:12:15 +0000 (11:12 +0800)]
clean partial send handling warning
Reported-by: Michael Haberler <mail17@mah.priv.at>
Signed-off-by: Andy Green <andy.green@linaro.org>
kolis [Mon, 19 May 2014 12:40:50 +0000 (14:40 +0200)]
Partial send handling
AG removed what looked like redundant set eff_buf.token_len <- n
vpeter4 [Sun, 27 Apr 2014 10:32:15 +0000 (12:32 +0200)]
Fix for binding socket to a specific interface (fixes #116)
also allow binding to IP address with @iface info.iface = "eth0"; info.iface
= "192.168.1.5";
Joakim Soderberg [Thu, 24 Apr 2014 12:47:10 +0000 (14:47 +0200)]
Turn off IPv6 in windows for now
It's horribly broken
AG: issue seems to be size of the addr struct as suggested on the list
vpeter4 [Sun, 27 Apr 2014 11:22:09 +0000 (13:22 +0200)]
Conditionally declare variable
vpeter4 [Sun, 27 Apr 2014 10:52:21 +0000 (12:52 +0200)]
Compile with older OpenSSL library (missing symbol SSL_set_tlsext_host_name)
vpeter4 [Sun, 27 Apr 2014 11:35:28 +0000 (13:35 +0200)]
Disable compile error: statement with no effect
vpeter4 [Sun, 27 Apr 2014 11:28:22 +0000 (13:28 +0200)]
Disable compile warning: no newline at end of file
Andy Green [Sun, 20 Apr 2014 23:27:19 +0000 (08:27 +0900)]
introduce LWS_FEATURE_ tests
Help user code be compatible with multiple LWS versions by
providing #ifdef -testable flags for API changes
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 20 Apr 2014 22:59:44 +0000 (07:59 +0900)]
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>
Patrick Gansterer [Tue, 15 Apr 2014 16:45:48 +0000 (18:45 +0200)]
Windows: Fix implementation of lws_plat_inet_ntop()
We need to pass a sockaddr_in6 struct to WSAAddressToString() to have a
working implementation for IPV6. Also use the WideChar version to allow
compilation on Windows CE too.
Patrick Gansterer [Tue, 15 Apr 2014 16:42:57 +0000 (18:42 +0200)]
Windows: Use gai_strerrorW() instead of gai_strerror()
This allows compilation on Windows CE too.
Patrick Gansterer [Tue, 15 Apr 2014 16:41:38 +0000 (18:41 +0200)]
Windows: Fix the passed parameter to the setsockopt function
This avoids compiler warnings about missmatched parameter types.
Patrick Gansterer [Tue, 15 Apr 2014 16:40:31 +0000 (18:40 +0200)]
Declare the lws_ssl_capable_*_no_ssl function outside the SSL #ifdef
This avoids a compiler warning about a not declared function.
Patrick Gansterer [Tue, 15 Apr 2014 16:39:26 +0000 (18:39 +0200)]
Fix compilation on Windows CE after cleanup
Patrick Gansterer [Tue, 15 Apr 2014 16:38:54 +0000 (18:38 +0200)]
Fix include statement of in6addr.h
Only include it when CMake can find it. This works with MinGW and WinCE.
Andy Green [Sat, 12 Apr 2014 03:47:25 +0000 (11:47 +0800)]
rxflow just return 0 when changing state
Nobody cares if we changed state, and callers are
increasingly taking nonzero as fail, causing us to
drop the connection when we re-enable rxflow.
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 12 Apr 2014 03:10:35 +0000 (11:10 +0800)]
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>
Andy Green [Sat, 12 Apr 2014 02:07:02 +0000 (10:07 +0800)]
refactor move ssl server service to ssl.c
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Fri, 11 Apr 2014 05:14:37 +0000 (13:14 +0800)]
refactor libev eliminate all code ifdefs
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 10 Apr 2014 09:06:59 +0000 (17:06 +0800)]
fixes for close flush
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 10 Apr 2014 07:15:13 +0000 (15:15 +0800)]
fixup no extentsion around last clean
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 10 Apr 2014 06:25:24 +0000 (14:25 +0800)]
close should flush any truncated send before really closing
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 10 Apr 2014 06:08:10 +0000 (14:08 +0800)]
clean=various ifdef reduction
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 10 Apr 2014 03:23:18 +0000 (11:23 +0800)]
truncated send always callback on writeable
Suggested by a Windows log where leaf.jpg meets EAGAIN and after
issuing the truncated send buffer, never sends any more
https://github.com/warmcat/libwebsockets/issues/111#issuecomment-
39873129
Added note in README.coding about WRITEABLE callbacks able to
be generated by lws.
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 10 Apr 2014 03:11:06 +0000 (11:11 +0800)]
test server extend timeout while sending leaf
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 10 Apr 2014 03:03:22 +0000 (11:03 +0800)]
inform timeout source when TIMEDOUT_WAITING
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 10 Apr 2014 02:13:43 +0000 (10:13 +0800)]
docs clarify create context comment threading not supported
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Tue, 8 Apr 2014 15:15:02 +0000 (16:15 +0100)]
move SNI temp var back one
Reported as making trouble on Windows by spayton
https://github.com/warmcat/libwebsockets/issues/109
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Tue, 8 Apr 2014 06:26:30 +0000 (07:26 +0100)]
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>
spayton [Mon, 7 Apr 2014 17:43:58 +0000 (18:43 +0100)]
Update private-libwebsockets.h
fixes windows http file serve - macro compatible_file_read() incorrectly used 'amount' instead of '_amount'
Joakim Soderberg [Mon, 7 Apr 2014 09:28:08 +0000 (11:28 +0200)]
windows Fix build.
Andy Green [Mon, 7 Apr 2014 05:25:07 +0000 (06:25 +0100)]
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>
Andy Green [Sun, 6 Apr 2014 11:39:22 +0000 (12:39 +0100)]
fix ssl error reporting
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 6 Apr 2014 11:41:20 +0000 (12:41 +0100)]
allow signals during send
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 6 Apr 2014 11:40:16 +0000 (12:40 +0100)]
fix accept nonzero as close from WRITEABLE callback
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 5 Apr 2014 15:48:48 +0000 (16:48 +0100)]
refactor use unified ssl read write functions
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 6 Apr 2014 05:26:35 +0000 (06:26 +0100)]
refactor add ssl read write single implementation
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 3 Apr 2014 15:34:09 +0000 (23:34 +0800)]
windows allow syslog log target to mao to stderr
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 3 Apr 2014 14:38:49 +0000 (22:38 +0800)]
windows fix breakage from plat refactor
Reported-by Marjan Tomas
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 3 Apr 2014 11:52:37 +0000 (19:52 +0800)]
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>
Andy Green [Thu, 3 Apr 2014 06:33:48 +0000 (14:33 +0800)]
http2 add initial alpn support
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 3 Apr 2014 02:17:00 +0000 (10:17 +0800)]
refactor ssl related code into ssl.c
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 3 Apr 2014 02:11:04 +0000 (10:11 +0800)]
clean small additional ifdef reduction
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 3 Apr 2014 01:03:37 +0000 (09:03 +0800)]
refactor handshake client and server handling into client.c and server.c
Eliminate more #ifdefs
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 3 Apr 2014 00:40:05 +0000 (08:40 +0800)]
refactor move flow control to server.c
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Thu, 3 Apr 2014 00:24:29 +0000 (08:24 +0800)]
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>
Andy Green [Wed, 2 Apr 2014 23:42:50 +0000 (07:42 +0800)]
refactor pollfd related functions into pollfd.c
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 23:36:41 +0000 (07:36 +0800)]
refactor service related functions into service.c
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 23:29:50 +0000 (07:29 +0800)]
refactor context related functions into context.c
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 23:17:10 +0000 (07:17 +0800)]
remove libev build tag
It's told during context init if it uses libev or not in the logs
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 23:16:40 +0000 (07:16 +0800)]
clean move lws_plat externs
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 15:03:23 +0000 (23:03 +0800)]
ipv6 use lws_plat_ to avoid win naming collision
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 13:31:07 +0000 (21:31 +0800)]
win32 inet_top
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 13:18:11 +0000 (21:18 +0800)]
changelog add info about cmake needing clean build dir sometimes
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 13:02:54 +0000 (21:02 +0800)]
plat change to build selection by cmake
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 11:45:42 +0000 (19:45 +0800)]
refactor out most NO_EXTENSIONS
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 2 Apr 2014 06:25:10 +0000 (14:25 +0800)]
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>
Andy Green [Tue, 1 Apr 2014 06:20:44 +0000 (14:20 +0800)]
truncated send issue independent of LWS_NO_EXTENSIONS 2
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Tue, 1 Apr 2014 03:24:44 +0000 (11:24 +0800)]
truncated send issue independent of LWS_NO_EXTENSIONS
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Tue, 1 Apr 2014 01:59:23 +0000 (09:59 +0800)]
only use clean buffer for failed write if sent something
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Tue, 1 Apr 2014 00:36:36 +0000 (08:36 +0800)]
libev protect when disabled at runtime in server.c
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Mon, 31 Mar 2014 14:03:09 +0000 (22:03 +0800)]
win32 clean remove leftover ifdef
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Mon, 31 Mar 2014 06:42:56 +0000 (14:42 +0800)]
fix libev build
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Mon, 31 Mar 2014 03:01:32 +0000 (11:01 +0800)]
clean libwebsockets.c
Signed-off-by: None <None>
Patrick Gansterer [Sun, 30 Mar 2014 08:19:23 +0000 (10:19 +0200)]
Cleanup header includes
Patrick Gansterer [Sun, 30 Mar 2014 08:18:51 +0000 (10:18 +0200)]
Remove useless usage of ssize_t
Patrick Gansterer [Sun, 30 Mar 2014 07:54:55 +0000 (09:54 +0200)]
Windows: Support LWS_POLLHUP socket event
Patrick Gansterer [Sun, 30 Mar 2014 07:18:05 +0000 (09:18 +0200)]
Introduce LWS_POLLIN, LWS_POLLOUT and LWS_POLLHUP
Andy Green [Sun, 30 Mar 2014 01:48:59 +0000 (09:48 +0800)]
Merge branch 'tid' of https://github.com/paroga/libwebsockets
Patrick Gansterer [Sat, 29 Mar 2014 08:34:24 +0000 (09:34 +0100)]
Add missing resetting of the service_tid on Windows
Patrick Gansterer [Sat, 29 Mar 2014 07:25:58 +0000 (08:25 +0100)]
Remove websock-w32.h
Patrick Gansterer [Sat, 29 Mar 2014 07:05:07 +0000 (08:05 +0100)]
Move #define for random() into the test applications where needed
Patrick Gansterer [Sat, 29 Mar 2014 06:52:37 +0000 (07:52 +0100)]
Remove unreferenced local variable on Windows
Patrick Gansterer [Sat, 29 Mar 2014 06:52:01 +0000 (07:52 +0100)]
Use Sleep() instead of usleep() on Windows
Patrick Gansterer [Sat, 29 Mar 2014 06:43:38 +0000 (07:43 +0100)]
Remove dummy headers for Windows