--- libsoap-1.1.0.orig/nanohttp/nanohttp-ssl.c
+++ libsoap-1.1.0/nanohttp/nanohttp-ssl.c
@@ -75,6 +75,7 @@
 #include "nanohttp-common.h"
 #include "nanohttp-socket.h"
 #include "nanohttp-ssl.h"
+#include "nanohttp-server.h"
 
 #ifdef HAVE_SSL
 
@@ -546,6 +547,19 @@
 hssl_write(hsocket_t * sock, const char *buf, size_t len, size_t * sent)
 {
   int count;
+  fd_set fds;
+  struct timeval timeout;
+  int ret;
+
+  FD_ZERO(&fds);
+  FD_SET(sock->sock, &fds);
+  timeout.tv_sec = httpd_get_timeout();
+  timeout.tv_usec = 0;
+  ret = select(sock->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 +600,19 @@
 hssl_write(hsocket_t * sock, const char *buf, size_t len, size_t * sent)
 {
   int count;
+  fd_set fds;
+  struct timeval timeout;
+  int ret;
+
+  FD_ZERO(&fds);
+  FD_SET(sock->sock, &fds);
+  timeout.tv_sec = httpd_get_timeout();
+  timeout.tv_usec = 0;
+  ret = select(sock->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)",
