[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5732 - in libmicrohttpd: . src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5732 - in libmicrohttpd: . src/daemon |
Date: |
Sat, 17 Nov 2007 00:56:19 -0700 (MST) |
Author: grothoff
Date: 2007-11-17 00:56:19 -0700 (Sat, 17 Nov 2007)
New Revision: 5732
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/README
libmicrohttpd/src/daemon/connection.c
libmicrohttpd/src/daemon/daemon.c
Log:
sigpipe
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2007-11-17 07:48:00 UTC (rev 5731)
+++ libmicrohttpd/ChangeLog 2007-11-17 07:56:19 UTC (rev 5732)
@@ -1,3 +1,9 @@
+Sat Nov 17 00:55:24 MST 2007
+ Fixed off-by-one in error message string matching.
+ Added code to avoid generating SIGPIPE on platforms
+ where this is possible (everywhere else, the main
+ application should install a handler for SIGPIPE).
+
Thu Oct 11 11:02:06 MDT 2007
Releasing libmicrohttpd 0.1.1. - CG
Modified: libmicrohttpd/README
===================================================================
--- libmicrohttpd/README 2007-11-17 07:48:00 UTC (rev 5731)
+++ libmicrohttpd/README 2007-11-17 07:56:19 UTC (rev 5732)
@@ -27,6 +27,15 @@
resulting binary should be less than 25k (on x86).
+Portability
+===========
+
+The latest version of libmicrohttpd will try to avoid SIGPIPE on its
+sockets. This should work on OS X, Linux and recent BSD systems (at
+least). On other systems that may trigger a SIGPIPE on send/recv, the
+main application should install a signal handler to handle SIGPIPE.
+
+
Development Status
==================
@@ -67,3 +76,5 @@
==============
- manual (texinfo, man)
- tutorial
+
+
Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c 2007-11-17 07:48:00 UTC (rev
5731)
+++ libmicrohttpd/src/daemon/connection.c 2007-11-17 07:56:19 UTC (rev
5732)
@@ -32,6 +32,10 @@
#include "response.h"
#include "reason_phrase.h"
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
+
/**
* Message to transmit when http 1.1 request is received
*/
@@ -888,7 +892,8 @@
}
bytes_read = RECV (connection->socket_fd,
&connection->read_buffer[connection->readLoc],
- connection->read_buffer_size - connection->readLoc, 0);
+ connection->read_buffer_size - connection->readLoc,
+ MSG_NOSIGNAL);
if (bytes_read < 0)
{
if (errno == EINTR)
@@ -1056,7 +1061,8 @@
{
ret = SEND (connection->socket_fd,
&HTTP_100_CONTINUE[connection->continuePos],
- strlen (HTTP_100_CONTINUE) - connection->continuePos, 0);
+ strlen (HTTP_100_CONTINUE) - connection->continuePos,
+ MSG_NOSIGNAL);
if (ret < 0)
{
if (errno == EINTR)
@@ -1099,7 +1105,8 @@
}
ret = SEND (connection->socket_fd,
&connection->write_buffer[connection->writePos],
- connection->writeLoc - connection->writePos, 0);
+ connection->writeLoc - connection->writePos,
+ MSG_NOSIGNAL);
if (ret < 0)
{
if (errno == EINTR)
@@ -1148,7 +1155,8 @@
ret = SEND (connection->socket_fd,
&response->data[connection->messagePos - response->data_start],
response->data_size - (connection->messagePos -
- response->data_start), 0);
+ response->data_start),
+ MSG_NOSIGNAL);
if (response->crc != NULL)
pthread_mutex_unlock (&response->mutex);
if (ret < 0)
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2007-11-17 07:48:00 UTC (rev 5731)
+++ libmicrohttpd/src/daemon/daemon.c 2007-11-17 07:56:19 UTC (rev 5732)
@@ -254,6 +254,9 @@
struct sockaddr *addr = (struct sockaddr *) &addr6;
socklen_t addrlen;
int s;
+#if OSX
+ static int on=1;
+#endif
if (sizeof (struct sockaddr) > sizeof (struct sockaddr_in6))
@@ -296,6 +299,17 @@
CLOSE (s);
return MHD_YES;
}
+#if OSX
+#ifdef SOL_SOCKET
+#ifdef SO_NOSIGPIPE
+ setsockopt(s,
+ SOL_SOCKET,
+ SO_NOSIGPIPE,
+ &on,
+ sizeof(on));
+#endif
+#endif
+#endif
connection = malloc (sizeof (struct MHD_Connection));
if (connection == NULL)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5732 - in libmicrohttpd: . src/daemon,
gnunet <=