Commit graph

46 commits

Author SHA1 Message Date
Andy Green
0b7ca30ed1 gcc- format strings: debug and extra plugins 2017-02-05 22:32:07 +08:00
Namowen
d2cb05f1f6 echo: fix debug build
https://github.com/warmcat/libwebsockets/issues/716#issuecomment-267377856
2016-12-16 07:05:29 +08:00
Peter Pentchev
fb71b790cd Subject: Fix some typographical and grammatical errors. 2016-10-03 21:31:27 +08:00
Fredrik Skogman
9c04a107c9 Updated test programs to build on Solaris. Some whitespaces cleanup. 2016-09-10 04:53:28 +08:00
Andy Green
c6fd360160 LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT to default to runtime ssl disable
https://github.com/warmcat/libwebsockets/issues/468

Adds lws_check_opt() to regularize multibit flag checking.

There's a new context creation flag LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT,
this is included automatically if you give any other SSL-related option flag.
If you give no SSL-related option flag, nor this one directly, then even
though SSL support may be compiled in, it is never initialized nor used for the
whole lifetime of the lws context.

Conversely in order to prepare the context to use SSL, even though, eg, you
are not listening on SSL but will use SSL client connections later, you can
give this flag explicitly to make sure SSL is initialized.

Signed-off-by: Andy Green <andy@warmcat.com>
2016-03-23 09:22:11 +08:00
Andy Green
083c73e7e9 license clarification and test apps CC zero
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-08 08:44:21 +08:00
Andy Green
92f96f3edf cleanup test app startup messages
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-29 09:35:58 +08:00
Andy Green
5b3736682d lws_client_connect_via_info
https://github.com/warmcat/libwebsockets/issues/396

Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-12 17:22:06 +08:00
Andy Green
6711266a50 extension permessage deflate
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-01-11 11:34:01 +08:00
Andy Green
44a7f65e1a introduce LWS_SERVER_OPTION_VALIDATE_UTF8
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-29 11:20:09 +08:00
Andy Green
d5be3bf749 autobahn test echo extend max echo and follow message boundary
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-28 13:43:59 +08:00
Andy Green
e7d8e20f56 autobahn test echo meddling
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-28 11:12:05 +08:00
Andy Green
3246ebb3f5 deprecate LWS_SEND_BUFFER_POST_PADDING
The only guy who cared about this for a long while
(since I eliminated the pre-standard protocol variants)
was sending a close frame.

 - Set it to 0 so old code remains happy.  It only affects
user code buffer commit, if there's overcommit no harm
done so no effect directly on user ABI.

 - Remove all uses inside the library.  The sample apps
don't have it any more and that's the recommendation now.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-26 12:03: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
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
40110e84ab whitespace trailing mass cleanout
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-14 08:52:03 +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
4b85c1d4ac api rationalization: eliminate all libwebsocket[s]_ prefixes
This nukes all the oldstyle prefixes except in the compatibility code.

struct libwebsockets becomes struct lws too.

The api docs are updated accordingly as are the READMEs that mention
those apis.

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-04 11:08:32 +08:00
Andy Green
6230476455 api rationalization use new names internally
Change all internal uses of rationalized public apis to reflect the
new names.

Theer are a few things that got changed as side effect of search/replace
matches, but these are almost all internal.  I added a compatibility define
for the public enum that got renamed.

Theoretically existing code should not notice the difference from these
two patches.  And new code will find the new names.

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

Signed-off-by: Andy Green <andy.green@linaro.org>
2015-12-04 08:43:54 +08:00
Andy Green
0779964ec1 test echo initial delay
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-11-17 09:30:36 +08:00
Stephan Eberle
b820e2c2cc Implemented fixes allowing libwebsockets to be built under Windows using MinGM/MSYS
Improvemed patches to address travis and appveyor build errors

Reduced WINVER and _WIN32_WINNT to 0x0501 to be less restrictive

Refined CMakeLists.txt to allow for normal Windows and MinGW-specific OpenSSL certificate generation

Simplified include path to gettimeofday.h

Removed unnecessary list(APPEND LWS_LIBRARIES zlib_internal) export

Added back #include <windows.h> to gettimeofday.c to fix build for normal Windows

Made sure that pollfd gets defined on libwebsockets side when _WIN32_WINNT < 0x0600

Made sure that WINVER and _WIN32_WINNT don't get overridden by libwebsockets headers when already set to something greater than 0x0501

Added missing declaration of WSAPoll function for WINVER < 0x0600 in libwebsockets.h, eliminated invalid usages of pollfd instead of libwebsocket_pollfd in test-server.c

Cleaned up duplicate content in gettimeofday.c, removed header inclusions from gettimeofday.h and fixed include order in test-echo.c, test-ping.c and test-server.c to enable build with normal Windows and MinGW

Re-enabled debug_level in test-echo.c and made sure that the call to lws_set_log_level() is also active under Windows (just like in test-server.c); replaced all WIN32 occurrences by _WIN32 in test-echo.c, test-ping.c, and test-server.c

Removed build-msys.sh and added new section about how to build libwebsockets using MinGW to README.build.md
2015-10-30 00:16:40 +01:00
Roger A. Light
7a474b4e2d Separate private defines in lws_config_private.h
So we don't expose all HAVE_ macros and such to the world.
2015-10-12 10:10:20 +08:00
wonder-mice
41802c7a98 From 04da2ccd1e8c5b582c4e2a77ee53f929ae8f22a0 Mon Sep 17 00:00:00 2001
Subject: [PATCH] Always include lws_config.h since now we have only CMake
 build
2015-04-23 06:10:51 +08:00
Andy Green
15ac07f1a0 test echo put proper origin
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-04-07 07:52:23 +08:00
Andy Green
16fb0132ce prepare for v1.4
Signed-off-by: Andy Green <andy.green@linaro.org>
2015-03-28 11:35:40 +08:00
Andy Green
6d91d5f8a1 test ping correct type for fprintf
Reported-by: Michael Habeler <mail17@mah.priv.at>
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-12-02 08:42:47 +08:00
Andy Green
613bc32f73 test echo unbreak no server
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-12-01 22:16:17 +08:00
Andy Green
303f65fbe2 test echo versa + uri
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-12-01 21:46:35 +08:00
Andy Green
fb8f2b0a73 test echo add port to server host
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-12-01 21:02:55 +08:00
Andy Green
0f59c9e75c coverity 83668 test echo nesting level bug
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-11-30 12:50:12 +08:00
Andy Green
6a33759bb1 83675 test echo param could bust bounds
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-11-30 12:42:14 +08:00
Andy Green
745a69e7ce test echo initialize listen port
Signed-off-by: Andy Green <andy.green@linaro.org>
2014-11-26 14:36:17 +08:00
Andy Green
752963da00 test-echo: enable for ssl cert serving and verification 2014-11-18 09:28:35 +08:00
Patrick Gansterer
fc5734c339 Remove dummy headers for Windows 2014-03-29 07:43:38 +01:00
Jakob Flierl
af8694d203 make force_exit volatile.
Instruct the compiler to always access force_exit in memory.
2014-02-15 13:51:16 +08:00
martell
19c73f3bed fixed windows build 2014-02-15 13:34:25 +08:00
Andy Green
86aa80509f trac 29 echo remoe mention of syslog constants for win32
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-05-02 07:04:54 +08:00
Andy Green
70d6717afb trac 29 avoid syslog in echo test if win32
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-04-30 06:53:56 +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
Joakim Soderberg
7eadd586b1 Fixed CMake compile options.
Fixed so that the build options for the CMake project works:

- The test apps used the LWS_NO_EXTENSIONS define, so they needed lws_config.h included when building using CMake.
- Rename some options so that individual test apps can be turned off.
- Separate building the test-client/test-server and compiling the server/client parts into the lib.
- Don't include server or client specific sources into the build if they shouldn't be built.
- Added an error if both client and server parts are excluded at the same time (makes no sense).
- Removed duplicate install targets for the test apps.
- Commented out the WITH_LIBCRYPTO option since it isn't used at the moment.
2013-02-22 09:28:04 +08:00
Andy Green
3ad2ecfbd8 update echo to use externsion getting api
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-13 09:34:53 +08:00
Andy Green
0f13459048 echo test app needs different lockfile
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-12 22:44:43 +08:00
Andy Green
728569af60 update test echo for iface info member namechange
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-12 10:13:15 +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
cbb3122ab4 fixes for without server and without client
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-31 09:57:05 +08:00
Andy Green
769153ec5d introduce test echo
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-30 12:28:44 +08:00