rem: if (soap_valid_socket(soap->socket) && !soap->keep_alive)
add: if (soap_valid_socket(soap->socket) && !soap->keep_alive && !(soap->omode & SOAP_IO_UDP))
context: soap_end_send(struct soap *soap){ #ifndef WITH_LEANER  if (soap->dime.list)  { /* SOAP body referenced attachments must appear first */    soap->dime.last->next = soap->dime.first;    soap->dime.first = soap->dime.list->next;    soap->dime.list->next = NULL;    soap->dime.last = soap->dime.list;  }  if (soap_putdime(soap) || soap_putmime(soap))    return soap->error;  soap->mime.list = NULL;  soap->mime.first = NULL;  soap->mime.last = NULL;  soap->dime.list = NULL;  soap->dime.first = NULL;  soap->dime.last = NULL;#endif  DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End send\n"));  if (soap->mode & SOAP_IO) /* need to flush the remaining data in buffer */  { if (soap_flush(soap))#ifdef WITH_ZLIB    { if (soap->mode & SOAP_ENC_ZLIB && soap->zlib_state == SOAP_ZLIB_DEFLATE)      { soap->zlib_state = SOAP_ZLIB_NONE;        deflateEnd(&soap->d_stream);      }      return soap->error;    }#else      return soap->error;#endif#ifdef WITH_ZLIB    if (soap->mode & SOAP_ENC_ZLIB)    { int r;      soap->d_stream.avail_in = 0;      do      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflating remainder\n"));        r = deflate(&soap->d_stream, Z_FINISH);        if (soap->d_stream.avail_out != SOAP_BUFLEN)        { if (soap_flush_raw(soap, soap->z_buf, SOAP_BUFLEN - soap->d_stream.avail_out))          { soap->zlib_state = SOAP_ZLIB_NONE;            deflateEnd(&soap->d_stream);            return soap->error;	  }          soap->d_stream.next_out = (Byte*)soap->z_buf;          soap->d_stream.avail_out = SOAP_BUFLEN;        }      } while (r == Z_OK);      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflated %lu->%lu bytes\n", soap->d_stream.total_in, soap->d_stream.total_out));      soap->z_ratio_out = (float)soap->d_stream.total_out / (float)soap->d_stream.total_in;      soap->mode &= ~SOAP_ENC_ZLIB;      soap->zlib_state = SOAP_ZLIB_NONE;      if (deflateEnd(&soap->d_stream) != Z_OK || r != Z_STREAM_END)      { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to end deflate: %s\n", soap->d_stream.msg?soap->d_stream.msg:""));        return soap->error = SOAP_ZLIB_ERROR;      }#ifdef WITH_GZIP      soap->z_buf[0] = soap->z_crc & 0xFF;      soap->z_buf[1] = (soap->z_crc >> 8) & 0xFF;      soap->z_buf[2] = (soap->z_crc >> 16) & 0xFF;      soap->z_buf[3] = (soap->z_crc >> 24) & 0xFF;      soap->z_buf[4] = soap->d_stream.total_in & 0xFF;      soap->z_buf[5] = (soap->d_stream.total_in >> 8) & 0xFF;      soap->z_buf[6] = (soap->d_stream.total_in >> 16) & 0xFF;      soap->z_buf[7] = (soap->d_stream.total_in >> 24) & 0xFF;      if (soap_flush_raw(soap, soap->z_buf, 8))        return soap->error;      DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip crc32=%lu\n", (unsigned long)soap->z_crc));#endif    }#endif    if ((soap->mode & SOAP_IO) == SOAP_IO_STORE)    { char *p;#ifndef WITH_NOHTTP      if (!(soap->mode & SOAP_ENC_XML))      { soap->mode--;        DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Sending buffered message of length %u\n", (unsigned int)soap->blist->size));        if (soap->status >= SOAP_POST)          soap->error = soap->fpost(soap, soap->endpoint, soap->host, soap->port, soap->path, soap->action, soap->blist->size);        else if (soap->status != SOAP_STOP)          soap->error = soap->fresponse(soap, soap->status, soap->blist->size);        if (soap->error || soap_flush(soap))          return soap->error;        soap->mode++;      }#endif      for (p = soap_first_block(soap); p; p = soap_next_block(soap))      { DBGMSG(SENT, p, soap_block_size(soap));        if ((soap->error = soap->fsend(soap, p, soap_block_size(soap))))        { soap_end_block(soap);          return soap->error;        }      }      soap_end_block(soap);    }#ifndef WITH_LEANER    else if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK)    { DBGMSG(SENT, "\r\n0\r\n\r\n", 7);      if ((soap->error = soap->fsend(soap, "\r\n0\r\n\r\n", 7)))        return soap->error;    }#endif  }#ifdef WITH_OPENSSL  if (!soap->ssl && soap_valid_socket(soap->socket) && !soap->keep_alive)    soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */#else  if (soap_valid_socket(soap->socket) && !soap->keep_alive)    soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */#endif  DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of send message ok\n"));  soap->part = SOAP_END;  soap->count = 0;  return SOAP_OK;}