|
aab8c38b
|
2010-11-05T11:17:07
|
|
Add evhttp server alias interface, correct flagging of proxy requests.
evhttp needs to be mindful of all hostnames and addresses that clients
use to contact the main server and vhosts to know the difference between
proxy requests and non-proxy requests.
|
|
8faf223a
|
2010-11-17T00:09:10
|
|
Fix a memory leak in evhttp_uri_free.
|
|
5c8a59e8
|
2010-11-09T10:19:05
|
|
Merge remote branches 'github/20_evdns_cancel_segfault_v2', 'github/20_http_close_detect', 'github/20_http_versions', 'github/20_more_http_methods', 'github/20_shutdown_iocp_listener' and 'github/20_win64_fixes'
|
|
a38140be
|
2010-11-09T10:14:32
|
|
Refactor http version parsing into a single function
Based on a suggestion by Chris Davis to make
evhttp_parse_response_line tolerate odd versions too.
|
|
05124879
|
2010-11-04T14:05:08
|
|
Never call evhttp_readcb while writing.
|
|
c76640b5
|
2010-06-01T04:45:55
|
|
Don't disable reading from the HTTP connection after sending the request to be notified of connection-close in time
|
|
536311a4
|
2010-11-04T12:39:41
|
|
evhttp: Return 501 when we get an unrecognized method, not 400.
|
|
f5b391e2
|
2010-11-04T11:53:34
|
|
Tweak interface for allowed methods
|
|
75a73414
|
2010-11-04T11:25:35
|
|
Define enumerators for all HTTP methods, including PATCH from RFC5789
This patch defines enumerators for all HTTP methods that exist
(including PATCH introduced in RFC 5789).
It also makes them bit-masky (that's not a word, is it?), breaking
binary- but not source-code compatibility.
evhttp now stores a bitmask specifying for which methods requests to
dispatch and which ones to reject with "405 Method Not Allowed".
By default that's the ones we currently have (GET, POST, HEAD, PUT,
DELETE), thereby keeping functional compatibility (besides the minor
change that one of the other methods will now cause 405 instead of
400. But I believe that could even be considered a bug-fix).
evhttp is extended by evhttp_set_allowed_methods() with which the
user can change that bitmask.
no regressions here and my test-app still works. Haven't yet
actually tested any of the new methods.
What's obviously missing here is the special logic for the methods:
OPTIONS: We should be fine here - I believe our current dispatch
logic should work fine. Some convenience functions would be fine
though.
TRACE: I'm pretty certain we should never dispatch this to the
callbacks and simply implement the necessary functionality built-in.
CONNECT: Pretty straight-forward to implement (and considering the
framework in which we implement it very efficient too). Should
probably go built-in.
PATCH: Except for checking the RFC against our pre-dispatch logic
(there just might be some "MUST not have Some-Header" lurking
somewhere) there is nothing to be done here, this is completely up
to the user. Nothing to do.
|
|
78762383
|
2010-11-03T15:18:34
|
|
Merge branch 'http_nolegacy_v2'
|
|
22e0a9b2
|
2010-11-03T15:12:08
|
|
Add evhttp_response_code to remove one more reason to include http_struct.h
|
|
647e094c
|
2010-11-02T15:19:12
|
|
Replace exact-version checks for HTTP/1.1 with >= or < checks
|
|
aa5f55fa
|
2010-11-02T13:50:57
|
|
reset "chunked" flag when sending non-chunked reply
|
|
74a91e5a
|
2010-11-01T14:16:39
|
|
fix signed/unsigned warnings in http.c
|
|
545a6114
|
2010-11-01T13:59:04
|
|
Fix even more win64 warnings: buffer, event_tagging, http, evdns, evrpc
|
|
84a7053e
|
2010-10-26T21:33:22
|
|
Merge remote branch 'github/20_http_read_after_write'
|
|
a4063c06
|
2010-10-26T10:38:30
|
|
Note that 2.0.9 will break the ABI, and make changes we were postponing.
We had to turn a couple of 32-bit size arguments into 64-bit arguments
or size_t arguments (since otherwise we would have had to do it post
2.0.x-stable, and that would be worse).
|
|
74c0e862
|
2010-10-25T21:53:15
|
|
Avoid missed-request bug when entire http request arrives before data is flushed
The trigger for starting to read the first line of a request used to
be, "When data has arrived and we're looking for the first line."
But that's not good enough: if the entire next request gets read
into our bufev->inbuf while we're still processing the current
request, we'll never see any more data arrive, and so will never
process it.
So the fix is to make sure that whenever we hit evhttp_send_done, we
call evhttp_read_cb. We can't call it directly, though, since
evhttp_send_done is reachable from the user API, and evhttp_read_cb
can invoke user functions, and we don't want to force everyone to
have reentrant callbacks. So, we use a deferred_cb.
Found by Ivan Andropov. This is bug 3008344.
|
|
8e342e56
|
2010-10-25T16:09:11
|
|
Correctly count req->body_size on http usage without Content-Length
There was a dumb bug where we would look at the length of the input
buffer immediately _after_ we drained it.
|
|
58a1cc6b
|
2010-10-25T16:00:47
|
|
Fix a bug where we would read too much data in HTTP bodies or requests.
We were using evbuffer_add_buffer, which moved the entire buffer
contents. But if we had a valid content_length, we only wanted to
move up to the amount of data remaining in ntoread. Our bug would
make us put our ntoread in the negative, which would in turn make us
read all data until the connection closed.
Found by Denis Bilenko. Should fix bug 2963172.
|
|
525da3e1
|
2010-10-25T15:49:42
|
|
Fix Content-Length when trying send more than 100GB of data (!) on an evhttp.
|
|
006efa7d
|
2010-10-25T11:50:51
|
|
Functions to actually use evhttp_bound_socket with/as evconnlistener.
|
|
bf11e7dd
|
2010-10-21T15:33:13
|
|
Merge branch 'http_uri_parse'
|
|
45f6869c
|
2010-10-21T14:41:12
|
|
Make evhttp_uri non-public, and give it accessor functions.
|
|
2a3b5872
|
2010-10-21T12:23:10
|
|
Merge branch 'http_small_tweaks'
Conflicts:
http-internal.h
|
|
cd00079b
|
2010-10-21T12:19:28
|
|
Add evhttp_connection_get_base() to get the event_base from an http connection
Based on a patch by Mark Ellzey from 27 July 2010.
Closes ticket 3052406
|
|
2075fbcf
|
2010-10-19T13:15:48
|
|
Add evhttp_parse_query_str to be used with evhttp_uri_parse.
The old evhttp_parse_query() doesn't work well with struct
evhttp_uri.query, since it expects to get whole URIs, rather than
just the query portion.
|
|
a5a76e68
|
2010-10-19T12:35:50
|
|
Add a huge pile of tests for the new URI functions, and make them pass.
|
|
eaa5f1d9
|
2010-10-19T11:26:59
|
|
Revise evhttp_uri_parse implementation to handle more of RFC3986
|
|
fadbfd4e
|
2010-10-18T14:43:54
|
|
Clean up error handling in uri_parse a little
|
|
7d45431e
|
2010-10-18T14:38:48
|
|
Do not silently truncate URIs in evhttp_uri_join. Also avoid evbuffer_pullup.
|
|
86212341
|
2010-10-18T14:34:20
|
|
Make evhttp_uri_parse and friends conform to memory management standards
|
|
86dd720a
|
2010-08-08T16:46:39
|
|
Introduce absolute URI parsing helpers.
See evhttp_uri_parse(), evhttp_uri_free() and evhttp_uri_join() for details.
|
|
49f4bf7c
|
2010-10-18T13:58:02
|
|
Add evhttp_request_get_command so code can tell GET from POST without peeking at the struct.
|
|
a8148ced
|
2010-10-08T13:05:13
|
|
New evhttp_uri(encode|decode) functions to handle + and NUL characters right
The old evhttp_decode_uri() function would act as tough it was doing
an (illegal, undefined) decode operation on a whole URL at once, and
treat + characters following a ? as different from + characters
preceding one. But that's not useful: If you are decoding a URI
before splitting off query parameters, you are begging to fail as soon
as somebody gives you a value with an encoded & in it.
The new evhttp_uridecode() function takes an argument that says
whether to decode + signs. Both uridecode and uriencode also now
support encoding or decoding to strings with internal 0-valued
characters.
|
|
2e63a604
|
2010-10-08T12:57:11
|
|
evhttp_encode_uri encodes all reserved characters, including !$'()*+,/:=@
Perviously, some characters not listed as "unreserved" by RFC 3986
(notably "!$'()*+,/:=@") were not encoded by evhttp_encode_uri. This
made trouble, especially when encoding path components (where @ and /
are bad news) and parameters (where + should get encoded so it doesn't
later decode into a space).
Spotted by Bas Verhoeven.
|
|
3b844893
|
2010-10-06T12:35:38
|
|
Tweak evhttp_parse_query hack to avoid breaking abi
|
|
b1756d01
|
2010-10-06T11:48:52
|
|
Let evhttp_parse_query return -1 on failure
We already detected certain malformed queries, but we responded by
aborting the query-parsing process half-way through without telling
the user. Now, if query-parsing fails, no headers are returned, and
evhttp_parse_query returns -1.
|
|
145f221e
|
2010-10-05T13:06:32
|
|
Define symbolic constants to use in place of SHUT_RD etc
|
|
e0fd8708
|
2010-10-05T13:01:54
|
|
Send a shutdown(SHUT_WR) before closing an http connection
This avoids getting an ECONNRESET from the TCP stack.
Fixes bug 2928690
|
|
9c8db0f8
|
2010-09-23T22:45:55
|
|
Fix all warnings in the main codebase flagged by -Wsigned-compare
Remember, the code
int is_less_than(int a, unsigned b) {
return a < b;
}
is buggy, since the C integer promotion rules basically turn it into
int is_less_than(int a, unsigned b) {
return ((unsigned)a) < b;
}
and we really want something closer to
int is_less_than(int a, unsigned b) {
return a < 0 || ((unsigned)a) < b;
}
.
Suggested by an example from Ralph Castain
|
|
90b3ed5b
|
2010-08-09T13:25:50
|
|
Add some comments to http.c and make a few functions static.
|
|
ec347b92
|
2010-07-07T16:45:03
|
|
Move event-config.h to include/event2
This change means that all required include files are in event2, and
all files not in event2/* are optional.
|
|
29b2e233
|
2010-05-30T03:17:48
|
|
Fix possible nullptr dereference in evhttp_send_reply_end()
(The existing implementation had sanity-checking code for the case where
its argument was NULL, but it erroneously dereferenced it before actually
doing the sanity-check. --nickm)
|
|
39906698
|
2010-05-26T12:58:02
|
|
Let evhttp_send_error infer the right error reasons
|
|
06bd0563
|
2010-05-26T12:50:59
|
|
Fix the default HTTP error template
The current template...
<HTML><HEAD><TITLE>%s</TITLE>
</HEAD><BODY>
<H1>Method Not Implemented</H1>
Invalid method in request<P>
</BODY></HTML>
is highly confusing. The given title is easily overlooked and the
hard-coded content is just plain wrong in most cases (I really read
this as "the server did not understand the requested HTTP method)
This patch changes the template to include the error reason in the
body as well as in the header, and to infer the proper reason from
the status code whenever the reason argument is NULL.
This patch also removes a redundant evhttp_add_header from
evhttp_send_error; evhttp_send_page already adds a "Connection:
close" header.
|
|
caca2f45
|
2010-05-14T14:36:49
|
|
Replace (safe) use of strcpy with memcpy to appease OpenBSD
If Libevent uses strcpy, even safely, it seems OpenBSD's linker will
complain every time a library links Libevent. It's easier just not to
use the old thing, even when it's safe to do so.
|
|
c1cd32a1
|
2010-05-08T22:21:52
|
|
Define _REENTRANT as needed on Solaris, elsewhere
It turns out that _REENTRANT isn't only needed to make certain
functions visible; we also need it to make pthreads work properly
some places (like Solaris, where forgetting _REENTRANT basically
means that all threads are sharing the same errno). Fortunately,
our ACX_PTHREAD() configure macro already gives us a PTHREAD_CFLAG
variable, so all we have to do is use it.
|
|
953e2290
|
2010-05-03T11:29:22
|
|
Refuse null keys in evhttp_parse_query()
evhttp_parse_query() currently accepts empty keys, that don't make any
sense.
-Frank
[From sourceforge patch 2995183]
-Nick
|
|
bd1ed5f3
|
2010-05-02T12:51:35
|
|
Fix a compile warning introduced in 739e688
|
|
739e6882
|
2010-04-28T21:33:13
|
|
Allow empty reason line in HTTP status
|
|
9d8edf2f
|
2010-04-23T18:59:22
|
|
do not leak the request object on persistent connections
|
|
899c1dcc
|
2010-04-14T15:42:57
|
|
Replace EVUTIL_CLOSESOCKET macro with a function
The EVUTIL_CLOSESOCKET() macro required you to include unistd.h in your
source for POSIX. We might as well turn it into a function: an extra
function call is going to be cheap in comparison with the system call.
We retain the EVUTIL_CLOSESOCKET() macro as an alias for the new
evutil_closesocket() function.
(commit message from email by Nick and Sebastian)
|
|
13e4f3bd
|
2010-03-08T13:46:48
|
|
Avoid errors in http.c when building with VC 2003 .NET
|
|
c7cf6f00
|
2010-03-05T12:47:46
|
|
Replace users of "int fd" with "evutil_socket_t fd" in portable code
Remeber, win32 has a socket type that's actually a handle, so if
there's a chance that code is run on win32, we can't use "int" as the
socket type.
This isn't a blind search-and-replace: sometimes an fd is really in
fact for a file, and not a socket at all.
|
|
17efc1cd
|
2010-03-04T01:25:51
|
|
Update all our copyright notices to say "2010"
|
|
e5cf9879
|
2010-02-18T17:46:56
|
|
Clean up formatting: remove trailing spaces
|
|
e5bbd40a
|
2010-02-18T17:41:15
|
|
Clean up formatting: use tabs, not 8-spaces, to indent.
|
|
8fdf09c0
|
2010-02-18T17:08:50
|
|
Clean up formatting: Disallow space-before-tab.
|
|
cfe7a9ff
|
2010-02-04T10:15:39
|
|
Merge remote branch 'niels/http_chunk'
|
|
39781801
|
2010-02-03T16:54:18
|
|
make evhttp_send() safe against terminated connections, too
|
|
e2d15d81
|
2010-02-03T17:52:55
|
|
Merge remote branch 'niels/http_chunk'
|
|
93d73691
|
2010-02-03T14:34:56
|
|
do not fail while sending on http connections the client closed.
when sending chunked requests via multiple calls to evhttp_send_reply_chunk,
the client may close the connection before the server is done sending. this
used to cause a crash.
we introduce a new function evhttp_request_get_connection() that allows the
server to determine if the request is still associated with a connection.
If it's not, evhttp_request_free() needs to be called explicitly or the user
can call evhttp_send_reply_end() which just frees the request, too.
|
|
8f654678
|
2010-02-03T16:25:34
|
|
Merge remote branch 'github/http_listener'
Conflicts:
http.c
|
|
a19b4a05
|
2010-01-25T13:38:07
|
|
Call event_debug_unassign on internal events
I don't expect that many users will be so religious about calling
unassign, but we need to be so that it's at least possible to use
debug mode without eating memory.
|
|
5c7a7bca
|
2010-01-23T20:07:05
|
|
Fix windows and msvc build
|
|
ff3f6cd4
|
2010-01-22T16:14:49
|
|
Check more internal event_add() calls for failure
Most of these should be unable to fail, since adding a timeout
generally always works. Still, it's better not to try to be "too
smart for our own good here."
There are some remaining event_add() calls that I didn't add checks
for; I've marked those with "XXXX" comments.
|
|
5032e526
|
2010-01-14T15:42:07
|
|
do not use a function to assign the evdns base; instead assign it via evhttp_connection_base_new() which is a new function introduced in 2.0
|
|
ec34533a
|
2009-12-30T00:41:03
|
|
Make http use evconnlistener.
Now that we have a generic listen-on-a-socket mechanism, there's no
longer any reason to have a separate listen-on-a-socket implementation
in http.c.
This also lets us use IOCP and AcceptEx() when they're enabled.
Possibly, we should have a new mechanism to add a socket given only a
listener.
|
|
c698b77d
|
2009-12-30T00:11:27
|
|
Allow http connections to use evdns for hostname looksups.
This was as simple as using bufferevent_connect_hostname instead of
calling connect() ourself, which already knows how to use an
evdns_base if it gets one.
Untangling the bind code might be a little trickier.
|
|
d0939d2b
|
2009-12-29T16:21:26
|
|
Introduced evutil_make_socket_closeonexec() to preserve fd flags for F_SETFD.
Use this to eliminate the various macros that called F_SETFD throughout
the code.
|
|
f1691539
|
2009-11-19T23:08:50
|
|
Remove most calls to event_err() in http and deal with memory errors instead
svn:r1555
|
|
b8f222e0
|
2009-11-19T21:14:31
|
|
On FreeBSD and other OSes, connect can return ECONREFUSED immediately; instead of failing the function call, pretend with faileld in the callback.
svn:r1553
|
|
86f57420
|
2009-11-16T22:25:46
|
|
Add two implementations of getaddrinfo: one blocking and one nonblocking.
The entry points are evutil_getaddrinfo and evdns_getaddrinfo respectively.
There are fairly extensive unit tests.
I believe this code conforms to RFC3493 pretty closely, but there are
probably more issues. It should get tested on more platforms.
This code means we can dump the well-intentioned but weirdly-implemented
bufferevent_evdns and evutil_resolve code.
svn:r1537
|
|
c79a45e0
|
2009-11-14T21:54:30
|
|
Fix a couple of event_debug calls.
svn:r1527
|
|
37e23f80
|
2009-11-09T18:50:20
|
|
Patch from Ryan Phillips: accept ipv6 addresses returned by getaddrinfo in http.c
svn:r1522
|
|
784b8773
|
2009-11-06T21:46:57
|
|
We do not work any more without an event-config.h; stop pretending that it is meaningful to check for HAVE_CONFIG_H
svn:r1516
|
|
ac633aeb
|
2009-11-05T21:22:23
|
|
Fix some build warnings on MSVC, mostly related to signed/unsigned comparisons.
svn:r1510
|
|
34f28e08
|
2009-11-05T15:57:22
|
|
Fix a few types to use compatible versions
svn:r1501
|
|
47bad8ab
|
2009-11-04T20:17:32
|
|
Implement size limits on HTTP header length and body length.
Patch from Constantine Verutin, simplified a little.
svn:r1500
|
|
0b9eb1bf
|
2009-11-03T20:40:48
|
|
Add a bufferevent function to resolve a name then connect to it.
This function, bufferevent_socket_connect_hostname() can either use
evdns to do the resolve, or use a new function (evutil_resolve) that
uses getaddrinfo or gethostbyname, like http.c does now.
This function is meant to eventually replace the hostname resolution mess in
http.c.
svn:r1496
|
|
2e36dbe1
|
2009-10-26T20:00:43
|
|
Use EVUTIL_ASSERT() consistently instead of assert.
svn:r1464
|
|
e3fd294a
|
2009-10-16T13:19:57
|
|
Spelling fixes in comments and strings.
svn:r1445
|
|
2c1b0e44
|
2009-08-16T19:22:15
|
|
Fix build warnings and add changelog entry for evhttp patches.
svn:r1424
|
|
c8b0fe4a
|
2009-08-16T19:22:10
|
|
Define evhttp_del_accept_socket
[Patch from David Reiss]
svn:r1423
|
|
6c53334c
|
2009-08-16T19:22:04
|
|
Define evhttp_{bind,accept}_socket_with_handle
[Patch from David Reiss]
svn:r1422
|
|
4bcd5646
|
2009-08-16T19:21:57
|
|
Make evhttp_bound_socket visible, and provide an accessor to its fd
Declare the previously private struct evhttp_bound_socket in
event2/http.h as an opaque struct.
Implement evhttp_bound_socket_get_fd, which returns the file descriptor
of an evhttp_bound_socket.
[Patch from David Reiss]
svn:r1421
|
|
7c20a6ae
|
2009-07-30T17:01:21
|
|
Export an ev_socklen_t.
svn:r1391
|
|
72ea534f
|
2009-07-28T19:41:57
|
|
Export evutil_str[n]casecmp as evutil_ascii_str[n]casecmp.
svn:r1387
|
|
83f46e51
|
2009-05-13T20:36:56
|
|
Do not use the "evbuffer_" prefix to denote parts of bufferevents.
This is a bit of an interface doozy, but it's really needed in order
to be able to document this stuff without apologizing it. This patch
does the following renamings:
evbuffercb -> bufferevent_data_cb
everrorcb -> bufferevent_event_cb
EVBUFFER_(READ,WRITE,...) -> BEV_EVENT_(...)
EVBUFFER_(INPUT,OUTPUT) -> bufferevent_get_(input,output)
All the old names are available in event2/bufferevent_compat.h
svn:r1283
|
|
f11dff2c
|
2009-05-07T03:45:51
|
|
Add and use locale-independent strcasecmp functions.
svn:r1280
|
|
5a3eddf0
|
2009-05-02T16:24:05
|
|
Use fewer _compat.h headers in our own code.
svn:r1268
|
|
e865eb93
|
2009-05-01T00:54:14
|
|
More msvc build tweaks.
svn:r1262
|
|
c5c9589f
|
2009-04-23T06:27:58
|
|
Add missing case to make http.c compile with warnings enabled.
svn:r1232
|
|
9516df0e
|
2009-04-23T05:40:06
|
|
Fix c89 bugs reported by Cory Stup.
Others may remain. I wasn't able to get gcc --std=c89 to build libevent
at all, so I don't know what compiler the original reporter is using here.
Note that this change requires us to disable the part of our rpc code
that uses variadic macros when using a non-gcc compiler. This is a
problem if we want our rpc api to be portable.
svn:r1231
|
|
a8f6d961
|
2009-04-17T06:56:09
|
|
Actually stop using EVBUFFER_LENGTH/DATA, and move them to buffer_compat.h
svn:r1183
|
|
30648529
|
2009-04-17T01:03:07
|
|
have evhttp_set_cb return an int; -1 on failure, 0 on success; this is better than returning a pointer
svn:r1179
|
|
d2794e65
|
2009-04-11T15:26:29
|
|
document evhttp_parse_query better
svn:r1157
|
|
382a1587
|
2009-04-11T04:18:49
|
|
previous commit changed the semantics of evhttp_decode_uri; need a test for that
svn:r1156
|
|
ce146eb1
|
2009-04-10T05:43:45
|
|
Fix parsing of queries where the encoded queries contained \r, \n or +
svn:r1148
|