Author: adrian.chadd
Date: Sun Feb  1 15:14:02 2009
New Revision: 13768

Modified:
    branches/LUSCA_HEAD/libhttp/HttpHeaderPut.c
    branches/LUSCA_HEAD/libhttp/HttpHeaderPut.h
    branches/LUSCA_HEAD/src/client_side.c
    branches/LUSCA_HEAD/src/htcp.c

Log:
Convert strBuf() -> strBuf2(); migrate httpHeaderPutExt() to take a length
parameter.

(It should take a String, but that'll be later.)



Modified: branches/LUSCA_HEAD/libhttp/HttpHeaderPut.c
==============================================================================
--- branches/LUSCA_HEAD/libhttp/HttpHeaderPut.c (original)
+++ branches/LUSCA_HEAD/libhttp/HttpHeaderPut.c Sun Feb  1 15:14:02 2009
@@ -192,10 +192,10 @@

  /* add extension header (these fields are not parsed/analyzed/joined,  
etc.) */
  void
-httpHeaderPutExt(HttpHeader * hdr, const char *name, const char *value)
+httpHeaderPutExt(HttpHeader * hdr, const char *name, const char *value,  
int value_len)
  {
      assert(name && value);
-    debug(55, 8) ("%p adds ext entry '%s: %s'\n", hdr, name, value);
-    httpHeaderAddEntryStr(hdr, HDR_OTHER, name, value);
+    debug(55, 8) ("%p adds ext entry '%s: %s'\n", hdr, name, value_len,  
value);
+    httpHeaderAddEntryStr2(hdr, HDR_OTHER, name, -1, value, value_len);
  }


Modified: branches/LUSCA_HEAD/libhttp/HttpHeaderPut.h
==============================================================================
--- branches/LUSCA_HEAD/libhttp/HttpHeaderPut.h (original)
+++ branches/LUSCA_HEAD/libhttp/HttpHeaderPut.h Sun Feb  1 15:14:02 2009
@@ -15,6 +15,6 @@
  extern void httpHeaderPutTime(HttpHeader * hdr, http_hdr_type id, time_t  
htime);
  extern void httpHeaderInsertTime(HttpHeader * hdr, int pos, http_hdr_type  
id, time_t htime);
  extern void httpHeaderPutAuth(HttpHeader * hdr, const char *auth_scheme,  
const char *realm);
-extern void httpHeaderPutExt(HttpHeader * hdr, const char *name, const  
char *value);
+extern void httpHeaderPutExt(HttpHeader * hdr, const char *name, const  
char *value, int value_len);

  #endif

Modified: branches/LUSCA_HEAD/src/client_side.c
==============================================================================
--- branches/LUSCA_HEAD/src/client_side.c       (original)
+++ branches/LUSCA_HEAD/src/client_side.c       Sun Feb  1 15:14:02 2009
@@ -1836,18 +1836,18 @@
            } else if (http->conn->port->act_as_origin) {
                HttpHeaderEntry *h = httpHeaderFindEntry(hdr, HDR_DATE);
                if (h)
-                   httpHeaderPutExt(hdr, "X-Origin-Date", strBuf(h->value));
+                   httpHeaderPutExt(hdr, "X-Origin-Date", strBuf2(h->value),  
strLen2(h->value));
                httpHeaderDelById(hdr, HDR_DATE);
                httpHeaderInsertTime(hdr, 0, HDR_DATE, squid_curtime);
                h = httpHeaderFindEntry(hdr, HDR_EXPIRES);
                if (h && http->entry->expires >= 0) {
-                   httpHeaderPutExt(hdr, "X-Origin-Expires", strBuf(h->value));
+                   httpHeaderPutExt(hdr, "X-Origin-Expires", 
strBuf2(h->value),  
strLen2(h->value));
                    httpHeaderDelById(hdr, HDR_EXPIRES);
                    httpHeaderInsertTime(hdr, 1, HDR_EXPIRES, squid_curtime +  
http->entry->expires - http->entry->timestamp);
                } {
                    char age[64];
                    snprintf(age, sizeof(age), "%ld", (long int) squid_curtime 
-  
http->entry->timestamp);
-                   httpHeaderPutExt(hdr, "X-Cache-Age", age);
+                   httpHeaderPutExt(hdr, "X-Cache-Age", age, -1);
                }
            } else if (http->entry->timestamp < squid_curtime) {
                httpHeaderPutInt(hdr, HDR_AGE,

Modified: branches/LUSCA_HEAD/src/htcp.c
==============================================================================
--- branches/LUSCA_HEAD/src/htcp.c      (original)
+++ branches/LUSCA_HEAD/src/htcp.c      Sun Feb  1 15:14:02 2009
@@ -708,7 +708,7 @@
            if (rtt || hops) {
                snprintf(cto_buf, 128, "%s %d %f %d",
                    host, samp, 0.001 * rtt, hops);
-               httpHeaderPutExt(&hdr, "Cache-to-Origin", cto_buf);
+               httpHeaderPutExt(&hdr, "Cache-to-Origin", cto_buf, -1);
            }
        }
        httpHeaderPackInto(&hdr, &p);

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to