0
0
mirror of https://github.com/darkk/redsocks.git synced 2025-08-25 11:15:30 +00:00
Commit Graph

37 Commits

Author SHA1 Message Date
Leonid Evdokimov
ec06dc6ad6 Log dropped clients when http-proxy reply is too long 2016-04-13 01:50:34 +03:00
Leonid Evdokimov
6804500a0a Add tests for authentication failure 2016-04-13 01:38:38 +03:00
Leonid Evdokimov
3c7f635bf3 Warn about http-relay usage
http-relay should be avoided due to CVE-2009-0801. It was implemented to
support ancient HTTP/1.0 clients that did not set `Host` header, so
upstream proxy had at least some way to determine request destination.

In modern post-SPDY world this method should not be used, you should
rather configure upstream proxy to accept CONNECT requests to any port
and use `http-connect` instead.

Great CVE-2009-0801 description can be found in squid-users on 2015-12-18
http://lists.squid-cache.org/pipermail/squid-users/2015-December/008392.html
2016-04-03 23:45:54 +03:00
Leonid Evdokimov
af46180272 Add naive zero-copy implementation using splice
It gives ~33% increase of throughput on CPU-bound box.  E.g. following
machine single-connection throughput goes from ~30 Mbit/s to ~40 Mbit/s

system type: xRX200 rev 1.2
machine: TDW8980 - TP-LINK TD-W8980
cpu model: MIPS 34Kc V5.6
BogoMIPS: 332.54
2016-04-03 23:18:45 +03:00
Leonid Evdokimov
afd298f6ce Replace wm_read/wm_write manipulations with call to bufferevent_setwatermark
bufferevent_setwatermark() has some meaningful code to run on
high-watermark changes, avoiding this code may lead to stuck
connections.
2016-03-18 11:23:58 +03:00
Leonid Evdokimov
d2165a4ff0 Replace libevent macroses with functions 2016-03-18 00:41:04 +03:00
Leonid Evdokimov
4e222f3f27 Avoid EBADF warnings from epoll using bufferevent_free more accurately 2016-03-17 18:48:33 +03:00
Leonid Evdokimov
14ff78dfe7 Replace inconsistent rand()/random() with call to libevent2 rng 2016-03-09 01:12:38 +03:00
Leonid Evdokimov
4d2e10df17 Implement better exponential backoff in case of accept() failure.
This commit implements two more features:
 * min_accept_backoff configuration option
 * retry accept() after some close() calls

See also https://github.com/darkk/redsocks/issues/19
2012-03-25 23:58:40 +04:00
Bin Jin
dcbdcae943 Libevent2 fix: bad default line-extracting strategy
Libevent 2 deprecates evbuffer_readline() function, where any sequence
of any number of carriage return and linefeed characters is treated like
end of line, and introduces better evbuffer_readln(), where termination
format can be explicitly set to: \n, [\r]\n, \r\n or already mentioned
old behaviour.

Change past evbuffer_readline() calls to new
redsocks_evbuffer_readline() function. If libevent 2 is present, use
there evbuffer_readln() with eol_style set to an optional carriage
return, followed by a linefeed (EVBUFFER_EOL_CRLF) instead of obsolete
evbuffer_readln().

  Important note:
Consuming all CR and LF characters in one go (behaviour of
evbuffer_readline(), nowadays aliasing to evbuffer_readln() with
eol_style set to EVBUFFER_EOL_ANY) hangs up parsing of HTTP request
header ending with "\r\n\r\n", because it misses the empty line.

Conflicts (resolved):

	utils.c
	utils.h
2011-11-27 03:54:23 +04:00
Leonid Evdokimov
79e22a67fa Change license to Apache 2.0 to ensure compatibility with android stack. 2011-04-20 20:17:09 +03:00
Leonid Evdokimov
e24b29abf8 Fix a bug in cnounce generation in http-connect.c & s/sprintf/snprintf/. 2011-02-11 01:36:07 +02:00
Leonid Evdokimov
ebaeedead1 Improve nonce generation: srand() should be called only during startup. 2011-02-11 01:28:51 +02:00
Leonid Evdokimov
67f5928d05 Fix one compiler warning occuring at OpenBSD. 2011-02-10 00:06:56 +02:00
Leonid Evdokimov
9bcb4dcc7e Fix compilation at OpenBSD 4.9. 2011-02-10 00:02:05 +02:00
Przemyslaw Pawelczyk
cf3dc2c4f0 Hide warnings on unused variables if asserts are off.
redsocks.c: In function 'redsocks_read_expected':
redsocks.c:407: warning: unused variable 'read'

http-relay.c: In function 'httpr_client_read_cb':
http-relay.c:520: warning: unused variable 'written_wo_null'

These variables are used in asserts and if asserts are not compiled,
e.g. by defining NDEBUG (usually in CFLAGS via -DNDEBUG), then we have
misleading warnings.

Add in utils.h UNUSED() macro for creating null statement with result
casted to void. Use it to fix above warnings.
2011-01-27 23:22:09 +01:00
Leonid Evdokimov
642c9a448f Fix several compiler warnings. 2011-01-15 16:29:40 +02:00
Bin Jin
7099116ff1 remove free_null macro 2011-01-13 15:24:48 +08:00
Bin Jin
ba5b8bee01 handle malformed request properly 2010-12-09 13:30:08 +08:00
Bin Jin
04662c4226 fix several fatal issues; send request body on fly, rather than depend on content-length 2010-11-28 13:47:49 +08:00
Bin Jin
9136aa5e5f add clang compiler support; clean warnings; remove auth info from log file 2010-11-25 19:11:14 +08:00
Bin Jin
3d5d22a59b fix typo 2010-11-25 17:48:11 +08:00
Bin Jin
0ed9eeb920 add pidfile option 2010-11-24 14:44:02 +08:00
Bin Jin
651754834f fix memory leak issues 2010-11-23 14:19:57 +08:00
Bin Jin
a1e65e4ccb fix issue: EOF from client in http relay 2010-11-23 13:21:09 +08:00
Bin Jin
d95c791e8b fix: 403 found but not header provided 2010-11-23 02:04:18 +08:00
Bin Jin
1b07ca821c handle http-relay client request in an evented way 2010-11-23 01:43:00 +08:00
Bin Jin
383455512c add support for http POST connection 2010-11-23 00:31:14 +08:00
Bin Jin
ff134afb2f fix issue: can't handle hostname in request headers properly 2010-11-19 08:17:01 +08:00
Bin Jin
ed8d184147 add proxy auth support for http-relay, also working but buggy 2010-11-19 07:51:27 +08:00
Bin Jin
b8a5598b17 use strcasecmp() instead, fix issue on staled auth 2010-11-19 00:47:39 +08:00
Bin Jin
c12924022a add proxy auth for http-connect, working but buggy 2010-11-18 22:57:20 +08:00
Leonid Evdokimov
77a490422b Added GPLv3 copyright notice to every source file. 2008-12-13 15:40:52 +06:00
Leonid Evdokimov
66d9d1cf83 Whitespace fixes. 2008-07-13 21:36:51 +07:00
Leonid Evdokimov
8456d20883 Added logging priorities.
LOG_DEBUG - connection progress
LOG_INFO - all connections
LOG_NOTICE - network problems & startup banner
LOG_WARNING - unexpected behaviour, lack of client-related resources
LOG_ERR - startup errors & lack of memory
2008-02-10 00:57:22 +06:00
Leonid Evdokimov
5dda936cf9 Better logging. 2008-02-02 04:18:04 +06:00
darkk
477b8f5b7d Added http-relay subsystem to add transparent-proxy support to any http proxy. 2008-02-02 00:34:53 +06:00