Commit graph

1880 commits

Author SHA1 Message Date
gaby64
d8383ca5fc libev context destroy
https://github.com/warmcat/libwebsockets/issues/380
2015-12-22 12:41:12 +08:00
Andy Green
8933eaf2f3 test ping android compatibility
After "emptyVoid" at

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-22 08:17:34 +08:00
Roger A. Light
cc5dff9bb1 Subject: [PATCH] Typo in macro name. 2015-12-19 10:47:12 +08:00
Andy Green
e974f0c252 uridecoding lws_hdr_fragment_length
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-19 07:35:23 +08:00
Andy Green
ab5ed3c8e1 whitespace tidy
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-19 07:18:55 +08:00
Andy Green
9f54c1ff73 uridecode no need to require length plus 2
length + 1 (for the '\0' is enough)

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 16:40:02 +08:00
Andy Green
3ba035dc2c uridecoding disallow uriencoded equals in name part
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 15:40:03 +08:00
Andy Green
8b9fe99dee uridecoding handle plus chars as space
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 15:23:31 +08:00
Andy Green
03d7e9d331 uridecoding support optional semicolon as delimiter
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 15:20:09 +08:00
Andy Green
f1cf5bec53 version 1.6.0
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 11:19:45 +08:00
Andy Green
1849e5e74a api doc v1.6.0
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 11:18:56 +08:00
Andy Green
9e8d148912 changelog pre v1.6.0
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 11:01:03 +08:00
Andy Green
4588e4e415 clean uri arg dump
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-18 10:46:24 +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
Roger A. Light
e59908e7fc Subject: [PATCH] Add LWS_LIBRARY_VERSION_NUMBER to lws_config.h.
This changeset adds a few preprocessor macros to lws_config.h to allow
a user of libwebsockets to determine at compile time which version of
lws they are compiling against.

This exposes the already existing LWS_LIBRARY_VERSION_MAJOR and _MINOR
values, and adds LWS_LIBRARY_VERSION_PATCH. This suggests that future
minor bugfix release versions of lws would be e.g. 1.6.0 -> 1.6.1 rather
than the style used previously: 1.2 -> 1.21.

The way this is currently set up means new minor revisions (with
_PATCH==0) always end with .0 but I could change this if preferred.

The most important addition is LWS_LIBRARY_VERSION_NUMBER, which
produces a number of the form 1005001 for version 1.5.1 - i.e. each part
major, minor, patch can extend from 0-999. This macro allows a very easy
compile time comparison of version numbers.
2015-12-15 19:49:55 +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
3f59996e67 changelog update file api about wsi
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 07:21:42 +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
1a366bf946 changelog explain protocols related api changes
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 07:02:51 +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
Andy Green
21da5613c6 windows fcntl.h
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-10 13:21:07 +08:00
Andy Green
cca0d7d27f LWS_O_RDONLY to hide perversions
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-10 13:03:10 +08:00
Andy Green
4812551234 osx fix unsigned signed compare error 2
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-10 13:00:15 +08:00