Index: /trunk/ntripserver/ntripserver.c
===================================================================
--- /trunk/ntripserver/ntripserver.c	(revision 8787)
+++ /trunk/ntripserver/ntripserver.c	(revision 8788)
@@ -1587,46 +1587,25 @@
     else if((nBufferBytes)  && (outmode == HTTP))
     {
-      if(remainChunk)
-      {
-        int i = send(sock, buffer, (size_t)remainChunk, MSG_DONTWAIT);
-        if(i < 0)
-        {
-          if(errno != EAGAIN)
-          {
-            perror("WARNING: could not send data to Destination caster");
-            return;
-          }
-        }
-        else if(i)
-        {
-          memmove(buffer, buffer+i, (size_t)(nBufferBytes-i));
-          nBufferBytes -= i;
-          remainChunk -= i;
-        }
-      }
-      else
-      {
-        int i, nChunkBytes;
-        nChunkBytes = snprintf(szSendBuffer, sizeof(szSendBuffer),"%x\r\n",
+      if(!remainChunk)
+      {
+        int nChunkBytes = snprintf(szSendBuffer, sizeof(szSendBuffer),"%x\r\n",
         nBufferBytes);
         send(sock, szSendBuffer, nChunkBytes, 0);
-        if((i = send(sock, buffer, (size_t)nBufferBytes, MSG_DONTWAIT))
-        != nBufferBytes)
-        {
-          if(i < 0)
-          {
-            if(errno != EAGAIN)
-            {
-              perror("WARNING: could not send data to Destination caster");
-              return;
-            }
-          }
-          else if(i)
-          {
-            memmove(buffer, buffer+i, (size_t)(nBufferBytes-i));
-            nBufferBytes -= i;
-            remainChunk = nBufferBytes;
-          }
-        }
+        remainChunk = nBufferBytes;
+      }
+      int i = send(sock, buffer, (size_t)remainChunk, MSG_DONTWAIT);
+      if(i < 0)
+      {
+        if(errno != EAGAIN)
+        {
+          perror("WARNING: could not send data to Destination caster");
+          return;
+        }
+      }
+      else if(i)
+      {
+        memmove(buffer, buffer+i, (size_t)(nBufferBytes-i));
+        nBufferBytes -= i;
+        remainChunk -= i;
       }
       if(!remainChunk)
