Package: libnanohttp1
Version: 1.1.0-15
Severity: normal

The current code in libnanohttp1 doesn't handle the case where more data is
written to the socket than can be sent immediately.  The below patch is a first
(untested) draft at fixing this.

diff -ru libcsoap-1.1.0.bak/nanohttp/nanohttp-ssl.c 
libcsoap-1.1.0/nanohttp/nanohttp-ssl.c
--- libcsoap-1.1.0.bak/nanohttp/nanohttp-ssl.c  2006-07-10 02:24:19.000000000 
+1000
+++ libcsoap-1.1.0/nanohttp/nanohttp-ssl.c      2009-04-20 15:27:09.000000000 
+1000
@@ -546,6 +546,18 @@
 hssl_write(hsocket_t * sock, const char *buf, size_t len, size_t * sent)
 {
   int count;
+  fd_set fds;
+  struct timeval timeout;
+
+  FD_ZERO(&fds);
+  FD_SET(dsock->sock, &fds);
+  timeout.tv_sec = httpd_get_timeout();
+  timeout.tv_usec = 0;
+  ret = select(dsock->sock + 1, NULL, &fds, NULL, &timeout);
+  if(ret == 0)
+    return herror_new("hssl_write", HSOCKET_ERROR_SEND, "Socket timeout");
+  if(ret == -1)
+    return herror_new("hssl_write", HSOCKET_ERROR_SEND, "select error");
 
 /*  log_verbose4("sock->sock=%d, sock->ssl=%p, len=%li", sock->sock, 
sock->ssl, len); */
 
@@ -586,6 +598,18 @@
 hssl_write(hsocket_t * sock, const char *buf, size_t len, size_t * sent)
 {
   int count;
+  fd_set fds;
+  struct timeval timeout;
+
+  FD_ZERO(&fds);
+  FD_SET(dsock->sock, &fds);
+  timeout.tv_sec = httpd_get_timeout();
+  timeout.tv_usec = 0;
+  ret = select(dsock->sock + 1, NULL, &fds, NULL, &timeout);
+  if(ret == 0)
+    return herror_new("hssl_write", HSOCKET_ERROR_SEND, "Socket timeout");
+  if(ret == -1)
+    return herror_new("hssl_write", HSOCKET_ERROR_SEND, "select error");
 
   if ((count = send(sock->sock, buf, len, 0)) == -1)
     return herror_new("hssl_write", HSOCKET_ERROR_SEND, "send failed (%s)",

-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=ANSI_X3.4-1968) 
(ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/bash

Versions of packages libnanohttp1 depends on:
ii  libc6                   2.7-18           GNU C Library: Shared libraries
ii  libssl0.9.8             0.9.8g-15+lenny1 SSL shared libraries
ii  libxml2                 2.6.32.dfsg-5    GNOME XML library

libnanohttp1 recommends no packages.

libnanohttp1 suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to