]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- httpHeaderGet() is no longer public. This allows us to change internal
authorrousskov <>
Wed, 4 Mar 1998 12:39:27 +0000 (12:39 +0000)
committerrousskov <>
Wed, 4 Mar 1998 12:39:27 +0000 (12:39 +0000)
  representation of header fields without danger of somebody still using the
  wrong type.
- added missing httpHeaderGetInt().

src/HttpHeader.cc
src/HttpReply.cc
src/protos.h

index 72fa5c1b12b6b0b155b44998e9076c91615fd51b..b9468f997e798d6349c24a53ec7653d79dc870bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: HttpHeader.cc,v 1.12 1998/03/03 22:17:50 rousskov Exp $
+ * $Id: HttpHeader.cc,v 1.13 1998/03/04 05:39:28 rousskov Exp $
  *
  * DEBUG: section 55    HTTP Header
  * AUTHOR: Alex Rousskov
@@ -252,6 +252,7 @@ static HttpHeaderEntry *httpHeaderGetEntry(const HttpHeader * hdr, HttpHeaderPos
 static void httpHeaderDelAt(HttpHeader * hdr, HttpHeaderPos pos);
 static void httpHeaderAddParsedEntry(HttpHeader * hdr, HttpHeaderEntry * e);
 static void httpHeaderAddNewEntry(HttpHeader * hdr, const HttpHeaderEntry * e);
+static field_store httpHeaderGet(const HttpHeader * hdr, http_hdr_type id);
 static void httpHeaderSet(HttpHeader * hdr, http_hdr_type id, const field_store value);
 static void httpHeaderSyncMasks(HttpHeader * hdr, const HttpHeaderEntry * e, int add);
 static int httpHeaderIdByName(const char *name, int name_len, const field_attrs_t * attrs, int end, int mask);
@@ -300,6 +301,10 @@ static void freeShortString(char *str);
 static int strListGetItem(const char *str, char del, const char **item, int *ilen, const char **pos);
 static const char *getStringPrefix(const char *str);
 
+
+/* delete this when everybody remembers that ':' is not a part of a name */
+#define conversion_period_name_check(name) assert(!strchr((name), ':'))
+
 /* handy to determine the #elements in a static array */
 #define countof(arr) (sizeof(arr)/sizeof(*arr))
 
@@ -840,7 +845,7 @@ httpHeaderAddExt(HttpHeader * hdr, const char *name, const char *value)
 }
 
 /* get a value of a field (not lvalue though) */
-field_store
+static field_store
 httpHeaderGet(const HttpHeader * hdr, http_hdr_type id)
 {
     HttpHeaderEntry *e;
@@ -854,11 +859,19 @@ httpHeaderGet(const HttpHeader * hdr, http_hdr_type id)
        return httpHeaderFieldBadValue(Headers[id].type);
 }
 
+int
+httpHeaderGetInt(const HttpHeader * hdr, http_hdr_type id)
+{
+    assert_eid(id);
+    assert(Headers[id].type == ftInt);    /* must be of an apropriate type */
+    return httpHeaderGet(hdr, id).v_int;
+}
+
 const char *
 httpHeaderGetStr(const HttpHeader * hdr, http_hdr_type id)
 {
     assert_eid(id);
-    assert(Headers[id].type == ftPChar);       /* must be of an apropriate type */
+    assert(Headers[id].type == ftPChar);  /* must be of an apropriate type */
     return httpHeaderGet(hdr, id).v_pchar;
 }
 
index b1ee9c232ff31193b2469753e6516926438dce64..6efd533a1bc660045e96d7539cb2fa51d21f8ca1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpReply.cc,v 1.8 1998/03/03 22:17:50 rousskov Exp $
+ * $Id: HttpReply.cc,v 1.9 1998/03/04 05:39:27 rousskov Exp $
  *
  * DEBUG: section 58    HTTP Reply (Response)
  * AUTHOR: Alex Rousskov
@@ -280,7 +280,7 @@ int
 httpReplyContentLen(const HttpReply * rep)
 {
     assert(rep);
-    return httpHeaderGet(&rep->hdr, HDR_CONTENT_LENGTH).v_int;
+    return httpHeaderGetInt(&rep->hdr, HDR_CONTENT_LENGTH);
 }
 
 /* should we return "" or NULL if no content-type? Return NULL for now @?@ */
index 2132e8e0e165d6a19fbb497d132f3de8e9151c47..d218e065448ca37961bea5d79729a6c031a1d856 100644 (file)
@@ -278,10 +278,10 @@ extern void httpHeaderSetTime(HttpHeader * hdr, http_hdr_type type, time_t time)
 extern void httpHeaderSetStr(HttpHeader * hdr, http_hdr_type type, const char *str);
 extern void httpHeaderSetAuth(HttpHeader * hdr, const char *authScheme, const char *realm);
 extern void httpHeaderAddExt(HttpHeader * hdr, const char *name, const char *value);
-extern const char *httpHeaderGetStr(const HttpHeader * hdr, http_hdr_type id);
+extern int httpHeaderGetInt(const HttpHeader * hdr, http_hdr_type id);
 extern time_t httpHeaderGetTime(const HttpHeader * hdr, http_hdr_type id);
+extern const char *httpHeaderGetStr(const HttpHeader * hdr, http_hdr_type id);
 extern HttpScc *httpHeaderGetScc(const HttpHeader * hdr);
-extern field_store httpHeaderGet(const HttpHeader * hdr, http_hdr_type id);
 int httpHeaderDelFields(HttpHeader * hdr, const char *name);
 /* store report about current header usage and other stats */
 extern void httpHeaderStoreReport(StoreEntry * e);