kc3-lang/libevent/http.c

Branch :


Log

Author Commit Date CI Message
78762383 2010-11-03 15:18:34 Merge branch 'http_nolegacy_v2'
22e0a9b2 2010-11-03 15:12:08 Add evhttp_response_code to remove one more reason to include http_struct.h
aa5f55fa 2010-11-02 13:50:57 reset "chunked" flag when sending non-chunked reply
84a7053e 2010-10-26 21:33:22 Merge remote branch 'github/20_http_read_after_write'
a4063c06 2010-10-26 10: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-25 21: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-25 16: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-25 16: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-25 15:49:42 Fix Content-Length when trying send more than 100GB of data (!) on an evhttp.
006efa7d 2010-10-25 11:50:51 Functions to actually use evhttp_bound_socket with/as evconnlistener.
bf11e7dd 2010-10-21 15:33:13 Merge branch 'http_uri_parse'
45f6869c 2010-10-21 14:41:12 Make evhttp_uri non-public, and give it accessor functions.
2a3b5872 2010-10-21 12:23:10 Merge branch 'http_small_tweaks' Conflicts: http-internal.h
cd00079b 2010-10-21 12: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-19 13: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-19 12:35:50 Add a huge pile of tests for the new URI functions, and make them pass.
eaa5f1d9 2010-10-19 11:26:59 Revise evhttp_uri_parse implementation to handle more of RFC3986
fadbfd4e 2010-10-18 14:43:54 Clean up error handling in uri_parse a little
7d45431e 2010-10-18 14:38:48 Do not silently truncate URIs in evhttp_uri_join. Also avoid evbuffer_pullup.
86212341 2010-10-18 14:34:20 Make evhttp_uri_parse and friends conform to memory management standards
86dd720a 2010-08-08 16:46:39 Introduce absolute URI parsing helpers. See evhttp_uri_parse(), evhttp_uri_free() and evhttp_uri_join() for details.
49f4bf7c 2010-10-18 13:58:02 Add evhttp_request_get_command so code can tell GET from POST without peeking at the struct.
a8148ced 2010-10-08 13: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-08 12: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-06 12:35:38 Tweak evhttp_parse_query hack to avoid breaking abi
b1756d01 2010-10-06 11: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-05 13:06:32 Define symbolic constants to use in place of SHUT_RD etc
e0fd8708 2010-10-05 13: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-23 22: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-09 13:25:50 Add some comments to http.c and make a few functions static.
ec347b92 2010-07-07 16: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-30 03: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-26 12:58:02 Let evhttp_send_error infer the right error reasons
06bd0563 2010-05-26 12: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-14 14: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-08 22: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-03 11: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-02 12:51:35 Fix a compile warning introduced in 739e688
739e6882 2010-04-28 21:33:13 Allow empty reason line in HTTP status
9d8edf2f 2010-04-23 18:59:22 do not leak the request object on persistent connections
899c1dcc 2010-04-14 15: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-08 13:46:48 Avoid errors in http.c when building with VC 2003 .NET
c7cf6f00 2010-03-05 12: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-04 01:25:51 Update all our copyright notices to say "2010"
e5cf9879 2010-02-18 17:46:56 Clean up formatting: remove trailing spaces
e5bbd40a 2010-02-18 17:41:15 Clean up formatting: use tabs, not 8-spaces, to indent.
8fdf09c0 2010-02-18 17:08:50 Clean up formatting: Disallow space-before-tab.
cfe7a9ff 2010-02-04 10:15:39 Merge remote branch 'niels/http_chunk'
39781801 2010-02-03 16:54:18 make evhttp_send() safe against terminated connections, too
e2d15d81 2010-02-03 17:52:55 Merge remote branch 'niels/http_chunk'
93d73691 2010-02-03 14: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-03 16:25:34 Merge remote branch 'github/http_listener' Conflicts: http.c
a19b4a05 2010-01-25 13: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-23 20:07:05 Fix windows and msvc build
ff3f6cd4 2010-01-22 16: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-14 15: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-30 00: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-30 00: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-29 16: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-19 23:08:50 Remove most calls to event_err() in http and deal with memory errors instead svn:r1555
b8f222e0 2009-11-19 21: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-16 22: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-14 21:54:30 Fix a couple of event_debug calls. svn:r1527
37e23f80 2009-11-09 18:50:20 Patch from Ryan Phillips: accept ipv6 addresses returned by getaddrinfo in http.c svn:r1522
784b8773 2009-11-06 21: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-05 21:22:23 Fix some build warnings on MSVC, mostly related to signed/unsigned comparisons. svn:r1510
34f28e08 2009-11-05 15:57:22 Fix a few types to use compatible versions svn:r1501
47bad8ab 2009-11-04 20:17:32 Implement size limits on HTTP header length and body length. Patch from Constantine Verutin, simplified a little. svn:r1500
0b9eb1bf 2009-11-03 20: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-26 20:00:43 Use EVUTIL_ASSERT() consistently instead of assert. svn:r1464
e3fd294a 2009-10-16 13:19:57 Spelling fixes in comments and strings. svn:r1445
2c1b0e44 2009-08-16 19:22:15 Fix build warnings and add changelog entry for evhttp patches. svn:r1424
c8b0fe4a 2009-08-16 19:22:10 Define evhttp_del_accept_socket [Patch from David Reiss] svn:r1423
6c53334c 2009-08-16 19:22:04 Define evhttp_{bind,accept}_socket_with_handle [Patch from David Reiss] svn:r1422
4bcd5646 2009-08-16 19: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-30 17:01:21 Export an ev_socklen_t. svn:r1391
72ea534f 2009-07-28 19:41:57 Export evutil_str[n]casecmp as evutil_ascii_str[n]casecmp. svn:r1387
83f46e51 2009-05-13 20: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-07 03:45:51 Add and use locale-independent strcasecmp functions. svn:r1280
5a3eddf0 2009-05-02 16:24:05 Use fewer _compat.h headers in our own code. svn:r1268
e865eb93 2009-05-01 00:54:14 More msvc build tweaks. svn:r1262
c5c9589f 2009-04-23 06:27:58 Add missing case to make http.c compile with warnings enabled. svn:r1232
9516df0e 2009-04-23 05: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-17 06:56:09 Actually stop using EVBUFFER_LENGTH/DATA, and move them to buffer_compat.h svn:r1183
30648529 2009-04-17 01: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-11 15:26:29 document evhttp_parse_query better svn:r1157
382a1587 2009-04-11 04:18:49 previous commit changed the semantics of evhttp_decode_uri; need a test for that svn:r1156
ce146eb1 2009-04-10 05:43:45 Fix parsing of queries where the encoded queries contained \r, \n or + svn:r1148
6dece3e9 2009-04-10 05:22:15 revert last commit; git user error svn:r1147
f43f1d14 2009-04-10 05:18:18 initial version of query decoding patch svn:r1146
cd731b77 2009-02-10 21:40:12 Do not use ctypes functions in cases when we need the "net" locale. This patch adds a new set of EVUTIL_IS* functions to replace use of the ctypes is* functions in all cases where we care about characters' interpretations in net ascii rather than in the locale. For example, when we're working with DNS hostnames, we don't want to do the 0x20 hack on non-ascii characters, even if the host thinks they should be isalpha. svn:r1114
deb2a121 2009-02-10 19:38:14 use new evutil_make_listen_socket_reuseable() in http.c svn:r1103
ea4b8724 2009-02-02 19:22:13 checkpoint work on big bufferevent refactoring svn:r1095
7dd362b1 2009-01-29 15:09:24 Have util-internal.h define socklen_t if we need it, and include it appropriately. This fixes win32 compilation. svn:r1070
b85b710c 2009-01-27 22:34:36 Update copyright statements to reflect the facts that: a) this is 2009 b) niels and nick have been comaintainers for a while c) saying "all rights reserved" when you then go on to explicitly disclaim some rights is sheer cargo-cultism. svn:r1065
8889a770 2009-01-27 22:30:46 Replace all use of config.h with event-config.h. svn:r1064
9993137c 2009-01-27 21:10:31 Remove all trailing whitespace in all the source files. svn:r1063
5e796901 2009-01-16 00:25:54 clean up buffered data on reset; reported by Brian O'Kelley svn:r1015
9935d5b0 2009-01-13 21:39:32 Fix win32 compilation. Surprisingly, unit tests pass too. svn:r1002
169321c9 2009-01-13 20:26:37 Rename four internal headers to follow the -internal.h convention. svn:r1000