Commit Graph

406 Commits

Author SHA1 Message Date
Yang Tse eb5aa12c8b sockfilt.c: commit b44da5a82a follow-up 2 2012-12-26 20:03:35 +01:00
Yang Tse 77b5c0b2cf sockfilt.c: commit b44da5a82a follow-up 2012-12-26 19:30:22 +01:00
Yang Tse b44da5a82a sockfilt.c: fix some compiler warnings 2012-12-26 17:17:52 +01:00
Marc Hoersken 4a23b19a13 socklift.c: Quick fix to re-add missing code 2012-12-25 15:18:01 +01:00
Marc Hoersken a662f86f6f socklift.c: Added select_ws function to support Windows
WinSock select() does not support standard file descriptors,
it can only check SOCKETs. The following function is an attempt
to create a select() function with support for other handles.
2012-12-25 15:15:24 +01:00
Yang Tse a0b207164c setup_once.h: refactor inclusion of <unistd.h> and <sys/socket.h>
Inclusion of top two most included header files now done in setup_once.h
2012-12-14 17:38:18 +01:00
Yang Tse b908376bef build: explain current role of LIBS in our Makefile.am files
BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
LIBS variable used in generated makefile at makefile processing
time. Doing this functionally prevents LIBS from being used for
all link targets in given makefile.
2012-12-04 23:32:05 +01:00
Yang Tse d27a46f09b build: prevent global LIBS from influencing test server build targets 2012-11-29 21:56:48 +01:00
Yang Tse 4abf4fbaac build: fix Windows build targets damaged since commit 550e403f00 2012-11-28 20:51:13 +01:00
Yang Tse 16a8281f71 build: avoid linkage of directly unused libraries 2012-11-28 18:31:23 +01:00
Dave Reisner 550e403f00 uniformly use AM_CPPFLAGS, avoid deprecated INCLUDES
Since automake 1.12.4, the warnings are issued on running automake:

  warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

Avoid INCLUDES and roll these flags into AM_CPPFLAGS.

Compile tested on:
  Ubuntu 10.04 (automake 1:1.11.1-1)
  Ubuntu 12.04 (automake 1:1.11.3-1ubuntu2)
  Arch Linux (automake 1.12.4)
2012-11-06 00:32:21 +01:00
Marc Hoersken 6372144be0 sws.c: Fixed warning: 'err' may be used uninitialized in this function 2012-09-11 11:48:27 +02:00
Guenter Knauf 154fc29f58 Fix some compiler warnings. 2012-08-08 05:03:16 +02:00
Joe Mason 42e4c34ff3 sws: close sockets properly
Fix a bug where closed sockets (fd -1) were left in the all_sockets
list, because of missing parens in a pointer arithmetic expression

Reenable the tests that were locking up due to this bug.
2012-08-07 00:28:21 +02:00
Joe Mason 0df14c8393 Remove debug logs that were accidentally checked in 2012-08-07 00:21:14 +02:00
Joe Mason 60a2ee88a5 Use select in sws, which has better cross-platform support than poll 2012-08-07 00:21:14 +02:00
Joe Mason 66a77a9b49 Use cross-platform curlx_nonblock instead of fcntl in sws 2012-08-07 00:21:14 +02:00
Joe Mason 674da8ae07 Add a polling loop in main to read from more than one socket at once. Add the O_NONBLOCK and
SO_KEEPALIVE flag to all sockets. Note that several loops which used to continue on a return value
of 0 (theoretical since 0 would never be returned without O_NONBLOCK) now break on 0 so that they
won't continue reading until after poll is called again.
2012-08-02 18:52:38 -04:00
Joe Mason 84490052d4 Change return values of get_request, accept_connection and service_connection to add a return code
for non-blocking sockets: now -1 means error or connection finished, 1 means data was read, and 0
means there is no data available now so need to wait for poll (new return value)
2012-08-02 18:52:31 -04:00
Joe Mason 19035292d0 Hoist the loop out of get_request, and make sure that it can be reentered when a request is
half-finished.

Note the the req struct used to be re-initialized AFTER reading pipeline data, so now that we
initialize it from the caller we must be careful not to overwrite the pipeline data.

Also we now need to handle the case where the buffer is already full when get_request is called -
previously this never happened as it was always called with an empty buffer and looped until done.

Now get_request is called in a loop, so the next step is to run the loop on a socket only when poll
signals it is readable.
2012-08-02 17:43:25 -04:00
Joe Mason 81656a8466 Move blocks of code from the sws main loop into their own functions for easier refactoring later.
The next step will be to call the correct function after a poll, rather than looping unconditionally
2012-08-02 17:43:15 -04:00
Joe Mason 76ba591957 Remove the --fork option of sws, since it makes refactoring to use poll more complicated and should
be redundant once we poll
2012-08-02 17:34:45 -04:00
Daniel Stenberg d759a70db8 SWS: use of uninitialized memory fix
I made "connmon" not get initialized properly before use, and I use the
big hammer and make sure we always clear the entire struct to avoid any
problem like this in the future.
2012-07-12 00:08:38 +02:00
Daniel Stenberg 685366006c connection-monitor: always log disconnect when enabled
This makes verifying easier and makes us more sure curl closes the
connection only at the correct point in time. Adjusted test 206 and 1008
accordingly and updated the docs for it.
2012-07-12 00:08:37 +02:00
Daniel Stenberg 176f7ea3bb sws: support <servercmd> for CONNECT requests
I moved out the servercmd parsing into a its own function called
parse_servercmd() and made sure it gets used also when the test number
is extracted from CONNECT requests. It turned out sws didn't do that
previously!
2012-07-05 11:24:23 +02:00
Daniel Stenberg 28dc509dde sws: add 'connection-monitor' command support
Using this, the server will output in the protocol log when the
connection gets disconnected and thus we will verify correctly in the
test cases that the connection doesn't get closed prematurely. This is
important for example NTLM to work.

Documentation added to FILEFORMAT, test 503 updated to use this.
2012-07-05 11:24:23 +02:00
Yang Tse 48d13b44c6 headers: require GCC 2.7 or newer in order to allow attribute GCC'isms usage
Usage in other code paths already protected and requiring even newer versions.
2012-04-14 15:12:30 +02:00
Yang Tse 38ae6ec1a2 configure: NATIVE_WINDOWS no longer defined in config files 2012-04-12 13:08:48 +02:00
Yang Tse a144bb8b76 build adjustments: functionally revert commits 4d3fb91f and bbfe1182
Undefining CURL_HIDDEN_SYMBOLS in source files isn't the proper fix.
2012-04-11 19:28:40 +02:00
Yang Tse 4d3fb91fb4 test servers: build adjustment
Undefine CURL_HIDDEN_SYMBOLS libcurl private preprocessor macro that might
leak from lib/setup.h into source files where this should not be defined.
2012-04-10 17:32:06 +02:00
Daniel Stenberg 805788e043 SWS: refuse to serve CONNECT unless running as proxy 2012-03-22 00:12:37 +01:00
Yang Tse 2b9fafd622 sws.c: fix proxy mode secondary connection monitoring condition 2012-01-17 12:28:28 +01:00
Yang Tse b15024be4d sws.c: improve proxy mode torture testing support - followup to 18c6c8a5 2012-01-16 19:01:35 +01:00
Yang Tse 18c6c8a5e7 sws.c: improve proxy mode torture testing support - followup to c731fc58 2012-01-16 12:30:03 +01:00
Yang Tse c731fc58ea sws.c: improve proxy mode torture testing support - followup to d4bf87dc 2012-01-15 20:13:32 +01:00
Yang Tse d4bf87dc0e sws.c: improve proxy mode torture testing support 2012-01-13 05:13:48 +01:00
Yang Tse 123c92c904 sws.c: replace sleep() usage with wait_ms() 2012-01-09 22:50:47 +01:00
Yang Tse 2705af6267 sws.c: some compiler warning fixes 2012-01-08 19:28:46 +01:00
Yang Tse dd69a3e868 sws.c: 812fa73057 follow-up 2012-01-06 01:52:45 +01:00
Yang Tse 812fa73057 sws.c: some IPv6 proxy mode peparatory adjustments 2012-01-05 20:52:48 +01:00
Yang Tse 4bc6c1a026 sws.c: fix proxy mode segfault 2012-01-04 19:14:19 +01:00
Daniel Stenberg 82180643f4 test proxy supports CONNECT
There's a new 'http-proxy' server for tests that runs on a separate port
and lets clients do HTTP CONNECT to other ports on the same host to
allow us to test HTTP "tunneling" properly.

Test cases now have a <proxy> section in <verify> to check that the
proxy protocol part matches correctly.

Test case 80, 83, 95, 275, 503 and 1078 have been converted. Test 1316
was added.
2012-01-03 15:01:22 +01:00
Yang Tse 8bfc3a800a FTP test server: NODATACONN commands commit c761fcb0 follow-up
Adjustments that make NODATACONN custom commands fully usable.
2011-10-31 07:29:13 +01:00
Yang Tse 0b315c1cf1 FTP test server: fix server unresponsiveness
Some torture tests left FTP test server in an unresponsive state, resulting
in torture tests that actually completed following unexpected code paths.

Changes in this commit solely address this issue and some adjustments for
ftpserver.pl logging relative to data channel establishment and tear down.
Pending NODATACONN relative adjustments reserved for a further commit.
2011-10-30 17:12:20 +01:00
Yang Tse fd10c047df sws.c: HTTP and GOPHER test server-side connection closing adjustment
When, for a given test, server is instructed to close connection after
server reply we now wait a very small amount of time (50ms) before doing
so. This is done to allow client to, at least partially, read server
reply before getting an ECONNRESET.

The above is required to make test cases 1070, 1200, 1201 and 1202 pass
with Cygwin 1.5.X on W2K.

GOPHER test server closes connection after _every_ server-reply, as such,
at some point it could require a bigger time or using shutdown() before
a server-side initiated disconnection.
2011-10-14 17:33:05 +02:00
Yang Tse a50210710a fix bool variables checking and assignment 2011-09-05 20:46:09 +02:00
Yang Tse 6b75d2c2df fix a bunch of MSVC compiler warnings 2011-09-03 16:07:09 +02:00
Yang Tse fd00b382b2 base64: fix Curl_base64_encode and Curl_base64_decode interfaces
Previous interfaces for these libcurl internal functions did not allow to tell
apart a legitimate zero size result from an error condition. These functions
now return a CURLcode indicating function success or otherwise specific error.
Output size is returned using a pointer argument.

All usage of these two functions, and others closely related, has been adapted
to the new interfaces. Relative error and OOM handling adapted or added where
missing. Unit test 1302 also adapted.
2011-08-24 08:10:30 +02:00
Yang Tse 10a0bed485 NTLM single-sign on adjustments (VIII)
Use preprocessor symbols WINBIND_NTLM_AUTH_ENABLED and WINBIND_NTLM_AUTH_FILE
for Samba's winbind daemon ntlm_auth helper code implementation and filename.

Retain preprocessor symbol USE_NTLM_SSO for NTLM single-sign-on feature
availability implementation independent.

For test harness, prefix NTLM_AUTH environment vars with CURL_

Refactor and rename configure option --with-ntlm-auth to --enable-wb-ntlm-auth[=FILE]
2011-07-31 20:44:41 +02:00
Yang Tse 5cdbfa1837 fix compiler warning 2011-07-29 13:27:08 +02:00