buffer.c


Log

Author Commit Date CI Message
Nick Mathewson 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
Nick Mathewson ac633aeb 2009-11-05T21:22:23 Fix some build warnings on MSVC, mostly related to signed/unsigned comparisons. svn:r1510
Nick Mathewson 7f0ad2f6 2009-11-02T16:17:06 Fix an errant user of ssize_t to use ev_ssize_t. My usual strategy of grep '[^_]ssize_t' had apparently failed me, since this ssize_t was in the first column. Resolves bug 2890434; spotted by Mihai Draghicioiu. svn:r1484
Nick Mathewson 10cf631e 2009-10-27T04:04:07 Do not add a newline to the end of log statements. svn:r1468
Nick Mathewson 2e36dbe1 2009-10-26T20:00:43 Use EVUTIL_ASSERT() consistently instead of assert. svn:r1464
Nick Mathewson e3fd294a 2009-10-16T13:19:57 Spelling fixes in comments and strings. svn:r1445
Niels Provos 8e8d94a3 2009-09-24T22:18:19 Do not drop data from evbuffer when out of memory; reported by Jacek Masiulaniec svn:r1436
Nick Mathewson 3b461a6d 2009-09-11T18:21:37 Treat a negative number of bytes to read as the kernel saying "I don't know." svn:r1426
Nick Mathewson 22bd5b42 2009-08-16T16:40:42 Support sendfile on solaris: patch from Caitlin Mercer. svn:r1419
Nick Mathewson 8a99083f 2009-08-07T17:16:52 Add an evbuffer_search_range() to search a bounded range of a buffer This can be handy when you have one search to find the end of a header section, and then you want to find a substring within the header section without looking at the body. svn:r1410
Nick Mathewson d4134772 2009-07-31T17:35:42 Refactor evbuffer_readln() into a search-for-eol function and an extract-line function. svn:r1404
Nick Mathewson a26d2d1b 2009-07-31T17:34:47 Refactor evbuffer_readln to use evbuffer_ptr; remove old evbuffer_iterator. svn:r1403
Nick Mathewson b06b2649 2009-07-26T01:29:39 Make "deferred callback queue" independent of event_base. This way, we can more easily have an IOCP bufferevent implementation that does not need an event_base at all. Woot. svn:r1381
Nick Mathewson 8eb155a1 2009-07-23T14:48:24 Fix build on platforms (like Solaris 10, reportedly) which lack a MAP_FILE. svn:r1375
Nick Mathewson 5aefb8a6 2009-06-25T15:22:36 Fix type on freebsd sendfile. Patch from navin seshadri. Fixes bug 2811991 svn:r1330
Nick Mathewson 0b22ca19 2009-05-22T19:11:48 Use ev_ssize_t in place of ssize_t *everywhere*. svn:r1309
Nick Mathewson 8997f234 2009-05-21T20:59:00 Use the native "struct iovec" as our "struct evbuffer_iovec" when available, so we do not need to copy more pointers than necessary. svn:r1299
Nick Mathewson 23243b8a 2009-05-19T21:39:35 Replace reserve/commit with new iovec-based interface. Add a new evbuffer_peek. svn:r1296
Nick Mathewson dc4c7b95 2009-05-15T22:44:18 Change the interface of evbuffer_add_reference: give the cleanup function more info. svn:r1294
Nick Mathewson bba69e03 2009-05-15T20:23:59 New semantics for evbuffer_cb_set_flags(). Previously, set_flags() would replace all previous user-visible flags. Now it just sets the flags, and there is a clear_flags() function to clear other flags. svn:r1293
Nick Mathewson e865eb93 2009-05-01T00:54:14 More msvc build tweaks. svn:r1262
Nick Mathewson 24607a39 2009-04-29T20:48:43 Note a place we might do better about lock releasing. svn:r1252
Nick Mathewson 11cab334 2009-04-28T19:08:07 Fix compile: #elif FOO is not the same as #elif defined(FOO). svn:r1245
Niels Provos 5c4c13d8 2009-04-24T03:24:22 make sendfile work on freebsd svn:r1239
Nick Mathewson ec6bfd03 2009-04-23T21:41:53 Fix for evbuffer_read() when all data fits in penultimate chain. Previously we were reading into the next-to-last chain, but incrementing the fullness of the last. Bug found by Victor Goya. svn:r1237
Nick Mathewson a8f6d961 2009-04-17T06:56:09 Actually stop using EVBUFFER_LENGTH/DATA, and move them to buffer_compat.h svn:r1183
Nick Mathewson 93d4f884 2009-04-14T20:11:10 Make buffer iocp stuff compile happily svn:r1174
Nick Mathewson 0e32ba54 2009-04-13T03:06:59 Do not remove an empty chain that we have pinned for reading when we drain the whole buffer. svn:r1166
Nick Mathewson 9f1a94ec 2009-04-13T03:06:47 add pin/unpin functions, and a deref-and-free pair. svn:r1165
Nick Mathewson dcda7915 2009-04-13T03:06:27 Add a reference count to evbuffers. svn:r1164
Nick Mathewson b01891fe 2009-04-13T03:06:05 Make evbuffer_commit_space trigger callbacks. svn:r1163
Nick Mathewson 829b52b6 2009-04-13T03:05:46 Refactor the code that sets up iovecs for reading into its own function. iocp needs this. svn:r1162
Nick Mathewson b29b875d 2009-04-10T20:43:08 Facility to make evbuffers get their callbacks deferred. svn:r1154
Nick Mathewson 747331d1 2009-04-08T03:04:39 Add freeze support to evbuffers. From the documentation: Prevent calls that modify an evbuffer from succeeding. A buffer may frozen at the front, at the back, or at both the front and the back. If the front of a buffer is frozen, operations that drain data from the front of the buffer, or that prepend data to the buffer, will fail until it is unfrozen. If the back a buffer is frozen, operations that append data from the buffer will fail until it is unfrozen. We'll use this to ensure correctness on an evbuffer when we're waiting for an overlapped IO call to finish. svn:r1143
Nick Mathewson d9086fc0 2009-04-08T03:03:59 Add a new facility to "pin" the memory in an evbuffer chain. For overlapped IO (and possibly other stuff) we need to be able to label an evbuffer_chain as "pinned", meaning that every byte in it must remain at the same address as it is now until it unpinned. This differs from being "immutable": it is okay to add data to the end of a pinned chain, so long as existing data is not moved. svn:r1142
Nick Mathewson 60e0d59b 2009-04-05T02:44:17 Add locking to evbuffers. svn:r1134
Nick Mathewson f1b1bad4 2009-04-03T14:27:03 Make the new evbuffer callbacks use a new struct-based interface. The old interface would fail pretty hard when we had to batch up multiple adds and drains in a single call. svn:r1131
Nick Mathewson f90500a5 2009-04-03T01:21:36 Add a new improved search function. The old evbuffer_find didn't allow iterative searching, and forced us to repack the buffer completely every time we searched in it. The new evbuffer_search addresses both of these. As a side-effect, the evbuffer_find implementation is now a little more efficient. svn:r1130
Nick Mathewson 01456265 2009-02-10T19:39:22 Explode less badly in the case where we're told to prepend/append/remove a buffer to itself. Note some API/implementation deficiencies. svn:r1110
Nick Mathewson edfdb698 2009-02-10T19:38:34 Add an assertion to evbuffer_chain_align so we can't reuse it in the future. svn:r1105
Nick Mathewson cc049bfc 2009-02-03T05:22:57 Enable (and debug) WSARecv for evbuffer iovec-like reads. The two things we were missing: the flags parameter is not optional, and an error can actually indicate a close. svn:r1100
Nick Mathewson e84c7656 2009-02-01T05:26:47 Allocate callback entries with contents 0d out. svn:r1093
Nick Mathewson 8d3a10f8 2009-02-01T01:43:58 Support temporarily suspending an evbuffer callback. This is different from disabling the callback, since we want to process changes, but not just yet. svn:r1091
Niels Provos a0cae310 2009-01-29T03:22:47 make it so that evbuffer_add_file where we read the complete contents of the file can fail without side effects svn:r1069
Niels Provos 66b2a7ff 2009-01-29T03:20:40 test evbuffer_add_reference svn:r1068
Nick Mathewson b85b710c 2009-01-27T22: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
Nick Mathewson 8889a770 2009-01-27T22:30:46 Replace all use of config.h with event-config.h. svn:r1064
Nick Mathewson 9993137c 2009-01-27T21:10:31 Remove all trailing whitespace in all the source files. svn:r1063
Nick Mathewson 88f2b7a0 2009-01-27T13:37:09 Fix some warnings on linux gcc with --enable-gcc-warnings svn:r1060
Niels Provos 1757cf71 2009-01-27T06:21:12 use %zu for off_t svn:r1059
Niels Provos 8b5bd774 2009-01-27T06:18:45 make it compile on linux svn:r1058
Niels Provos fdf69493 2009-01-27T06:05:38 sendfile/mmap and memory reference implementation for evbuffers svn:r1057
Niels Provos b93e5054 2009-01-27T05:33:39 second argument to evbuffer_pullup should be ssize_t svn:r1056
Nick Mathewson 81dd04a7 2009-01-23T18:04:34 Add a "flags" field to evbuffer callbacks. For now, there is just one: enabled. This lets us avoid lots of mallocs/frees/tailq-manipulations just to turn a callback on and off. The revised bufferevent code wants this. svn:r1047
Nick Mathewson de7f7a84 2009-01-23T18:03:45 Remove in_callbacks check: allow full recursion in evbuffer callbacks. If you get yourself in an infinite loop, that's not our fault. Note this in the docs. Also reindent some docs now that my tabs match Niels's. svn:r1046
Nick Mathewson ec2f4cbc 2009-01-23T01:35:57 Move obsolete evbuffer function into include/event2/buffer_compat.h svn:r1043
Nick Mathewson c735f2b4 2009-01-23T01:11:13 Code to allow multiple callbacks per evbuffer. svn:r1042
Nick Mathewson f6eb1f81 2009-01-19T21:53:03 Change evbuffer_read implementation to split data across chunks, and use readv when available. This should make us use less space. svn:r1024
Nick Mathewson 84031819 2009-01-14T22:17:31 Make some evbuffer functions const svn:r1010
Nick Mathewson 3552ac1e 2009-01-14T19:39:17 Do not allow chain length to expand indefinitely. svn:r1007
Nick Mathewson 6d3ed065 2009-01-14T14:58:48 Simplify evbuffer_write logic: combine nearly all of WSASend and writev cases. svn:r1004
Nick Mathewson bab8f2e1 2009-01-13T22:02:32 Fix compilation on win32 WSASend evbuffer_write() code. Still not enabled until I make sure that the unit tests test this. They _do_ pass. svn:r1003
Nick Mathewson 169321c9 2009-01-13T20:26:37 Rename four internal headers to follow the -internal.h convention. svn:r1000
Nick Mathewson 822ca048 2009-01-13T19:34:50 Untested (and compiled-out) evbuffer_write backend to use WSASend on win32 where we use writev on unix. svn:r998
Nick Mathewson 99db0e7f 2009-01-12T20:42:19 Add a new evbuffer_write_atmost() functino to write no more than a given number of bytes to an fd. svn:r993
Niels Provos e711ce45 2008-06-21T06:10:10 reintroduce a memmove when there is enough misalignment to hold the new data; otherwise the size of the buffer may grow without bounds svn:r857
Niels Provos 9586a1cb 2008-06-01T16:21:24 fix an evbuffer corruption when adding an empty evbuffer; from Scott Lamb svn:r845
Nick Mathewson c6da86ff 2008-05-12T16:44:24 r19709@catbus: nickm | 2008-05-12 12:42:48 -0400 Possible fix for [1960723] snprintf and vsnprintf return values are wrong on win32 svn:r813
Nick Mathewson 6bf1ca78 2008-05-12T00:40:04 r19675@catbus: nickm | 2008-05-11 20:39:39 -0400 Stop pretending that u_char and u_short are standard types that win32 is dumb not to have. In fact, u_char can really just be spelled out, and u_short was usually just a bad way of saying ev_uint16_t. svn:r808
Nick Mathewson 8acb80b4 2008-05-08T22:51:39 r15551@tombo: nickm | 2008-05-08 14:49:20 -0400 Use _get_ convention for new accessor functions. (These are all new ones as of 2.0, I believe). svn:r799
Niels Provos f04497e4 2008-05-03T03:05:28 introduce evbuffer_reserve_space() and evbuffer_commit_space() to make processing in filters more efficient svn:r757
Niels Provos becc89b7 2008-05-03T02:37:18 introduce evbuffer_contiguous_space() and use it in the zlib filter test svn:r756
Nick Mathewson 49868b61 2008-04-25T01:18:08 r15316@tombo: nickm | 2008-04-24 20:58:36 -0400 Rename internal memory management functions from event_malloc() etc to mm_malloc() etc. svn:r725
Nick Mathewson 0ac73078 2008-04-16T20:01:51 r15193@tombo: nickm | 2008-04-16 16:00:35 -0400 Split event.h into several new headers in include/event2. event.h is now just a wrapper that includes all the subheaders. svn:r711
Niels Provos 193c06a7 2008-03-31T02:04:34 fix a bug in which evbuffer_add_vfprintf would loop forever; avoid fragmentation in evbuffer_expand by increasing the size of the last buffer in the chain; as a result with have to keep track of the previous_to_last chain; provide a evbuffer_validate() function in the regression test to make sure that all evbuffer are internally consistent. svn:r699
Niels Provos 00382110 2008-02-29T05:23:49 address nick's comments and make evbuffer_pullup more efficient svn:r680
Nick Mathewson 0322ce0a 2008-02-28T18:36:03 r18486@catbus: nickm | 2008-02-28 13:35:53 -0500 Make offsetof into evutil_offsetof. Be a little more willing to call evbuffer_chain_align() from evbuffer_expand(). Clarify some docs, and add some XXX comments to note questionable areas. svn:r677
Nick Mathewson d71da6f7 2008-02-28T17:47:30 r18484@catbus: nickm | 2008-02-28 12:47:20 -0500 Use event_warn() function, not fprintf-to-stderr. svn:r676
Nick Mathewson 0e7cbe65 2008-02-28T17:38:52 r18482@catbus: nickm | 2008-02-28 12:38:40 -0500 Fix GCC 4.2 warnings; fix includes in subdirs. svn:r675
Niels Provos 5c70ea4c 2008-02-28T02:47:43 improved code for evbuffer; avoids memcpy svn:r674
Niels Provos 67bf29ad 2008-02-23T06:02:04 simplify evbuffer by removing orig_buffer svn:r654
Nick Mathewson 1120f04f 2007-11-25T21:53:06 r16731@catbus: nickm | 2007-11-25 16:52:53 -0500 Replace all fds on non-unix-specific APIs with evutil_socket_t, which is int on unix and intptr_t on win32. svn:r552
Nick Mathewson 6773a597 2007-11-25T21:32:26 r14953@tombo: nickm | 2007-11-25 15:56:40 -0500 Replace evbuffer_readline with a more powerful evbuffer_readln that can handle more EOL styles, and that can give useful results when there are NUL characters inside the returned values. Includes regression tests. svn:r550
Nick Mathewson 7eb250e9 2007-11-25T17:14:19 r14939@tombo: nickm | 2007-11-25 11:59:26 -0500 New function event_set_mem_functions to replace internal calls to malloc, free, etc with a user-supplied functions. svn:r541
Nick Mathewson 4e1ec3e0 2007-11-07T21:01:26 Make all the C files in the libraries compile under MSVC 2005 Express. There are still a few warnings, and probably some subtle issues, but it's better than nothing. svn:r499
Nick Mathewson e72661d2 2007-11-07T07:33:31 r16509@catbus: nickm | 2007-11-07 02:08:32 -0500 Stop using C++ style comments. svn:r497
Nick Mathewson db43c1e1 2007-09-20T19:36:03 On win32, sockets apparently can't be used with ReadFile and WriteFile: You need send() and recv() instead. Also, you need to use ioctlsocket() with sockets, not ioctl. [Fixes evbuffer regression tests.] svn:r448
Niels Provos 41c69fc3 2007-08-19T17:26:02 fix typo in comments svn:r399
Niels Provos f0ff792a 2007-06-30T18:58:34 fixes from Joerg Sonnenberger: http.c is a violation of the ctype(3) interface and an unused function. test/regress_http.c are incorrect format strings. test/regress.c uses raise(3) from signal.h. evdns.c: evdns_error_strings is unused. The GET* macros can eat the semicolon from the expression. pos is passed in as off_t, so just pass that down. When assigning negativ values to unsigned variables, an explicit cast is considered good style. svn:r367
Niels Provos 0c280824 2007-05-23T05:20:59 support removing of http callbacks and removing of registered RPCs svn:r355
Niels Provos 4408a5f8 2007-04-19T03:13:12 fix evbuffer_find off by one; found by Ken Cox; regression test by him and fix by me svn:r353
Niels Provos b5d2f9a2 2007-03-01T06:25:18 rolling back r339: evconfig.h does not work svn:r341
Niels Provos 127c260b 2007-02-28T04:02:29 make evconfig.h available as installed header file; not really ideal but good enough for me; from Nick Mathewson svn:r339
Niels Provos 58f42c79 2007-02-14T16:59:47 fix handling of chunked requests svn:r328
Niels Provos 22e53c7a 2007-01-27T04:10:08 make it work on freebsd; from phil oleson svn:r314
Niels Provos de4e25f1 2007-01-06T02:25:50 evbuffer_find fix from Dug Song svn:r308
Niels Provos 79d2ca8c 2006-11-10T02:16:16 fix a potential problem in multiple handling of va_list; use va_copy instead; from Alejo. svn:r251
Niels Provos 9f7d28bb 2006-09-27T03:07:38 make it compile with mingw; from Nick svn:r235
Niels Provos 896bf3a2 2006-02-13T02:22:48 many changes for fixing a small bug: post requests would not send the post data. I took the opportunity to reorganize a bit. svn:r201
Niels Provos 7b78c828 2006-02-13T01:51:58 limit the amount of data bufferevents are going to consume to something reasonable; in some circumstances it could happen that libevent happily allocated 100MB in read buffers without telling the user; found by christopher maxwell - parts of these changes are from his patch. svn:r200