aboutsummaryrefslogtreecommitdiff
path: root/tests/server/sockfilt.c
AgeCommit message (Collapse)Author
2020-05-25all: fix codespell errorsViktor Szakats
Reviewed-by: Jay Satiro Reviewed-by: Daniel Stenberg Closes https://github.com/curl/curl/pull/5452
2020-05-02sockfilt: make select_ws stop waiting on exit signal eventMarc Hoersken
This makes sure that select_ws behaves similar to real select which stops waiting on a signal handler being triggered. This makes it possible to gracefully stop sockfilt.exe on Windows with taskkill /IM sockfilt.exe (without /F force flag). Reviewed-by: Jay Satiro Part of #5260
2020-04-18tests: move pingpong server to dynamic listening portDaniel Stenberg
FTP, IMAP, POP3, SMTP and their IPv6 versions are now all on dynamic ports Test 842-845 are unfortunately a bit hard to move over to this concept right now and require "default port" still...
2020-04-18sockfilt: tidy variable naming and data structure in select_wsMarc Hoersken
This commit does not introduce any logical changes to the code. Reviewed-by: Jay Satiro and Marcel Raad Closes #5238
2020-04-14sockfilt: fix broken pipe on Windows to be ready in select_wsMarc Hoersken
Closes #5228
2020-04-12tests/server: move all signal handling routines to util.[ch]Marc Hoersken
Avoid code duplication to prepare for portability enhancements.
2020-04-06cleanup: correct copyright year range on a few filesDaniel Stenberg
2020-04-03sockfilt: remove redundancy in timeout handlingMarc Hoersken
And update other logmsg output in select_ws on Windows.
2020-04-03sockfilt: fix handling of ready closed sockets on WindowsMarc Hoersken
Replace the incomplete workaround regarding FD_CLOSE only signalling once by instead doing a pre-check with standard select and storing the result for later use. select keeps triggering on closed sockets on Windows while WSAEventSelect fires only once with data still available. By doing the pre-check we do not run in a deadlock due to waiting forever for another FD_CLOSE event.
2020-04-03sockfilt: fix race-condition of waiting threads and event handlingMarc Hoersken
Fix race-condition of waiting threads finishing while events are already being processed which lead to invalid or skipped events. Use mutex to check for one event at a time or do post-processing. In addition to mutex-based locking use specific event as signal. Closes #5156
2020-03-26sockfilt: add logmsg output to select_ws_wait_thread on WindowsMarc Hoersken
Assisted-by: Jay Satiro Reviewed-by: Daniel Stenberg Closes #5086
2018-11-23snprintf: renamed and we now only use msnprintf()Daniel Stenberg
The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296 Closes #3297
2018-09-23whitespace fixesViktor Szakats
- replace tabs with spaces where possible - remove line ending spaces - remove double/triple newlines at EOF - fix a non-UTF-8 character - cleanup a few indentations/line continuations in manual examples Closes https://github.com/curl/curl/pull/3037
2018-08-21curl-compilers: enable -Wbad-function-cast on GCCMarcel Raad
This warning used to be enabled only for clang as it's a bit stricter on GCC. Silence the remaining occurrences and enable it on GCC too. Closes https://github.com/curl/curl/pull/2747
2018-06-11cppcheck: fix warningsMarian Klymov
- Get rid of variable that was generating false positive warning (unitialized) - Fix issues in tests - Reduce scope of several variables all over etc Closes #2631
2018-04-15all: Refactor malloc+memset to use callocDaniel Gustafsson
When a zeroed out allocation is required, use calloc() rather than malloc() followed by an explicit memset(). The result will be the same, but using calloc() everywhere increases consistency in the codebase and avoids the risk of subtle bugs when code is injected between malloc and memset by accident. Closes https://github.com/curl/curl/pull/2497
2018-02-23spelling fixesViktor Szakats
Detected using the `codespell` tool. Also contains one URL protocol upgrade. Closes https://github.com/curl/curl/pull/2334
2017-12-06tests: added netinet/in6.h includes in test serversRandall S. Becker
2017-09-11code style: use spaces around equals signsDaniel Stenberg
2017-07-16sockfilt: suppress conversion warning with explicit castMarcel Raad
MSVC warns when implicitly casting -1 to unsigned long.
2017-05-04sockfilt.c: shortened too long lineDan Fandrich
2017-05-04tests/server: make string literals constMarcel Raad
assign string literals to const char * instead of char * in order to avoid a lot of these warnings: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
2016-12-14checksrc: warn for assignments within if() expressionsDaniel Stenberg
... they're already frowned upon in our source code style guide, this now enforces the rule harder.
2016-12-13checksrc: stricter no-space-before-paren enforcementDaniel Stenberg
In order to make the code style more uniform everywhere
2016-04-03tests/server: comply with our code styleDaniel Stenberg
2016-02-04URLs: change more http to httpsViktor Szakats
2016-02-03URLs: change all http:// URLs to https://Daniel Stenberg
2015-12-23sockfilt.c: fix calculation of sleep timeout on WindowsMarc Hoersken
Not converting to double caused small timeouts to be skipped.
2015-12-16sockfilt.c: added some debug output to select_wsMarc Hoersken
2015-12-16sockfilt.c: keep lines shorter than 80 charsMarc Hoersken
2015-12-16sockfilt.c: do not wait on unreliable file or pipe handleMarc Hoersken
The previous implementation caused issues on modern MSYS2 runtimes.
2014-12-28sockfilt.c: Fixed compilation warningsSteve Holme
sockfilt.c:288: warning: conversion to 'DWORD' from 'size_t' may alter its value sockfilt.c:291: warning: conversion to 'DWORD' from 'size_t' may alter its value sockfilt.c:323: warning: conversion to 'DWORD' from 'size_t' may alter its value sockfilt.c:326: warning: conversion to 'DWORD' from 'size_t' may alter its value
2014-12-27code/docs: Use correct case for IPv4 and IPv6Steve Holme
For consistency, as we seem to have a bit of a mixed bag, changed all instances of ipv4 and ipv6 in comments and documentations to use the correct case.
2014-12-26sockfilt.c: Reduce the number of individual memory allocationsMarc Hoersken
Merge multiple internal arrays into one, even if some variables will not not be used. They are all created with the number of file descriptors as their size. Also fix possible thread handle leak in CloseHandle-loop.
2014-12-26sockfilt.c: Replace 100ms sleep with thread throttleMarc Hoersken
Improves performance of test cases 574 and 575 by 50%. A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. http://msdn.microsoft.com/library/windows/desktop/ms686307.aspx
2014-12-21sockfilt.c: use non-Ex functions that are available before WinXPMarc Hoersken
It was initially reported by Guenter that GetFileSizeEx requires (_WIN32_WINNT >= 0x0500) to be true.
2014-04-22sockfilt.c: clean up threaded approach and add documentationMarc Hoersken
2014-04-22sockfilt.c: zero initialize variableMarc Hoersken
2014-04-22sockfilt.c: fixed getting stuck waiting for MinGW stdin pipeMarc Hoersken
2014-04-20sockfilt.c: properly handle disk files, pipes and character inputMarc Hoersken
2014-04-20sockfilt.c: ignore non-key-events and continue waiting for inputMarc Hoersken
2014-04-20sockfilt.c: free memory in case of memory allocation errorsMarc Hoersken
2014-02-16sockfilt.c: add undefs which are required after 6239146eMarc Hoersken
2014-01-26sockfilt.c: follow up cleanup commit on 49b63cf3Marc Hoersken
2014-01-26sockfilt.c: fixed and simplified Windows select functionMarc Hoersken
Since the previous complex select function with initial support for non-socket file descriptors, did not actually work correctly for Console handles, this change simplifies the whole procedure by using an internal waiting thread for the stdin console handle. The previous implementation made it continuously trigger for the stdin handle if it was being redirected to a parent process instead of an actual Console input window. This approach supports actual Console input handles as well as anonymous Pipe handles which are used during input redirection. It depends on the fact that ReadFile supports trying to read zero bytes which makes it wait for the handle to become ready for reading.
2013-04-06sockfilt.c: Fixed detection of client-side connection closeMarc Hoersken
WINSOCK only: Since FD_CLOSE is only signaled once, it may trigger at the same time as FD_READ. Data actually being available makes it impossible to detect that the connection was closed by checking that recv returns zero. Another recv attempt could block the connection if it was not closed. This workaround abuses exceptfds in conjunction with readfds to signal that the connection has actually closed.
2013-04-06sockfilt.c: Reduce CPU load while running under a Windows PIPEMarc Hoersken
2013-04-05sockfilt.c: Fixed handling of multiple fds being signaledMarc Hoersken
2013-04-04sockfilt.c: Added wrapper functions to fix Windows console issuesMarc Hoersken
The new read and write wrapper functions support reading from stdin and writing to stdout/stderr on Windows by using the appropriate Windows API functions and data types.
2013-01-11sockfilt.c: log file descriptor number on read/write errorYang Tse