[xml] Patch for xmlNanoHTTPSend

Date view Thread view Subject view Author view

From: Tony Lam (Tony.Lam@eng.sun.com)
Date: Fri Oct 20 2000 - 13:39:58 EDT


Hi Daniel,

The following patch fixed the function for sending data in large
buffer. It keeps retrying until all data in the buffer are sent.

Thanks.

*** nanohttp-orig.c Mon Oct 16 08:36:03 2000
--- nanohttp.c Fri Oct 20 10:32:01 2000
***************
*** 403,412 ****
  
  static void
  xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt) {
! if (ctxt->state & XML_NANO_HTTP_WRITE)
! ctxt->last = send(ctxt->fd, ctxt->outptr, strlen(ctxt->outptr), 0);
  }
  
  /**
   * xmlNanoHTTPRecv:
   * @ctxt: an HTTP context
--- 403,421 ----
  
  static void
  xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt) {
! if (ctxt->state & XML_NANO_HTTP_WRITE) {
! int total_sent = 0;
! while (total_sent <strlen(ctxt->outptr)) {
! int nsent = send(ctxt->fd, ctxt->outptr+total_sent,
! strlen(ctxt->outptr)-total_sent, 0);
! if (nsent>0)
! total_sent += nsent;
          }
  
+ ctxt->last = total_sent;
+ }
+ }
+
  /**
   * xmlNanoHTTPRecv:
   * @ctxt: an HTTP context

-- 
/tonyl

---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Oct 20 2000 - 13:43:36 EDT