1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00
Commit graph

63 commits

Author SHA1 Message Date
Yucong Sun
a72e975613 mingw: libevent build fixes 2020-11-28 10:58:38 +00:00
Andy Green
9f1d019352 CTest: migrate and deprecate existing selftest scripts
Replace the bash selftest plumbing with CTest.

To use the selftests, build with -DLWS_WITH_MINIMAL_EXAMPLES=1
and `CTEST_OUTPUT_ON_FAILURE=1 make test` or just
`make test`.

To disable tests that require internet access, also give
-DLWS_CTEST_INTERNET_AVAILABLE=0

Remove travis and appveyor scripts on master.

Remove travis and appveyor decals on README.md.
2020-05-11 15:40:13 +01:00
Andy Green
d7294a714e windows: import tronkko's dirent.h
Win32 compatible version of dirent.h microsoft just don't seem to be
able to include themselves.

MIT license, same as lws, link to original github project in the header
2020-04-08 11:26:53 +01:00
Andy Green
7ca8b77f2c pmd: split ebufs to track in and out 2019-05-06 07:31:32 +01:00
Mark Adler
74b4775908 zlib: Avoid pre-decrement of pointer in big-endian CRC calculation
There was a small optimization for PowerPCs to pre-increment a
pointer when accessing a word, instead of post-incrementing. This
required prefacing the loop with a decrement of the pointer,
possibly pointing before the object passed. This is not compliant
with the C standard, for which decrementing a pointer before its
allocated memory is undefined. When tested on a modern PowerPC
with a modern compiler, the optimization no longer has any effect.
Due to all that, and per the recommendation of a security audit of
the zlib code by Trail of Bits and TrustInSoft, in support of the
Mozilla Foundation, this "optimization" was removed, in order to
avoid the possibility of undefined behavior.

d1d577490c.patch
2018-04-19 16:15:10 +08:00
Mark Adler
b807ccf261 Subject: zlib: Avoid shifts of negative values inflateMark
The C standard says that bit shifts of negative integers is
undefined.  This casts to unsigned values to assure a known
result.

e54e129940.patch
2018-04-19 16:15:10 +08:00
krismattheus
5366a766f4 windows: add version resource 2018-02-06 07:07:28 +08:00
Andy Green
be525cb624 appveyor: Enable 64-bit build with OpenSSL and HTTP2
Fix warnings found from that

Introduce lws_ptr_diff(head, tail) helper to normalize
pointers to char *, do the subtraction and cast the
result to int.
2017-11-26 19:16:17 +08:00
Andy Green
505a3fc1fc windows: finally fix gzip redefinition warnings 2017-10-26 18:55:11 +08:00
Rainer Poisel
d2cef1515e Better support for MINW32 2016-12-16 22:08:13 +08:00
Andy Green
014481e912 documentation convert to doxygen
Signed-off-by: Andy Green <andy@warmcat.com>
2016-07-14 08:57:27 +08:00
Stephan Eberle
8087959acf Fixed build failure under Visual Studio 14 2015 2016-04-27 07:34:43 +08:00
Stephan Eberle
3f41a9de5b Fixes for building with MinGW
Added fixes to avoid compile errors and warnings when building under
Windows using MinGW
2016-04-27 07:31:22 +08:00
Andy Green
ce0326b839 libwebsockets.org url updates
Signed-off-by: Andy Green <andy.green@linaro.org>
2016-02-21 10:42:46 +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
Peter Pentchev
e46f4125ef Fix some typographical and grammatical errors 2015-10-15 11:58:54 +08:00
=?UTF-8?q?Joakim=20S=C3=B6derberg?=
70c5717a07 Fix windows build errors
NSI installer errors causing failed windows builds
2015-10-12 09:33:44 +08:00
Roger A. Light
b6147fd2e5 Fix shared library name for all platforms
This is a further fix to f1b1254, building on 26fd0d2.

Tidy up the LWS_WITH_SHARED and LWS_WITH_STATIC options.
2015-10-12 08:27:38 +08:00
wonder-mice
f1b125442b Subject: [PATCH] Multiple changes in the build process
* Default CMAKE_BUILD_TYPE to Release
* Use CMAKE_BUILD_TYPE to define _DEBUG (NDEBUG is more standard though,
  but cmake defines it)
* Drop LWS_WITHOUT_DEBUG (use CMAKE_BUILD_TYPE for that)
* Drop LWS_NO_EXTERNAL_POLL (was not used)
* Drop CMAKE_BUILD (CMake is the only build system now)
* Add LWS_WITH_STATIC and LWS_WITH_SHARED to choose what version(s) to
  build
* Add LWS_XXX_LIBRARIES and LWS_XXX_INCLUDE_DIRS for each library
  dependency (zlib, openssl, libev, cyassl)
* Support setting of XXX_LIBRARIES, XXX_LIBRARIES and XXX_INCLUDE_DIRS
  by parent project (when included with add_subdirectory())
* Rename LWS_USE_EXTERNAL_ZLIB to LWS_USE_BUNDLED_ZLIB and default it to
  NO (since it's Windows only)
* Default LWS_WITHOUT_DAEMONIZE to NO (since network lib shouldn't know
  how to do it anyway)
* Rename config.h.cmake to lws_config.h.in
* Rename shared library to websockets_shared so linker will not be
  confused
* Fix inline keyword detection in clang
* Explicitly set MACOSX_RPATH to YES on MacOS
2015-04-24 07:27:18 +08:00
Joakim Soderberg
78dcaf45c4 Subject: [PATCH] Don't fail on non-existing files 2015-04-22 16:26:32 +08:00
Roger A. Light
1677ca52ca Subject: [PATCH] Windows installer related fixes.
Remove incorrectly committed cpack changes.
Fix call to makensis.
Update README filenames.
2015-03-11 08:48:39 +08:00
Roger A. Light
12126d701e Add Windows installer file and configure appveyor to create it
Also update OpenSSL on Windows to latest version.
2015-03-10 21:18:22 +08:00
Patrick Gansterer
73882e49fc Remove websock-w32.h 2014-03-29 08:25:58 +01:00
Patrick Gansterer
462c981e9c Move #define for random() into the test applications where needed 2014-03-29 08:05:07 +01:00
Patrick Gansterer
60cbbac880 Use Sleep() instead of usleep() on Windows 2014-03-29 07:52:01 +01:00
Patrick Gansterer
fc5734c339 Remove dummy headers for Windows 2014-03-29 07:43:38 +01:00
Patrick Gansterer
8df031d336 Remove emulated_poll on Windows 2014-03-29 07:15:40 +01:00
Patrick Gansterer
4a83727bf6 Remove duplicated implementations for bzero()
Define bzero() in a central place if HAVE_BZERO is not set
2014-02-28 20:28:06 +08:00
Patrick Gansterer
2dbd837c41 WSAGetLastError() instead of errno on Windows
Error codes set by Windows Sockets are not made available through the errno
variable. Checking them via WSAGetLastError() is the corret solution.
2014-02-28 20:08:55 +08:00
martell
86310321e4 Removed needless VS projects now that cmake is fixed 2014-02-15 13:42:51 +08:00
martell
e91a759b8a additional mingw fixes
Signed-off-by: martell <martellmalone@gmail.com>
2014-02-15 13:37:08 +08:00
pmcdona
0a0a7ebc37 Trac 53 minw update
http://libwebsockets.org/trac/libwebsockets/ticket/53
2013-12-18 10:17:25 +08:00
Graham Newton
7ee4f890a3 windows workaround unsigned fd in emulated poll
A common practise to temporarily disable a socket in a poll call is to negate the socket fd.  poll should then ignore the socket.
emulated_poll does this with the following code:
        if (poll_fd->fd < 0 || !poll_fd->events)
            goto skip1;

However on Windows the fd field in WSAPOLLFD is unsigned int!!!  So the check for a negative fd value always fails.
This results in select returning an error with an error code of 10038 -- Socket operation on nonsocket.
The fix is to type cast fd like so:
        if ((int)poll_fd->fd < 0 || !poll_fd->events)

This may be the cause of some high CPU load reports.  I noticed the load being 50% with my application running on Windows XP.

Signed-off-by: Graham Newton <gnewton@peavey-eu.com>
2013-11-09 08:11:41 +08:00
Andreas Pakulat
dae94d8adc Windows Fix usage in Windows XP targetting projects
This is important since this stuff is in publicly included headers
and even though the usage of the WSAPoll API is a runtime decision
the public headers may be used in code that needs to build with
_WIN32_WINNT=0x0501 to support WinXP.

When building a project using libwebsockets with that define set
to 0x0501 winsock.h will not define the WSAPOLLFD struct causing that
project to fail to compile.
2013-11-04 10:18:14 +08:00
Andy Green
29338d9ef3 unixify websock w32.h line endings
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-11-04 10:17:50 +08:00
Arokux B
47f5fa4983 fix win32helpers gettimeofday epoch
Signed-off-by: Arokux B <arokux@gmail.com>
2013-03-05 08:41:47 +08:00
Andy Green
fc90f698b3 normalize formatting in gettimeofday
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-28 09:22:38 +08:00
Arokux B
e5ae9a95fb fix win32 gettimeofday for mingw
here are the problems that I found while compiling libwebsockets with
CMake using as a generator MinGW Makefiles.

1. In http://git.warmcat.com/cgi-bin/cgit/libwebsockets/plain/win32port/win32helpers/gettimeofday.c

Remove spaces around time.h, otherwise it looks for " time.h " and
fails with "No such file ..."

I also needed to comment out

struct timezone
{
  int  tz_minuteswest; /* minutes W of Greenwich */
  int  tz_dsttime;     /* type of dst correction */
};

It is already declared in mingw's time.h

Signed-off-by: Arokux B <arokux@gmail.com>
2013-02-28 09:18:38 +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
Andy Green
c5dc32ab48 remove deprecated vcxproj
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-07 20:25:28 +08: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
Andy Green
f431247270 revert zlib update 1.2.7
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-19 15:11:23 +08:00
David Galeano
960da6eeb0 zlib update 1.2.7
Signed-off-by: Andy Green <andy.green@linaro.org>
2013-01-10 10:03:42 +08:00
David Galeano
85a092135e Added extension "deflate-frame".
Using by default instead of "deflate-stream".
2013-01-09 18:21:33 +08:00
Andy Green
aa6fc44b0a mingw add win32helper to lib and fix extpoll
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:32:19 +08:00
Andy Green
cce2a81e85 change DATADIR to INSTALL_DATADIR solve mingw conflict
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:31:25 +08:00
Andy Green
a3147888d6 mingw gettimeofday avoid missing include
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:31:12 +08:00
Andy Green
eeeddf030d mingw add in missing poll defs
Based on work from Radu Sorici <soriciradu@gmail.com>

Signed-off-by: Andy Green <andy.green@linaro.org>
2012-04-12 13:30:55 +08:00
Dan Zhang
f2e5e985c3 cleanup fixes tested on win32 compiler
Signed-off-by: Dan Zhang <emaildanzhang@gmail.com>
2011-11-09 15:55:16 +08:00
Andy Green
20b66e9939 win32 poll emulation clean and address PEEK issue
Dan Zhang needed to defeat the recv() with PEEK in order to get working
poll() emulation on 64-bit windows.

I cleaned up the style in that file and made a version of his workaround
(which was force recv result to 0).  I can't test the result so it may
need more work.

Reported-by: Dan Zhang <emaildanzhang@gmail.com>
Signed-off-by: Andy Green <andy@warmcat.com>
2011-11-09 07:28:45 +08:00