Commit graph

801 commits

Author SHA1 Message Date
Karl Palsson
95a8abb030 cyassl: correct include path for 3.1.x 2014-08-15 01:54:59 +08:00
Michael Haberler
a2d3bf1e4d api: add feature test macro LWS_FEATURE_PROTOCOLS_HAS_ID_FIELD 2014-08-11 20:49:16 +08:00
Andy Green
eabed8defe protocol struct add user controlled id member
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-11 12:11:36 +08:00
Andy Green
afa10d5a89 fix spinning on NULL protocol name
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-11 09:11:57 +08:00
Andy Green
62824f96d4 ssl fix excessive crash workaround
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-10 09:50:42 +08:00
Andy Green
a40760a2de no protocol usage inprove docs
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-07 16:52:15 +08:00
Andrew Canaday
e917345e05 Reset hdr_parsing_completed for WSI_STATE_HTTP:
This fixes a bug where a client issues two GET requests on the same connection
(keep-alive). If the second request is split into two reads, the
hdr_parsing_complete flag gets us into trouble by ending the request read two
early and giving us bogus data.
2014-08-07 12:13:28 +08:00
Andy Green
67f94599d2 trac82 consistently use CONTEXT_PORT_NO_LISTEN
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-07-31 09:44:00 +08:00
Oleh
faeac3c419 ssl allow passing cert passphrase
https://github.com/warmcat/libwebsockets/issues/152
2014-07-29 23:18:41 +08:00
Andy Green
c949bb3b49 avoid crash if we dont have new wsi
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-07-29 23:02:07 +08:00
Aurelian Pop
d07ea3bf40 Fix TCP keepalive use in UNIX systems 2014-07-29 15:36:06 +03:00
Andrew Canaday
78228ed5cb 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?
2014-07-19 07:01:10 +08:00
Andrew Canaday
c7dbad66ab Make sure headers are parsed before proceeding. 2014-07-19 07:00:52 +08:00
Andrew Canaday
991f1cded8 Only check for '?' URI args during URI path parse 2014-07-19 06:58:53 +08:00
Andy Green
7a8d86e048 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>
2014-07-19 06:52:39 +08:00
Andrew Canaday
3bb0650e6a Don't need 'content_remain' in libwebsocket_read 2014-07-14 20:33:07 +08:00
Andrew Canaday
afe26cf4a6 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
2014-07-14 20:19:43 +08:00
Andrew Canaday
7c67634fec libwebsockets_read: update 'len' after lws_handshake_server invocation 2014-07-08 06:15:25 +08:00
AndyMcG
7ab4edebe3 Trac 75: fix uxexpected ssl connection close 2014-07-06 09:36:44 +08:00
Andy Green
f55b2eff0a 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>
2014-07-06 09:36:44 +08:00
Cong Ma
10da117b84 fix confusion ull in latency reporting 2014-07-06 09:36:44 +08:00
kolis
981fb47f9b partial send handling 2014-07-06 09:36:44 +08:00
Andy Green
97850857b3 dont free externally allocated user_space when closing connection
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-07-06 09:36:43 +08:00
geq
d6827f7741 fix build on OpenBSD 2014-07-06 09:36:43 +08:00
Andrew Canaday
da55fb5208 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
2014-07-06 09:36:43 +08:00
Andrew Canaday
18fd4f6722 Reducing CPU cycles spent calculating per-header length limit. 2014-07-06 09:33:40 +08:00
Andrew Canaday
3d2ebf3cd7 Added docs for token limits. 2014-07-06 09:33:40 +08:00
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
Andrew Canaday
b57e7a0e2e Added HTTP_STATUS_NO_CONTENT == 204 2014-07-06 09:33:40 +08:00
Andrew Canaday
f3b6f25e6a Added comma after if-none-match... 2014-06-30 05:54:16 -04:00
Andrew Canaday
4220327520 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
2014-06-28 20:19:57 -04:00
Andy Green
dfca3abfa1 clean partial send handling warning
Reported-by: Michael Haberler <mail17@mah.priv.at>
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-05-22 11:12:15 +08:00
kolis
f77e6e33d1 Partial send handling
AG removed what looked like redundant set eff_buf.token_len <- n
2014-05-20 12:38:29 +08:00
vpeter4
7cc7ae476a 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";
2014-04-28 07:32:14 +08:00
vpeter4
590fb70102 Conditionally declare variable 2014-04-28 07:32:14 +08:00
vpeter4
e035f2ea3e Compile with older OpenSSL library (missing symbol SSL_set_tlsext_host_name) 2014-04-28 07:32:13 +08:00
vpeter4
7c00fc3d9d Disable compile error: statement with no effect 2014-04-27 13:35:28 +02:00
vpeter4
4dd8ada592 Disable compile warning: no newline at end of file 2014-04-27 13:28:22 +02:00
Andy Green
6ea337aa3e 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>
2014-04-21 08:27:19 +09: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
c11b847fa8 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.
2014-04-15 18:45:48 +02:00
Patrick Gansterer
fb9dc57068 Windows: Use gai_strerrorW() instead of gai_strerror()
This allows compilation on Windows CE too.
2014-04-15 18:42:57 +02:00
Patrick Gansterer
fe0ca596d6 Windows: Fix the passed parameter to the setsockopt function
This avoids compiler warnings about missmatched parameter types.
2014-04-15 18:41:38 +02: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
f004ec594e 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>
2014-04-12 11:47:25 +08: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