Apparently, in our configure.in check for a working kqueue, we were
leaving some fields unset that seemed to irritate 64-bit kqueue a lot.
Found by Christopher Layne
Everybody but Linux documents this as taking an int, and Linux is
very tolerant of getting an int instead. If it weren't, everybody
doing fcntl(fd,F_SETFL,O_NONBLOCK) would break, since the glibc
headers define O_NONBLOCK as an int literal.
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).
Unlike in 2.0, we can't use the PTHREAD_CFLAGS variable to see what
flags to use, since we aren't using pthreads in 1.4. Instead, we just
check the host type explicitly, like acx_pthreads does.
Previously, when a signation() or signal() call failed, we would free
the element we added to sh_old, but not actually clear the pointer.
This would leave a dangling pointer in sh_old that could cause a
crash later.
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.
This patch fixes calls to the win32 api to explicitly call the char* versions
of the functions. This fixes build failures when libevent is built with the
UNICODE define.
Previously, we'd issue an HTTP/1.1 400 Bad Request" response on every
connection close, event if sever sent response already.
This patch changes the behavior, so we only issue the response on
close when the connection state is not DISCONNECTED, and so we set
the state to DISCONNECTED when the connection closes.
Includes a regression test; fixes sourceforge bug 2909909.
It turns out that kqueue_dealloc wasn't calling evsig_dealloc()
(because it doesn't use the main signal handler logic) so the sh_old
array was leaking.
This patch also introduces a fix in evsig_dealloc() where we set
the sh_old array to NULL when we free it, so that main/fork can pass.
William's original commit message:
Valgrind complains on startup because kq_init passes to kevent only
a partially initialized structure. The code doesn't expect kevent
to look at .fflags, .udata, or .data, I suppose, because it merely
tickles the kernel looking for an error response. But perhaps
that's unwarranted chuminess (notwithstanding that it's checking
for an OS X bug), and needless noise nonetheless.
This is necessary because it is not actually possible to use
evbuffer_readline() safely: it will treat "A\r\n" as 'A' EOL if it
reads it all at once, and as 'A' EOL EOL if there is a delay between
reading the \r and the \n.
Nicholas Marriott's comments on this patch:
Gilles is too busy so I've had a go at this, please see the diff
below. Rather than try to backport directly from 2.0 where the
evbuffer code is quite different, I've backported the _readln
function from when it was initially added in buffer.c r550. I can't
see any relevant bug fixes after this point so the function is
pretty much just copied in directly from that revision.
We were saying calloc(N,N*sizeof(struct event_list*)) when we should have
been saying calloc(N,sizeof(struct event_list*)). This wasted N*(N-1) words
of memory, where N was the number of priorities. This wouldn't be a big deal
for any sane number of priorities, but it's a bug nonetheless.
svn:r1526
On some systems (notably HPUX), there is already a
/usr/include/sys/_time.h, which our sys/_time.h shadows. Found and
diagnosed by Kathryn Hogg.
This is a quick fix for 1.4 only; for 2.0, I want to eliminate
compat/sys/_time.h entirely, and have util-internal subsume it.
svn:r1493