1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00
Commit graph

134 commits

Author SHA1 Message Date
kapejod
ce64fb0f58 Support for HTTP POST.
Rewritten by Andy Green to use chunks, add timeout, use extra states in handshake not parser.

Signed-off-by: Andy Green <andy@warmcat.com>
2013-11-24 10:36:37 +08:00
Andy Green
7900256c8a allow other headers in http send file
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-11-09 11:40:38 +08:00
Andy Green
81877e6a4c v1.2.3 changelog update
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-10-26 20:36:08 +08:00
Andy Green
5dc62ead9d trac 40 client connection properly nonblocking
As spotted by JM on Trac#40

http://libwebsockets.org/trac/libwebsockets/ticket/40

client connect didn't do anything about being truly nonblocking.  This patch
should hopefully solve that.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-09-20 20:26:12 +08:00
Andy Green
96d48fdc28 change LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION user param usage
Also audit the bail_nuke_ah usage as Daniel Griscom suggested.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-09-18 08:32:55 +08:00
Andy Green
0c9563bbd2 add LWS_CALLBACK_CLOSED_HTTP
Adds a callback to allow handling HTTP protocol connections
closing.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-06-10 22:54:40 +08:00
Andy Green
b55451c6d2 introduce api for unthrottle all connections of protocol
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-03-16 12:43:22 +08:00
Andy Green
0097a99082 remove autotools build
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-03-09 13:06:37 +08:00
Andy Green
58f214ea0c document revent clearing scheme
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-03-09 13:03:53 +08:00
Andy Green
fc7c5e4539 reflect send completeness in lws_write return
under load, writing packet sizes to the socket that are normally fine
can do partial writes, eg asking to write 4096 may only take 2800 of
it and return 2800 from the actual send.

Until now lws assumed that if it was safe to send, it could take any
size buffer, that's not the case under load.

This patch changes lws_write to return the amount actually taken...
that and the meaning of it becomes tricky when dealing with
compressed links, the amount taken and the amount sent differ.  Also
there is no way to recover at the moment from a protocol-encoded
frame only being partially accepted... however for http file send
content it can and does recover now.

Small frames don't have to take any care about it but large atomic
sends (> 2K) have been seen to fail under load.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-23 10:50:10 +08:00
Andy Green
2672fb2d68 move ssl cipher list from compiletime to context creation time option
More flexible this way... NULL for the new member means use
the ssl library default set of ciphers, so as long as your info
struct is zerod by bss or memset, you don't need to do anything
about this change unless you want to set the cipher list.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-22 09:54:35 +08:00
Edwin van den Oetelaar
8c8a8e149d provide socketfd at in param for LWS_CALLBACK_FILTER_NETWORK_CONNECTION
Signed-off-by: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-20 20:56:59 +08:00
Andy Green
dc914cfebb document ensure_user_space going private
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 16:54:26 +08:00
Andy Green
50097dd078 api change deliver socket fd to in param of extpoll callbacks
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-15 22:36:30 +08:00
Andy Green
54cb346320 introduce LWS_CALLBACK_HTTP_WRITEABLE
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 22:23:54 +08:00
Andy Green
53a4678608 update 1.21 changelog
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 11:23:49 +08:00
Andy Green
182cb9ae5f update changelog
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-13 11:54:08 +08:00
Andy Green
c3ef0d600a add cyassl keepalive valgrind minimal mem to changelog
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-12 10:50:49 +08:00
Andy Green
508946cefd api make close api private only
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-12 10:19:08 +08:00
Andy Green
70edd6fb80 api remove hangup_on_client
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-12 10:15:25 +08:00
Andy Green
a7109e6ebf valgrind introduce protocol init and destroy user callbacks
To get a clean bill of health from valgrind, we have to have a way to
inform the user code that we're going down and it should free everything
it is holding that was malloc'd.

This patch introduces LWS_CALLBACK_PROTOCOL_DESTROY which each protocol
gets when the context is being destroyed and no more activity will come
after that call.  They can get rid of everything there.

To match it, LWS_CALLBACK_PROTOCOL_INIT is introduced which would allow
one-time init per protocol too.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-11 12:05:54 +08:00
Andy Green
16ab3185c4 replace per header mallocs with single malloc 3 level struct
This big patch replaces the malloc / realloc per header
approach used until now with a single three-level struct
that gets malloc'd during the header union phase and freed
in one go when we transition to a different union phase.

It's more expensive in that we malloc a bit more than 4Kbytes,
but it's a lot cheaper in terms of malloc, frees, heap fragmentation,
no reallocs, nothing to configure.  It also moves from arrays of
pointers (8 bytes on x86_64) to unsigned short offsets into the
data array, (2 bytes on all platforms).

The 3-level thing is all in one struct

 - array indexed by the header enum, pointing to first "fragment" index
	(ie, header type to fragment lookup, or 0 for none)

 - array of fragments indexes, enough for 2 x the number of known headers
	(fragment array... note that fragments can point to a "next"
	fragment if the same header is spread across multiple entries)

 - linear char array where the known header payload gets written
	(fragments point into null-terminated strings stored in here,
	only the known header content is stored)

http headers can legally be split over multiple headers of the same
name which should be concatenated.  This scheme does not linearly
conatenate them but uses a linked list in the fragment structs to
link them.  There are apis to get the total length and copy out a
linear, concatenated version to a buffer.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-11 11:10:57 +08:00
Andy Green
895d56d4ce remove minimum frame size for deflate
The idea here seems wrong, if we have a mixture of frames of varying
sizes above and below the limit, we segfault in deflate after skipping
it once.

If the protocol doesn't want compression because many frames are
small, it should veto the extension in the user callback.  If only
a few frames are tiny, the overhead for compressing it all is tiny.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-11 10:18:31 +08:00
Andy Green
a3957ef804 stop O2 override
Now we are building with -O0 -g and debug enabled by default.
--disable-debug in configure will get you a -04 without -g

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-11 09:31:43 +08:00
Andy Green
a47865fa19 dont try set per socket keepalive timing on bsds
As per http://libwebsockets.org/trac/ticket/10
BSD doesn't support setting keepalive info per-socket

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-10 09:39:47 +08:00
Andy Green
a690cd066e introduce keepalive option and make common socket options function
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-09 14:27:38 +08:00
Andy Green
1b26527e72 change context creation params to struct
*** This patch changes an API all apps use ***

Context creation parameters are getting a bit out of control, this
patch creates a struct to contain them.

All the test apps are updated accordingly.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-09 14:01:09 +08:00
Andy Green
5449511d3e remove fixed rx buffer allow definition per protocol
A new protocol member is defined that controls the size of rx
buffer allocation per connection.  For compatibility 0 size
allocates 4096, but you should adapt your protocol definition
array in the user code to declare an appropriate value.

See the changelog for more detail.

The advantage is the rx frame buffer size is now tailored to
what is expected from the protocol, rather than being fixed
to a default of 4096.  If your protocol only sends frames of
a dozen bytes this allows you to only allocate an rx frame
buffer of the same size.

For example the per-connection allocation (excluding headers)
for the test server fell from ~4500 to < 750 bytes with this.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-08 13:16:07 +08:00
Andy Green
9b09dc0213 remove all PATH_MAX or MAX_PATH
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-08 13:11:47 +08:00
Andy Green
ed334463e8 changelog header lifecycle
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-07 21:14:33 +08:00
Andy Green
df60b0c089 update changelog about cmake
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-07 20:25:28 +08:00
Andy Green
7b40545e92 introduce library version plus git hash
This exposes the library version and git head hash it was built from
into LWS_LIBRARY_VERSION and LWS_BUILD_HASH.

These are combined into a version string that's both printed as a
notice log by the library and made available to the app using a new
api lws_get_library_version().  The version looks like

 1.1 178d78c

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-01 10:50:15 +08:00
Andy Green
bd1132f9ac update changelog tag chrome 26 firefox 18
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-31 19:53:05 +08:00
Andy Green
a35c86f115 add changelog v1.0 to v1.1
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-31 11:01:39 +08:00