Commit graph

1880 commits

Author SHA1 Message Date
Andy Green
2b57a34677 headers deleted after websocket established
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-07 20:30:56 +08:00
Andy Green
e4dffc99df leverage TOKEN_SKIPPING better in parser
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-07 20:30:56 +08:00
Andy Green
177ca78921 simplify parsing complete
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-07 20:30:56 +08:00
Andy Green
3455e676d8 act on fatal parse problems
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-07 20:30:56 +08:00
Andy Green
c5dc32ab48 remove deprecated vcxproj
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-07 20:25:28 +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
Joakim Soderberg
7df9908148 Added build instructions for CMake.
Also changed it so that specifying the include directories for CyaSSL is nicer.
2013-02-07 20:24:19 +08:00
Andy Green
039ce8fc7f add README
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-06 16:07:27 +09:00
Joakim Soderberg
f57751f92b Fixed compilation on NetBSD. 2013-02-06 15:49:13 +09:00
Joakim Söderberg
cb4156d437 Cleaned up the CyaSSL linking in the CMake project a bit.
Separated the CyaSSL linking and OpenSSL linking for more clearity.
Now tested on both OSX and Windows as well.
2013-02-06 15:49:13 +09:00
Joakim Soderberg
91de93391c Fixed windows build.
- Fixed the original visual studio project so that inline gets defined.
- Fix error in CMake with zlib.
2013-02-06 15:49:13 +09:00
Joakim Soderberg
e9a42119f6 Added some minor changes to CMake build file.
- Added options for compiling without server/client parts.
- Fixed a syntax error on printing an error on CyaSSL compilation.
- Don't compile server-extpoll either when the server isn't compiled.
2013-02-06 15:49:12 +09:00
Joakim Soderberg
b378ce9d18 Added support for CyaSSL replacement of OpenSSL.
http://www.yassl.com/yaSSL/Products-cyassl.html
- Small Size: 20-100kB
- Runtime Memory:  1-36kB
- 20X smaller than OpenSSL

So far only tested on Linux.

Note that this requires a bugfix in cyassl, otherwise it will crash. Pull request has been made to the official repos, in the meantime the following repos can be used: git://github.com/JoakimSoderberg/cyassl.git
2013-02-06 15:49:12 +09:00
Joakim Soderberg
4f4a38bae0 Added check for inline keyword availability.
Both to CMake project and Autoconf. inline will be defined to whatever inline replacement exists on the system, such as __inline or __inline__
2013-02-06 15:49:12 +09:00
Joakim Söderberg
68e8d730b8 Fixed build on OSX.
- For some reason the "extern int pid_daemon" usage in libwebsockets.c would cause an "undefined symbols" linker error for the test-apps. This only happens with the CMake project, not the normal Makefiles. I have no clue why this is. Fixed it by getting the pid via a function instead.

- Added test-server-extpoll

- Renamed the library from libwebsocket -> libwebsockets
2013-02-06 15:49:12 +09:00
Joakim Soderberg
d2edfec5fa Fixed linux compilation and added more compile options.
- Tested and works on Linux now also, including SSL support.
- Look for ZLIB not zlib.
- Added CMake options for setting all LWS_ defines.
2013-02-06 15:49:12 +09:00
Joakim Soderberg
4c53123677 CMake support + fixed windows build.
- Finalized CMake support (tested on windows only so far).
  - Uses a generated lws_config.h that is included in
  private-libwebsocket to pass defines, only used if CMAKE_BUILD is set.
  - Support for SSL on Windows.
  - Initial support for CyaSSL replacement of OpenSSL (This has been added
    to my older CMake-fork but haven't been tested on this version yet).
- Fixed windows build (see below for details).
- Fixed at least the 32-bit Debug build for the existing Visual Studio
  Project. (Not to keen fixing all the others when we have CMake support
  anyway (which can generate much better project files)...)
- BUGFIXES:
  - handshake.c
    - used C99 definition of handshake_0405 function
  - libwebsocket.c
    - syslog not available on windows, put in ifdefs.
    - Fixed previous known crash bug on Windows where WSAPoll in
      Ws2_32.dll would not be present, causing the poll function pointer
      being set to NULL.
    - Uninitialized variable context->listen_service_extraseen would
      result in stack overflow because of infinite recursion. Fixed by
      initializing in libwebsocket_create_context
    - SO_REUSADDR means something different on Windows compared to Unix.
    - Setting a socket to nonblocking is done differently on Windows.
      (This should probably broken out into a helper function instead)
    - lwsl_emit_syslog -> lwsl_emit_stderr on Windows.
  - private-libwebsocket.h
    - PATH_MAX is not available on Windows, define as MAX_PATH
    - Always define LWS_NO_DAEMONIZE on windows.
    - Don't define lws_latency as inline that does nothing. inline is not
      support by the Microsoft compiler, replaced with an empty define
      instead. (It's __inline in MSVC)
  - server.c
    - Fixed nonblock call on windows
  - test-ping.c
    - Don't use C99 features (Microsoft compiler does not support it).
    - Move non-win32 headers into ifdefs.
    - Skip use of sighandler on Windows.
  - test-server.c
    - ifdef syslog parts on Windows.
2013-02-06 15:49:12 +09:00
Joakim Soderberg
add3926b17 Some more Cmake stuff. 2013-02-06 15:49:12 +09:00
Joakim Soderberg
08e434eb66 Started redoing CMake support based on the up to date repos 2013-02-06 15:49:12 +09:00
Andy Green
0d49c8d1a0 improve test server poll loop docs
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-02 23:02:56 +08:00
Andy Green
a2156aa863 add note about MIPS opewrt configure options
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-02 18:10:29 +08:00
Andy Green
81bbae0375 remove one more mention of broadcast callback
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-01 11:17:02 +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
2d7acec9b2 remove stray reference to max broadcast size from readme.build
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-01 08:48:41 +08:00
Andy Green
36eb70d7a9 additional casts allow test server build as cpp
With these explicit casts that are not needed in C, it's possible to build
the test server using g++ like this, after building and installing the
library.

g++ -DINSTALL_DATADIR=\"/usr/share\" -ocpptest test.cpp -lwebsockets

Add a small documentation to README.coding

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-01 08:42: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
c51823a418 renovate test html
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-31 19:50:57 +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
Andy Green
2da89dccb0 bump version to 1.1 and soname to 2
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-31 11:01:38 +08:00
Andy Green
98feb4be18 clean out remaining mentions of deprecated broadcast
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-31 11:01:35 +08:00
Andy Green
d09d7d45f8 get error from getnameinfo if unable to improve hostname and use hostname
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-31 10:05:43 +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
Jack Mitchell
daed4fbd54 fix unused var if no enable openssl
Signed-off-by: Jack Mitchell <ml@communistcode.co.uk>
2013-01-30 18:53:36 +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
Andy Green
467c7ef552 add info about why we close to more places
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-30 12:28:34 +08:00
Andy Green
96d882a9d8 roubustness handle problems in read loop better
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-30 12:27:27 +08:00
Andy Green
5fc75a9b6b server allow NULL protocol map to protocol 0
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-30 12:26:14 +08:00
Andy Green
aaf0b9f514 change get_peer_addresses to use context wsi latency
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-30 08:49:13 +08:00
Andy Green
e000a709b3 instrument latency
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-30 08:49:12 +08:00
Andy Green
d636e35c2b introduce lws_latency
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-30 08:32:15 +08:00
Andy Green
3b228c5470 fix docs about protocol version supported
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-30 08:31:43 +08:00
Andy Green
08f2c017e8 test server terminate cleanly on ctrl c
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-30 08:02:26 +08:00
Andy Green
6f520a5195 evict all broadcast support
Libwebsockets is fundamentally singlethreaded... the existence of the
fork and broadcast support, especially in the sample server is
giving the wrong idea about how to use it.

This replaces broadcast in the sample server with
libwebsocket_callback_on_writable_all_protocol().  The whole idea of
'broadcast' is removed.

All of the broadcast proxy stuff is removed: data must now be sent
from the callback only.  Doing othherwise is not reliable since the
service loop may close the socket and free the wsi at any time,
invalidating a wsi pointer held by another thread (don't do that!)

Likewise the confirm_legit_wsi api added recently does not help the
other thread case, since if the wsi has been freed dereferencing the
wsi to study if it is legit or not will segfault in that case.  So
this is removed too.

The overall effect is to push user code to only operate inside the
protocol callbacks or external poll loops, ie, single thread context.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-29 22:13:55 +08:00
Matthieu Riviere
5e1b7fff3a FreeBSD compatibility
Seems we just need to take care about __FreeBSD__ along with
__APPLE__ in a couple of places.

Signed-off-by: Matthieu Riviere <matthieu.riviere@leukensis.org>
2013-01-29 06:57:21 +08:00
Andy Green
ea0642abb2 trac 6 expose libwebsockets read with note about not normally needed
Comes in handy if the original application poll loop is the boss,
in this case libwebsockets is optional and can't be the boss poll
loop

Requested-by: ajandhyala@wms.com
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-29 06:52:00 +08:00
Edwin van den Oetelaar
0794af94eb fix ssl bits outside of ifdef coverage
Signed-off-by: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>
2013-01-28 21:53:53 +08:00
Andy Green
c4d05a5fa2 force client ssl bio nonblocking
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-28 17:49:55 +08:00
Andy Green
1167dd4a6e force ssl rw bios nonblocking
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-28 17:49:52 +08:00
Andy Green
ba85a7dbbd timeout coverage for ssl accept
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-28 17:49:51 +08:00
Andy Green
e21607136c break up ssl accept action
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-28 12:19:10 +08:00