Commit graph

347 commits

Author SHA1 Message Date
Alejandro Mery
ac3ec39bb1 Subject: [PATCH] Introduce lws_free2() helper to free and re-NULL pointers
Signed-off-by: Alejandro Mery <amery@geeks.cl>
2014-12-05 07:27:52 +08:00
Alejandro Mery
6ff28248aa Subject: [PATCH] Use custom allocator
Signed-off-by: Alejandro Mery <amery@geeks.cl>
2014-12-05 07:26:26 +08:00
Andy Green
44c116172d lws_union_transition
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-11-08 11:18:47 +08:00
Andrew Canaday
03f0ceaf97 Be sure to invoke *lws_free_header_table*:
* Just prior to freeing a session
 * When allocating a new header table

This prevents some memory leaks we've found.
2014-11-08 09:02:22 +08:00
Andrew Canaday
a19d485b80 Don't free wsi->u.hdr.ah except through lws_free_header_table (exception: server.c frees 'ah' after copying the header pointer and transitioning the union state). 2014-11-07 11:25:36 +08:00
Andy Green
97ee57fa35 http2 window update
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-11-02 06:54:09 +08:00
Drew Noakes
efe10b0f42 Subject: [PATCH] Fix minor typos in code documentation 2014-10-23 22:57:05 +08:00
Andy Green
7df53c5550 http2 alpn npn pollout
This adds npn / alpn support if your openssl can handle it.
Then, browsers that understand alpn will by default
negotiate http/1.1 and work as normal.

Clients that understand http2.0 can negotiate h2-14 and
use the basic but working http2.0 support automatically

Signed-off-by: Andy Green <andy.green@linaro.org>
2014-10-22 15:38:12 +08:00
Andy Green
260a0fce54 add newline on libwebsockets.c for ancient compilers
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-10-18 18:56:25 +08:00
Andy Green
1e49918a4f trac 89 add flag on fatal send fail to use simple close
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-10-16 08:23:46 +08:00
Andy Green
024eb6c80c http2 can keep upgraded connection up
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-10-08 12:00:53 +08:00
Duncan Tebbs
54d037e177 Pass user_sapce to callback for LWS_CALLBACK_CLIENT_CONNECTION_ERROR 2014-09-26 05:36:37 +08:00
Stefan Schuermans
b944cc1248 also callback closed if flushing 2014-09-08 14:01:58 +08:00
Andy Green
82bac6baec defer PONG send until no partial send buffer
Reported-by: Andrew Canaday
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-24 14:39:19 +08:00
Andy Green
fc9871ec24 fix build without ssl support
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-19 08:41:26 +08:00
Andy Green
14425eae4e introduce lws_partial_buffered
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-18 22:49:39 +08:00
Andy Green
b128ccccca add lws_is_ssl api
Suggested by Michael Harbler on the mailing list

Signed-off-by: Andy Green <andy.green@linaro.org>
2014-08-16 09:54:27 +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
Cong Ma
10da117b84 fix confusion ull in latency reporting 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
vpeter4
4dd8ada592 Disable compile warning: no newline at end of file 2014-04-27 13:28:22 +02: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
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
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
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
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
d474135424 refactor service related functions into service.c
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-03 07:43:40 +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
0d4a346177 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>
2014-04-03 07:17:10 +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
1cd3ba6fdc ipv6 use lws_plat_ to avoid win naming collision
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-02 23:03:23 +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
Andy Green
f9196dd85c truncated send issue independent of LWS_NO_EXTENSIONS
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-04-01 11:24:44 +08:00
Andy Green
4e1462d890 fix libev build
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-03-31 14:42:56 +08:00
Andy Green
bfaea95f60 clean libwebsockets.c
Signed-off-by: None <None>
2014-03-31 11:01:32 +08:00
Patrick Gansterer
c3e8337bbd Windows: Support LWS_POLLHUP socket event 2014-03-30 09:54:55 +02:00
Patrick Gansterer
b47f87b04b Introduce LWS_POLLIN, LWS_POLLOUT and LWS_POLLHUP 2014-03-30 09:18:05 +02:00
Andy Green
e85ddb4822 Merge branch 'tid' of https://github.com/paroga/libwebsockets 2014-03-30 09:48:59 +08:00
Patrick Gansterer
0bf8fe51bf Add missing resetting of the service_tid on Windows 2014-03-29 09:34:24 +01:00
Patrick Gansterer
73882e49fc Remove websock-w32.h 2014-03-29 08:25:58 +01:00
Patrick Gansterer
970e19ceaa Remove unreferenced local variable on Windows 2014-03-29 07:52:37 +01:00
Patrick Gansterer
8df031d336 Remove emulated_poll on Windows 2014-03-29 07:15:40 +01:00
Patrick Gansterer
0fc37b64f6 windows Use WSAWaitForMultipleEvents() instead of poll() on Windows 2014-03-29 09:54:40 +08:00
Patrick Gansterer
8c020f2363 Build fixes for WindowsCE 2014-03-29 09:54:05 +08:00
Patrick Gansterer
6ff04bb459 Remove duplicated code for setting the socket options 2014-03-28 19:48:35 +08:00
Patrick Gansterer
0447329414 Fix IPv6 on non-Linux platforms 2014-03-28 16:04:43 +08:00
Patrick Gansterer
a616300091 Fix nonblocking connect on Windows
Use the correct value for the call to ioctlsocket() to set the socket to
nonblocking mode and check for WSAWOULDBLOCK return value of connect().
2014-03-28 10:56:23 +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