summaryrefslogtreecommitdiffstats
path: root/nanohttp/nanohttp-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'nanohttp/nanohttp-common.c')
-rw-r--r--nanohttp/nanohttp-common.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/nanohttp/nanohttp-common.c b/nanohttp/nanohttp-common.c
index 4c196a9..d7396d6 100644
--- a/nanohttp/nanohttp-common.c
+++ b/nanohttp/nanohttp-common.c
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: nanohttp-common.c,v 1.4 2003/12/18 11:14:37 snowdrop Exp $
+ * $Id: nanohttp-common.c,v 1.5 2003/12/18 12:23:44 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -106,6 +106,29 @@ void log_error(const char* FUNC, const char *format, ...)
}
+/* -----------------------------------------
+ FUNCTION: strcmpigcase
+ ------------------------------------------ */
+int strcmpigcase(const char *s1, const char *s2)
+{
+ int l1, l2, i;
+
+ if (s1 == NULL && s2 == NULL) return 1;
+ if (s1 == NULL || s2 == NULL) return 0;
+
+ l1 = strlen(s1);
+ l2 = strlen(s2);
+
+ if (l1 != l2) return;
+
+ for (i=0;i<l1;i++)
+ if (toupper(s1[i]) != toupper(s2[i]))
+ return 0;
+
+ return 1;
+}
+
+
hpair_t *hpairnode_new(const char* key, const char* value, hpair_t *next)
{
hpair_t *pair;
@@ -232,6 +255,25 @@ void hpairnode_free(hpair_t *pair)
}
+char *hpairnode_get_ignore_case(hpair_t *pair, const char* key)
+{
+ if (key == NULL) {
+ log_error1("key is NULL");
+ return NULL;
+ }
+
+ while (pair != NULL) {
+ if (pair->key != NULL) {
+ if (strcmpigcase(pair->key, key)) {
+ return pair->value;
+ }
+ }
+ pair = pair->next;
+ }
+
+ return NULL;
+}
+
char *hpairnode_get(hpair_t *pair, const char* key)
{
if (key == NULL) {