2901 Commits

Author SHA1 Message Date
Nick Mathewson
e3cccf380c Avoid crash when event_pending() called with no event_base set on event
Instead, give a warning and return 0.

Reported by Antony Dovgal on github as
   https://github.com/libevent/libevent/issues/19
2012-11-16 11:56:56 -05:00
Nick Mathewson
7afbd60266 Use EVUTIL_SOCKET_ERROR() wrapper to save/restor errno in evhttp_connection_fail_ 2012-11-16 11:51:42 -05:00
Nick Mathewson
29fea33a7c Merge remote-tracking branch 'ppelleti/preserve-errno' 2012-11-16 11:49:46 -05:00
Jay R. Wren
4f4d0c9318 add evhttp_request_get_response_code_line
This is needed to be able to read the response code line especially
when acting as an http client using evhttp_make_request.

(patched by nickm to make the return value const)
2012-11-16 11:48:03 -05:00
Nick Mathewson
61b93af561 Move evutil_rtrim_lws_ to evutil.c where it belongs 2012-11-16 11:41:59 -05:00
Nick Mathewson
c6ff381270 Remove internal ws from multiline http headers correctly
According to RFC2616:

   All linear white space, including folding, has the same semantics
   as SP. A recipient MAY replace any linear white space with a single
   SP before interpreting the field value or forwarding the message
   downstream.
2012-11-16 11:38:53 -05:00
Nick Mathewson
ac42519769 Remove trailing tabs in HTTP headers as well. 2012-11-16 11:29:34 -05:00
Nick Mathewson
aa59d805f5 Clean up rtrim implementation
If I understand the C standard correctly, you can't actually point
at a position immediately _before_ the start of an object; only at the
position immediately after.

According to J.2 in the standard, in its big list of undefined behavior:

 "The behavior is undefined in the following circumstances:
     ...
   — Addition or subtraction of a pointer into, or just beyond, an
    array object and an integer type produces a result that does not
    point into, or just beyond, the same array object (6.5.6)."

So we've got to fix rtrim to not do that.  Also, make it unit tested,
and give it an evutil_*_ name.
2012-11-16 11:13:29 -05:00
Artem Germanov
370a2c0213 ignore LWS after field-content in headers 2012-11-16 10:59:43 -05:00
Nick Mathewson
c181399e92 Merge remote-tracking branch 'azat/fix-typo-evets' 2012-11-16 10:53:52 -05:00
Nick Mathewson
30512f4376 Merge remote-tracking branch 'ppelleti/tiny-doc-typos' 2012-11-16 10:51:26 -05:00
Nick Mathewson
d70af27d01 Use correct openssl libs and includes in pkgconfig file
Previously we were saying -lssl -lcrypto unconditionally when
we should have been saying OPENSSL_LIBS.

Based on a patch from Patrick Pelletier
2012-11-16 10:50:04 -05:00
Nick Mathewson
09a8d23ad9 Merge remote-tracking branch 'origin/patches-2.0' 2012-11-16 10:44:57 -05:00
Patrick Pelletier
ac356502d3 remove stray 'x' so print_err will compile when uncommented 2012-11-16 10:44:24 -05:00
Nick Mathewson
3f27db9d92 Merge pull request #27 from pallas/master
Fix event_dlist definition when sys/queue not included
2012-11-16 07:42:17 -08:00
Nick Mathewson
efb644ed87 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	test/rpcgen_wrapper.sh
2012-11-16 10:29:37 -05:00
Nick Mathewson
f3009e48c7 Make rpcgen_wrapper.sh work on systems without a "python2" binary 2012-11-16 10:28:19 -05:00
Nick Mathewson
4343edf3c6 Add a unit test in which an event is created with event_base_once() but never fires 2012-11-16 10:17:34 -05:00
Nick Mathewson
0a396a02ba Merge branch '21_event_cleanup_v3' 2012-11-16 10:13:15 -05:00
Nick Mathewson
c17dd59191 Free dangling event_once objects on event_base_free()
This patch makes us keep event_once objects in a doubly linked list
so we can free any once that haven't triggered when we call
event_base_free().
2012-11-16 10:05:04 -05:00
Nick Mathewson
1f5a48d1d0 Merge remote-tracking branch 'origin/patches-2.0' 2012-11-15 11:45:12 -05:00
Nick Mathewson
ac009f9245 Warn when openssl version in unit test mismatches compiled version. 2012-11-15 11:43:45 -05:00
Nick Mathewson
c2f30863e2 Fix renegotiation test to work around openssl 1.0.1 bug
There's a bug in openssl 1.0.1 where TLS1.1 and TLS1.2 can't
renegotiate with themselves.  When testing renegotiation with OpenSSL
>=1.0.1 and <1.0.1d, disable those protocols.
2012-11-15 11:43:45 -05:00
Nick Mathewson
1d9d5110a4 Use the same CFLAGS for openssl when building unit tests as with libevent 2012-11-15 11:41:36 -05:00
Patrick Pelletier
36d0ee5c9f preserve errno in evhttp_connection_fail_ for inspection by the callback 2012-11-13 21:22:39 -08:00
Derrick Pallas
81b6209e10 Fix event_dlist definition when sys/queue not included
This header adds TAILQ_HEAD and TAILQ_ENTRY if sys/queue is not included.
There is a similar macro that adds LIST_ENTRY but not LIST_HEAD, even though
LIST_HEAD is used later.

This change pulls in the correct definition (swiped from sys/queue) for
LIST_HEAD and cleans up the one spot where it is used.  The change can be
tested by adding

	#undef LIST_HEAD
	#undef LIST_ENTRY

right before the #ifndef checks and removing

	#define EVENT_DEFINED_LISTENTRY_
	#define EVENT_DEFINED_LISTHEAD_

so that the macros persist later.
2012-11-10 11:28:46 -08:00
Nick Mathewson
64051b903a Clean up unit test for evbuffer_file_segment_add_cleanup_cb a little 2012-11-06 17:42:54 -05:00
yangacer
e9f8febace Add a new callback to get called on evbuffer_file_segment free 2012-11-06 17:42:54 -05:00
Nick Mathewson
f9182d7249 Merge remote-tracking branch 'github/20_win64_compilation' into 21_win64_compilation
Conflicts:
	http.c
	signal.c
2012-11-02 11:46:14 -04:00
Nick Mathewson
62bd2c44f1 Fix compilation on mingw64 with -DUSE_DEBUG 2012-11-02 11:44:29 -04:00
Nick Mathewson
56e48c1019 Fix a few mingw64 incompatibilities introduced since 2.0 2012-11-02 10:58:02 -04:00
Nick Mathewson
2e6a985003 Merge remote-tracking branch 'github/20_win64_compilation' into 21_win64_compilation
Conflicts:
	event.c
	http.c
	sample/event-read-fifo.c
	test/regress_bufferevent.c
2012-11-01 18:12:07 -04:00
Nick Mathewson
6810908a5f Fix some warnings found cross-compiling with mingw32 2012-11-01 18:05:27 -04:00
Nick Mathewson
94866c2763 Compile without warnings on mingw64
This is mostly a matter of catching cases where we were still
assuming that evutil_socket_t could be used as an int.
2012-11-01 17:56:06 -04:00
Nick Mathewson
b738ee189f Merge remote-tracking branch 'rosslagerwall/python2' 2012-11-01 10:19:01 -04:00
Nick Mathewson
32ed11024a Merge remote-tracking branch 'origin/patches-2.0' 2012-10-26 19:37:00 -04:00
Nick Mathewson
2479d96405 Merge remote-tracking branch 'rosslagerwall/python2-2.0' into patches-2.0 2012-10-26 19:36:44 -04:00
Nick Mathewson
d5318b664d Merge remote-tracking branch 'origin/patches-2.0' 2012-10-26 19:34:47 -04:00
Juan Pablo Fernandez
cb853ea36c Close IOCP listener socket on free when LEV_OPT_CLOSE_ON_FREE is set 2012-10-26 19:33:31 -04:00
Nick Mathewson
cda69d0df0 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	bufferevent_openssl.c
2012-10-24 22:55:17 -04:00
Nick Mathewson
1ff2c249bd Merge remote-tracking branch 'public/20_bev_timeout_semantics' into patches-2.0 2012-10-24 22:48:59 -04:00
Patrick Pelletier
09098f70a2 fix a few trivial documentation typos 2012-10-23 22:09:45 -07:00
Ross Lagerwall
0eb01099da Use python2 rather than python
python may refer to either python2 or python3 so rather by explicit by
using python2.
See PEP 394 - http://www.python.org/dev/peps/pep-0394/ for more
details.
2012-10-23 13:30:58 +01:00
Ross Lagerwall
4b5f32a59e Use python2 rather than python
python may refer to either python2 or python3 so rather by explicit by
using python2.
See PEP 394 - http://www.python.org/dev/peps/pep-0394/ for more
details.
2012-10-23 13:26:44 +01:00
Nick Mathewson
f2050e79d5 Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	bufferevent_openssl.c
2012-09-22 19:21:21 -04:00
Joachim Bauch
1acf2ebcff No need to reserve space if reading is suspended.
Conflicts:
	bufferevent_openssl.c
2012-09-22 18:09:21 -04:00
Joachim Bauch
f719b8a918 Stop looping in "consider_reading" if reading is suspended. 2012-09-22 18:06:57 -04:00
Azat Khuzhin
05f1aca598 Fix typo : events instead of evets 2012-09-18 15:17:29 +04:00
Nick Mathewson
8827dbc3e9 Merge remote-tracking branch 'origin/patches-2.0' 2012-09-12 20:19:22 -04:00
George Danchev
f2bff75ed8 FIx another memleak on OOM in evdns 2012-09-12 20:12:03 -04:00