Commit graph

1015 commits

Author SHA1 Message Date
Andy Green
5462be9a44 client account for retries
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-22 12:32:20 +08:00
Andy Green
c93c47f3a4 client init fds pos to minus 1
Signed-off-by: Andy Green <andy@warmcat.com>
2016-04-22 12:31:50 +08:00
Justin Chen
6406f44b76 recv treat zero return as error
https://github.com/warmcat/libwebsockets/issues/475
2016-04-14 21:42:25 +08:00
Andy Green
ebfdb0d24d license clarification and test apps CC zero
The test apps are intended to be adapted into user code freely,
this relicenses them public domain to make that clear.

Fixes and improvements are of course still welcome.

LICENSE clarifies now that some sources also have a more liberal license,
it was always told in the source itself but now it's summarized.

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-08 08:46:05 +08:00
gaby64
784231a642 libev context destroy
https://github.com/warmcat/libwebsockets/issues/380
2016-01-29 08:40:11 +08:00
Andy Green
ba955592eb libev complete unix plat context init
https://github.com/warmcat/libwebsockets/issues/381

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 08:38:47 +08:00
Andy Green
c29af6641d fuzzer handle junk after upgrade header
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-21 11:10:26 +08:00
Andy Green
1587c5537d more return code checking
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 17:02:41 +08:00
Andy Green
5344b20c43 header fragment reject empty early
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:43:22 +08:00
Andy Green
9b2b9d1a7e parser issue_char audit
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:37:49 +08:00
Andy Green
e7f9232c1a avoid using deallocated things during context dedtroy
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:37:49 +08:00
Andy Green
bf6ba0427b remove double free attempts from no ACCEPT server response cleanup path
The generic wsi close code is smart enough to clean up after these allocations itself

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:37:49 +08:00
Andy Green
10da4c1236 fuzzer eliminate hsecond ah free path firing assert sentinel
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:37:49 +08:00
Andy Green
ffd361430c fuzzer rx overflow mitigate
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:37:49 +08:00
Andy Green
00e5eb8658 uridecoding lws_hdr_fragment_length
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:37:42 +08:00
Andy Green
0f8b1919ef uridecode no need to require length plus 2
length + 1 (for the '\0' is enough)

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:37:23 +08:00
Andy Green
7070968f94 uridecoding disallow uriencoded equals in name part
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:37:08 +08:00
Andy Green
466ad50d6a uridecoding handle plus chars as space
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:36:56 +08:00
Andy Green
4036b51690 uridecoding support optional semicolon as delimiter
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-20 09:36:41 +08:00
Andy Green
e70c63ba8f context protocol destroy provide nonnull wsi with context
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 01:08:14 +08:00
Andy Green
77ec61e44f server check cb return during establish
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 00:56:31 +08:00
Andy Green
da46eeea6b client check cb return during establish
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 00:50:14 +08:00
Andy Green
6d64539fcb lws_get_context not _ctx
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 18:25:25 +08:00
Andy Green
54806b1541 clean internal refactor
- Mainly symbol length reduction
 - Whitespace clean
 - Code refactor for linear flow
 - Audit @Context for API docs vs changes

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 17:03:59 +08:00
Andy Green
ddd79cbbb5 win cover clearing sock_send_blocking when external poll
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 15:35:41 +08:00
Andy Green
eee0d8af5f win solve various cranky problems with msvc
After emptyVoid at --->

https://github.com/warmcat/libwebsockets/issues/374

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 15:15:12 +08:00
Andy Green
71e267574d clean misc 1
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 08:30:06 +08:00
Andy Green
00c6d1579c public api remove context from user callback API BREAK
Since struct lws (wsi) now has his own context pointer,
we were able to remove the need for passing context
almost everywhere in the apis.

In turn, that means there's no real use for context being
passed to every callback; in the rare cases context is
needed user code can get it with lws_get_ctx(wsi)

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-17 07:54:44 +08:00
Andy Green
375a193ff4 windows fix wsapoll conflict on some toolchains
After EmptyVoid at github

https://github.com/warmcat/libwebsockets/issues/374

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-16 19:51:12 +08:00
Andy Green
11c05bfa09 public api remove superfluous context params API BREAK
Extend the cleanout caused by wsi having a context pointer
into the public api.

There's no point keeping the 1.5 compatibility work,
we have changed the api in several places and
rebuilt wasn't going to be enough a while ago.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-16 18:19:08 +08:00
Andy Green
8a97c06cd1 add LWS_INLINE to deal with crappy msvc
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-16 15:02:47 +08:00
Andy Green
4eb36373d7 http uri arguments process in fragments
This makes the URI argument processing split each parameter into
a "fragment".  Processing header content as fragments already exists
in lws, because it's legal to deliver header content by repeating
the header.

Now there's an api to access individual fragments, also add the
code to the test server to print each URI argument separately.

Adapt attack.sh to parse the fragments.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-15 23:07:31 +08:00
Andy Green
f35801b19d URIPS_ARGUMENTS is redundant
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-15 23:05:23 +08:00
Andy Green
fac92eb7cb document how the header fragments work
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-15 23:03:29 +08:00
Andy Green
566eb4381c introduce lws_hdr_copy_fragment
This adds a public API variant of the header copy api that lets you
choose which fragment you want copied.

Normally you want the existing one that aggregates the fragments.

But it can be useful to get each part in turn (that corresponds to
the content provided by each duplicated header normally).

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-15 22:59:23 +08:00
Andy Green
6b5de70f4f refactor needless context with wsi paramater passing
Now we bit the bullet and gave each wsi an lws_context *, many
internal apis that take both a context and wsi parameter only
need the wsi.

Also simplify parser code by making a temp var for
allocated_headers * instead of the longwinded
dereference chain everywhere.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-15 21:15:58 +08:00
Andrejs Hanins
ea592fa869 Fix corruption of close reason code in close frame
According to specification, close reason code is part of body
2015-12-15 19:46:33 +08:00
Andy Green
3decfe60ab mbed3 use new upstream mbed3 nagle disable
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-15 19:46:28 +08:00
Andy Green
38f3225b22 uriencoding deal with0uriencoded question mark properly
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 19:42:26 +08:00
Andy Green
ab4a94dd46 win align to recent changes
These were warnings seen on Appveyor

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 12:00:20 +08:00
Andy Green
1fa7685a28 mbed3 align to recent changes
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 11:17:16 +08:00
wmarquesr
c718ff30d8 Refactoring conditional directives for if wrappers 2015-12-14 09:39:56 +08:00
Andy Green
40110e84ab whitespace trailing mass cleanout
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 08:52:03 +08:00
Andy Green
a01fb52d09 libev take care about const context where possible
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 07:51:15 +08:00
Andy Green
3f62870e67 introduce lws_wsi_user
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 07:16:32 +08:00
Andy Green
891628b33c lws_plat_fd add wsi to fops and helpers
Having the lws_context alone doesn't let us track state or act different
by wsi, which is the most interesting usecase.  Eg not only simply track
file position / decompression state per wsi but also act differently
according to wsi authentication state / associated cookies.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 06:43:35 +08:00
Andy Green
d2ac22c27a make protocols const require explicit context API BREAK
The user protocols struct has not been const until now.

This has been painful for a while because the semantics of the protocols
struct look like it's going to be treated as const.

At context creation, the protocols struct has been getting marked with the context,
and three apis exploited that to only need to be passed a pointer to a protocol to
get access to the context.

This patch removes the two writeable members in the context (these were never directly
used by user code), changes all pointers to protocols to be const, and adds an explicit
first argument to the three affected apis so they can have access to context.

The three affected apis are these

 LWS_VISIBLE LWS_EXTERN int
-lws_callback_on_writable_all_protocol(const struct lws_protocols *protocol);
+lws_callback_on_writable_all_protocol(const struct lws_context *context,
+                                     const struct lws_protocols *protocol);

 LWS_VISIBLE LWS_EXTERN int
-lws_callback_all_protocol(const struct lws_protocols *protocol, int reason);
+lws_callback_all_protocol(struct lws_context *context,
+                         const struct lws_protocols *protocol, int reason);

 LWS_VISIBLE LWS_EXTERN void
-lws_rx_flow_allow_all_protocol(const struct lws_protocols *protocol);
+lws_rx_flow_allow_all_protocol(const struct lws_context *context,
+                              const struct lws_protocols *protocol);

unfortunately the original apis can no longer be emulated and users of them must update.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 06:43:26 +08:00
Andy Green
8203be6742 lws_get_ctx conversion
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 06:43:24 +08:00
Andy Green
0161f01082 win open flags 3 lsb are not bitfields
https://github.com/warmcat/libwebsockets/issues/367

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 06:40:53 +08:00
Yusuke Ishiguro
a951396cc2 Revert using AI_V4MAPPED flag to getaddrinfo for Android
Because getaddrinfo will return error on Android when
AI_V4MAPPED is specified. So we should use old implemntation.
Android support of IPv6 is very poor.
2015-12-11 17:37:49 +08:00