Commit graph

2159 commits

Author SHA1 Message Date
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
Andy Green
8699cec50f remove MAX_HEADER_NAME_LENGTH from header
Still lurking aound as a ghost after all real usess of it
were removed with the minilex changes.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-22 09:38:54 +08:00
Joakim Soderberg
c7ed2be638 Fix running test programs from within visual studio.
Copy test-server data to a path so that we can run the test-server from
within visual studio without having to copy stuff around.
2013-02-22 09:28:17 +08:00
Joakim Soderberg
b82b0dd118 Print SSL error codes as well as the string.
CYASSL doesn't compile with the error strings in some configurations, so
it is nice to have the error code on SSL errors as well.
2013-02-22 09:28:15 +08:00
Joakim Söderberg
51197c0d6f Set the _DEBUG macro for CMake also. 2013-02-22 09:28:13 +08:00
Joakim Soderberg
20aedc89c1 Fixed ssl cert generation on Windows. 2013-02-22 09:28:11 +08:00
Joakim Soderberg
b37827b651 Added CPack support + some more.
- "make dist" will now produce a tar.gz file. This includes everything (not really what we want but a start).
- Got rid of a bunch of defines and variables that aren't used.
- Added the option LINK_TESTAPPS_DYNAMIC that enables linking to the shared library version of the lib for the test apps, instead of doing it statically like the default is.
- Fixed proper support for the --prefix stuff (-DCMAKE_INSTALL_PREFIX for cmake). (Don't specify /usr/local explicitly, that is the default anyway and will break other platforms).

- Note: I noticed a problem with the "INSTALL_DATADIR" define used by the test-apps. Since we hard code the path to the certs using this, doing "DESTDIR=/bla make install" will result in not being able to use the SSL mode for the test-apps since they won't find the certs. (This also applies to the autoconf project). Fixed this by setting "../share" as the default location instead of using the prefix.
2013-02-22 09:28:08 +08:00
Joakim Soderberg
11a8cda204 BUGFIX: Fixed bug for installing test-apps for CMake.
Appending to the TEST_APP_LIST variable function did not work from within the create_test_app function (It would create a function scope variable with the same name and discard it). We instead need to use a macro for this.

The previous commit also removed the duplicate install for the test-apps (because we want all the install steps in one place in the file for clarity). That change made it obvious that the TEST_APP_LIST never gets populated.
2013-02-22 09:28:06 +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
Joakim Soderberg
fcec61c576 getifaddrs missing more user friendly in CMake.
Don't require the user to enable using the built-in BSD getifaddrs implementation on systems such as uclibc that lacks it manually.

Instead if getifaddrs doesn't exist, use the BSD one automatically, except if the user explicitly tells the user not to do this using WITHOUT_BUILTIN_GETIFADDRS (which will result in a compilation error, but at least with a nice error message explaining why).
2013-02-22 09:28:02 +08:00
Joakim Soderberg
3baa08cac3 Fix LWS_NO_SERVER build.
"int n" was used also when server parts are not compiled, so don't put it inside the LWS_NO_SERVER ifdef.
2013-02-22 09:27:59 +08:00
Joakim Soderberg
fe2dae759d Bugfix compiling for cross compiling.
! does not mean NOT, use NOT instead :)
2013-02-22 09:27:57 +08:00
Larry Hayes
bb66ac6ec1 keepalive swap interval and probes
The interval and probes members for setting keepalive options
per-connection on Linux were swapped.

Signed-off-by: Larry Hayes <lhayesg@gmail.com>
2013-02-22 09:16:20 +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
1c6e1422e6 trac 18 deal with service connection timing out
While looking at http://libwebsockets.org/trac/ticket/18
noticed the flow for timeout in service_fd will do bad things
if the fd we came to service has timed out.  It gets freed and
then "serviced'.

Reported-by: Joakim Soderberg <joakim.soderberg@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-20 19:11:31 +08:00
Edwin van den Oetelaar
d75076eaea cmake fix for older cmake
AG this wasn't needed on cmake 2.8.10.2 but did not make any
problem either

Signed-off-by: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>
2013-02-20 02:08:51 +08:00
Andy Green
0c2f4d865a update missed extpoll calls to use correct args for ssl
http://libwebsockets.org/trac/ticket/15#comment:16

Reported-by: Joakim Soderberg <joakim.soderberg@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-19 19:19:51 +08:00
Andy Green
799ecbf773 cmake docs add note about prefix
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-19 10:26:39 +08:00
Joakim Söderberg
455e45150a Create the "doc" dir before generating docs.
The documentation wouldn't be generated if the path didn't exist.
2013-02-19 10:14:54 +08:00
Joakim Söderberg
6ac9709790 Added "make install" support to the CMake project.
- Does everything as the autoconf script does (I think).
- Generates SSL certs for the test-server
- Installs all test apps.
- Defaults to /usr/local/
- "DESTDIR=/bla make install" works
- Append "libwebsockets" to start of the test-app names like the autoconf stuff does.
- Only tested on OSX so far...
2013-02-19 10:14:37 +08:00
Andy Green
c6511a08b4 trac 17 update set_log_level api notice
http://libwebsockets.org/trac/ticket/17

Reported-by: dbrnz
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-19 10:01:48 +08:00
Edwin van den Oetelaar
d6bf73c224 move cms cmake addition to cmake module paths earlier
Signed-off-by: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>
2013-02-18 20:20:05 +08:00
Andy Green
d169bb7de9 add FindGit.cmake
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 18:34:10 +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
2af4d5b2e2 remove lws_ensure_user_space from public api change return
The function has a logical problem when the size of the requested
allocation is 0, it will return NULL which is overloaded as
failure.

Actually the whole function is evil as an api, this patch moves
it out of the public API space and fixes it to return 0 for
success or 1 for fail.  Private code does not need to to return
wsi->user_space and public code should only get that from the
callback as discussed on trac recently.

Thanks to Edwin for debugging the problem.

Reported-by: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 16:30:10 +08:00
Andy Green
cb8febdda2 update arm build stats
Clean out the historical numbers, update info

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 12:08:15 +08:00
Andy Green
8dac94da67 trim proxy ads plus hostname stg
128 should be fine for hostname and proxy ads

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 12:02:18 +08:00
Andy Green
73a820a989 restrict http send buffer to 4096
send() is able to complete but not send everything asked...
we don't deal with that yet.  On an ARM9 board, leaf.jpg
failed because the send() only accepted 7240 of 8192... not
a failure but it implies reporting partial send to the
caller.  Work around by keeping the send buffer at 4096.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 11:32:49 +08:00
Andy Green
760c3d4aa5 fix no extensions build
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 10:43:18 +08:00
Andy Green
a7521debde migrate client hs and c_port into ah
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 10:38:45 +08:00
Andy Green
6636eec8e5 minor type optimizations
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 10:34:25 +08:00
Andy Green
3b49848b36 remove current_alloc_len
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 10:29:22 +08:00
Andy Green
cc7cb68ded remove header name buffer
The header name buffer and its max length handling has actually
been unused since the minilex parser was introduced.  We hold
parsing state in the lex-type parts and don't need to store or
worry about max length, since the parser will let us know as
soon as it can't be a match for the valid header names.

This strips it out reducing the per-connection allocation for
x86_64 with default configure from 224 to 160.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 10:22:42 +08:00
Andy Green
0caf9c5acb handle http union transition properly
There's no proper transition to http union state until now.

It only becomes apparant there's a problem when you try to
return -1 from the HTTP callback, during the close action
it will try to close() a nonsense, nonzero fd pointer in
the uninitialized u.http union member.

This patch takes a copy of the allocated headers struct from
the u.hdr union state, transitions to u.http clearing down u
and then calls the HTTP callback with URI args pointing to
the still-in-scope ah allocation.  After the call, the copy ah
is freed.

That makes sure we are in the correct union state while still
giving the HTTP callback access to the URI without having to
copy it around.

Reported-by: Edwin can den Oetelaar <oetelaar.automatisering@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-18 09:48:31 +08:00
Andy Green
51b20ee92a test server kill skt with minus 1
The client spams the server with mirror protocol content
and then closes the connection.  However the server wants to
send that content back to all the mirror protocol
connections, including the one that closed.

The result is during the send back phase we usually see an
error trying to send to the close client connection. Because
we don't return -1, we don't close it on server side and the
error repeats a lot before finally closing.  This is a side-
effect of a recent patch to drain pending input before
really closing a dead connection.

This patch just changes it to return -1 on the failed send
attempt assertively closing the connection.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-17 09:14:08 +08:00
Andy Green
c9ac31ee1c handle any POLLIN before error
See if this can impact http://libwebsockets.org/trac/ticket/16

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-16 10:17:52 +08:00
Andy Green
22524a65a2 close if we tried to close politely just close next time
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-15 22:48:58 +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
b059371e40 problems in lws_handle_POLLOUT_event should just close
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-15 22:32:53 +08:00
Andy Green
67d556c682 robustness protect and document ensure_user_space
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-15 22:31:55 +08:00
Andy Green
099f789d2f README.coding add note about closing connections
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-15 10:25:58 +08:00
Andy Green
fbf48227b3 add by hand http send example
This adds a demonstration of how to use the http nonblocking
send action to the test server.

If you ask for /leaf.jpg from the test server, it will send
"by hand" a 2.4MB jpeg in HTTP, including the headers.  See
the test server sources to see how it is done.

Although it's a file, and a jpeg image, actually the exact
same scheme will work for any data or mime type.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 23:24:07 +08:00
Andy Green
e803c82044 create user alloc for http if requested
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 23:18:10 +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
adc71469da just get hostname into canonical_hostname
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 17:11:22 +08:00
Andy Green
475bbdc938 remove getnameinfo
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 17:02:26 +08:00
Andy Green
9fc50b5a40 fragge able to send chunks larger than rx buffer
This now exercises the code for dealing with rx that spills over
the rx buffer.  Single fraggle uses the default rx buffer size
of 4096, it also now exercises code around that.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 14:19:26 +08:00
Andy Green
c2bb3dc7b3 unstaged server changes
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 11:25:44 +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
ff5dbf91b1 check for default protocol rx buf limit
This fixes

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

When using the default rx protocol buffer, the check is
performed against 0 not the default length.  That's the
case both in client and server code...

There's no problem if you actually give a max frame size
in the protocol definition.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-14 10:18:31 +08:00