[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squid-cvs
Subject:    s27_adri squid/src http.c,1.63.2.3.4.25,1.63.2.3.4.26
From:       Adrian Chadd <adri () users ! sourceforge ! net>
Date:       2007-12-29 9:08:26
Message-ID: 20071229090831.27715.qmail () squid-cache ! org
[Download RAW message or body]

Update of cvs.devel.squid-cache.org:/cvsroot/squid/squid/src

Modified Files:
      Tag: s27_adri
	http.c 
Log Message:
change httpAppendBody() to take (buf, len), offset

like the changes to the header parser block, this will make it easier to
migrate the code to use buf_t soon.



Index: http.c
===================================================================
RCS file: /cvsroot/squid/squid/src/http.c,v
retrieving revision 1.63.2.3.4.25
retrieving revision 1.63.2.3.4.26
diff -C2 -d -r1.63.2.3.4.25 -r1.63.2.3.4.26
*** http.c	28 Dec 2007 06:46:54 -0000	1.63.2.3.4.25
--- http.c	29 Dec 2007 09:08:23 -0000	1.63.2.3.4.26
***************
*** 644,649 ****
  }
  
  static void
! httpAppendBody(HttpStateData * httpState, const char *buf, ssize_t len, int \
buffer_filled)  {
      StoreEntry *entry = httpState->entry;
--- 644,660 ----
  }
  
+ /*
+  * Append some body data. sbuf/slen are the buffer and buffer length;
+  * offset is the offset in the buffer where the body starts.
+  * So the amount of data is actually slen - offset.
+  * 
+  * buffer_filled is an indication whether the previous read() filled the
+  * read buffer or not. The original code set the read buffer to the
+  * system read buffer size so I think it assumed if the buffer was filled
+  * then there may be more data available; if the buffer wasn't filled
+  * then there wasn't any more data available..
+  */
  static void
! httpAppendBody(HttpStateData * httpState, const char *sbuf, ssize_t slen, int \
offset, int buffer_filled)  {
      StoreEntry *entry = httpState->entry;
***************
*** 655,658 ****
--- 666,672 ----
      int complete = httpState->eof;
      int keep_alive = !httpState->eof;
+     const char *buf = sbuf + offset;
+     ssize_t len = slen - offset;
+     assert(len >= 0);
      storeBuffer(entry);
      while (len > 0) {
***************
*** 759,763 ****
      /* Is it a incomplete reply? */
      if (httpState->chunk_size > 0) {
! 	debug(11, 2) ("Short response from '%s' on port %d. Expecting %" PRINTF_OFF_T " \
octets more\n", storeUrl(entry), comm_local_port(fd), httpState->chunk_size);  \
comm_close(fd);  return;
--- 773,777 ----
      /* Is it a incomplete reply? */
      if (httpState->chunk_size > 0) {
! 	debug(11, 1) ("Short response from '%s' on port %d. Expecting %" PRINTF_OFF_T " \
octets more\n", storeUrl(entry), comm_local_port(fd), httpState->chunk_size);  \
comm_close(fd);  return;
***************
*** 955,959 ****
  	    httpState->fwd->flags.dont_retry = 1;
  	} else {
! 	    httpAppendBody(httpState, NULL, 0, -1);	/* EOF */
  	    return;
  	}
--- 969,973 ----
  	    httpState->fwd->flags.dont_retry = 1;
  	} else {
! 	    httpAppendBody(httpState, NULL, 0, 0, -1);	/* EOF */
  	    return;
  	}
***************
*** 1018,1022 ****
          assert(buf_start - done < httpState->reply_hdr.size);
          cbdataLock(httpState);
! 	httpAppendBody(httpState, httpState->reply_hdr.buf + done + buf_start, \
                httpState->reply_hdr.size - done - buf_start, buffer_filled);
          if (cbdataValid(httpState) && (! memBufIsNull(&httpState->reply_hdr)))
              memBufReset(&httpState->reply_hdr);
--- 1032,1036 ----
          assert(buf_start - done < httpState->reply_hdr.size);
          cbdataLock(httpState);
! 	httpAppendBody(httpState, httpState->reply_hdr.buf, httpState->reply_hdr.size, \
                done + buf_start, buffer_filled);
          if (cbdataValid(httpState) && (! memBufIsNull(&httpState->reply_hdr)))
              memBufReset(&httpState->reply_hdr);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic