test/regress_buffer.c


Log

Author Commit Date CI Message
Nick Mathewson 4f3732d7 2012-07-26T09:35:43 Fix various check-after-dereference issues in unit tests: found by coverity
Nick Mathewson e49e2891 2012-02-10T17:29:53 Update copyright notices to 2012
Zack Weinberg c986f232 2011-12-08T14:30:20 Fix behavior of evbuffer_peek(buf,-1,NULL,NULL,0) (Patch altered by nickm to not affect the behavior of evbuffer_peek(buf,-1,NULL,vec,n_vec).)
Greg Hazel 7eb52eb8 2011-11-02T15:19:05 improve test to remove at least one buffer from src
Greg Hazel 90bd620f 2011-11-01T13:44:40 unit test for remove_buffer bug
Nick Mathewson 3c824bd3 2011-10-24T13:18:09 Update copyright dates to 2011.
Nick Mathewson 0ba0af9c 2011-09-29T09:30:04 Prefer mmap to sendfile unless a DRAINS_TO_FD flag is set. Allows add_file to work with SSL. The sendfile() implementation for evbuffer_add_file is potentially more efficient, but it has a problem: you can only use it to send bytes over a socket using sendfile(). If you are writing bytes via SSL_send() or via a filter, or if you need to be able to inspect your buffer, it doesn't work. As an easy fix, this patch disables the sendfile-based implementation of evbuffer_add_file on an evbuffer unless the user sets a new EVBUFFER_FLAG_DRAINS_TO_FD flag on that evbuffer, indicating that the evbuffer will not be inspected, but only written out via evbuffer_write(), evbuffer_write_atmost(), or drained with stuff like evbuffer_drain() or evbuffer_add_buffer(). This flag is off by default, except for evbuffers used for output on bufferevent_socket. In the future, it could be interesting to make a best-effort file segment implementation that tries to send via sendfile, but mmaps on demand. That's too much complexity for a stable release series, though.
Nick Mathewson 4461f1a0 2011-06-06T15:11:28 Fix incorrect results from evbuffer_search_eol(EOL_LF) Our evbuffer_strchr() function [which was only used for search_eol(EOL_LF) could give incorrect results if it found its answer in the first chunk but didn't start searching from the front of the chunk. Also, this patch adds unit tests for evbuffer_search_eol, particularly in those cases that evbuffer_readln() tests didn't exercise.
Sebastian Hahn 93a1abb3 2011-04-11T18:26:48 Check return value of evbuffer_add_cb in tests Caught by clang's static analyzer
Christopher Davis 34b84b97 2010-11-03T14:38:45 Fix more wn64 warnings.
Nick Mathewson 7484df61 2010-11-01T13:43:43 Fix even more win64 warnings
Nick Mathewson e5c214a4 2010-10-14T13:16:41 Fix -Wsigned-compare warnings in test/*
Nick Mathewson 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.
Nick Mathewson 9b602096 2010-08-06T13:03:17 Use AF_INET socketpair to test sendfile on Solaris
Nick Mathewson bda21e7f 2010-05-17T11:58:07 Avoid close of uninitialized socket in evbuffer unit test Attempts to fix a crash bug found by Brodie Thiesfield.
Nick Mathewson 88a543fc 2010-05-08T19:09:09 Make unit test for add_file able to tell "error" from "done" Importantly, we don't actually want to call evbuffer_write() when the buffer is empty. This makes it an error to ever get a -1 return value from evbuffer_add_file(), which makes it safe for us to test the return value.
Nick Mathewson 05de45d6 2010-05-08T16:47:07 add more (currently skipped) add_file tests on win32
Nick Mathewson dcdae6b7 2010-05-08T16:34:18 Make evbuffer_add_file() work on windows Right now only the add_file() mode is supported, when it would be nicer to have mmap support. Perhaps for Libevent 2.1.x.
Nick Mathewson b4f12a17 2010-05-08T14:49:59 Implement regress_make_tempfile on win32 to test evbuffer_add_file (Conclusion: evbuffer_add_file is broken on win32, since it uses recv on a file.)
Sebastian Sjöberg 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)
Nick Mathewson 1234b95a 2010-04-09T17:19:39 Test another case of evbuffer_prepend
Nick Mathewson 8c83e995 2010-04-09T16:40:53 Add more unit tests for evbuffer_expand
Nick Mathewson 06a4443a 2010-04-09T15:28:26 Unit-test every evbuffer_add_file() implementation. Previously, we'd only test the default one, even if the others were still compiled in.
Nick Mathewson d5ebcf37 2010-03-30T16:47:37 Rewrite evbuffer_expand and its users The previous evbuffer_expand was not only incorrect; it was inefficient too. On all questions of time vs memory tradeoffs, it chose to burn time in order to avoid wasting memory. The new code tries to be a little more balanced: it only resizes an existing chain when doing so doesn't require too much copying, and when failing to do so would waste a lot of the chain's space. This patch also rewrites evbuffer_chain_insert to work properly with last_with_datap, and adds a few convenience functions to buffer.c.
Nick Mathewson b7442f8e 2010-03-26T23:18:40 Replace last_with_data with a slightly smarter version To implement evbuffer_expand() properly, you need to be able to replace the last chunk that has data, which means that we need to keep track of the the next pointer pointing to the last_with_data chunk, not the last_with_data chunk itself.
Nick Mathewson 17da042d 2010-03-11T15:39:44 Add some glass-box tests for the last_with_data code.
Nick Mathewson 6f47bd12 2010-03-10T23:28:51 Remove previous_to_last from evbuffer
Nick Mathewson c8ac57f1 2010-03-10T23:24:14 Use last_with_data in place of previous_to_last This actually makes some of the code a lot simpler. The only ones that actually used previous_to_last for anything were reserving and committing space.
Nick Mathewson 2a6d2a1e 2010-03-10T22:16:14 Revise evbuffer to add last_with_data This is the first patch in a series to replace previous_to_last with last_with_data. Currently, we can only use two partially empty chains at the end of an evbuffer, so if we have one with 511 bytes free, and another with 512 bytes free, and we try to do a 1024 byte read, we can't just stick another chain on the end: we need to reallocate the last one. That's stupid and inefficient. Instead, this patch adds a last_with_data pointer to eventually replace previous_to_last. Instead of pointing to the penultimated chain (if any) as previous_to_last does, last_with_data points to the last chain that has any data in it, if any. If all chains are empty, last_with_data points to the first chain. If there are no chains, last_with_data is NULL. The next step is to start using last_with_data everywhere that we currently use previous_to_last. When that's done, we can remove previous_to_last and the code that maintains it.
Nick Mathewson 17efc1cd 2010-03-04T01:25:51 Update all our copyright notices to say "2010"
Nick Mathewson e5bbd40a 2010-02-18T17:41:15 Clean up formatting: use tabs, not 8-spaces, to indent.
Nick Mathewson 9bf124bf 2009-11-18T21:16:47 Build correctly with mm replacement turned off. svn:r1547
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 ed0e91e0 2009-10-27T04:03:50 New test flag to suppress logging for one test. svn:r1466
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 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 6dc488bd 2009-07-31T17:34:18 Improved coverage for evbuffer_readln() svn:r1402
Nick Mathewson 043515bc 2009-07-14T18:50:06 Stop using C++ style comments. svn:r1343
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 a8f6d961 2009-04-17T06:56:09 Actually stop using EVBUFFER_LENGTH/DATA, and move them to buffer_compat.h svn:r1183
Nick Mathewson 4e8cdc6f 2009-04-13T18:23:02 Fix two windows compilation bugs. svn:r1171
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 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
Niels Provos 79b7799b 2009-02-13T01:42:59 a simple test for evbuffer_add_file svn:r1122
Nick Mathewson e7fd1034 2009-02-10T19:39:03 Test some formerly untested prepend cases of evbuffer. Now evbuffer coverage is over 80 percent. svn:r1108
Nick Mathewson 9e3e7b36 2009-02-10T19:38:54 More unit tests for evbuffer_add_reference to make sure that certain interleaved data patterns work; that free invokes callback; that callbacks are not invoked too early or later; etc. svn:r1107
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
Nick Mathewson e3e11531 2009-02-01T01:07:42 Unit tests for evbuffer callback manipulation svn:r1090
Nick Mathewson ca37fef9 2009-02-01T01:07:22 Change evbuffer callbacks to use tinytest natively and never assert. svn:r1088
Nick Mathewson a30c9eb1 2009-02-01T01:07:12 Move evbuffer tests into their own file. svn:r1087