From d45b4bc26f330d2ce29e4a06ffdae74d82e8b43b Mon Sep 17 00:00:00 2001 From: snowdrop Date: Sat, 18 Feb 2006 20:14:35 +0000 Subject: added basic authentication and SOAP-Header capabilities for request objects Thanks to Heiko Ronsdorf --- nanohttp/nanohttp-common.c | 84 ++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 40 deletions(-) (limited to 'nanohttp/nanohttp-common.c') diff --git a/nanohttp/nanohttp-common.c b/nanohttp/nanohttp-common.c index d7b1f27..1f2040d 100644 --- a/nanohttp/nanohttp-common.c +++ b/nanohttp/nanohttp-common.c @@ -1,5 +1,5 @@ /****************************************************************** -* $Id: nanohttp-common.c,v 1.26 2006/02/09 13:43:49 mrcsys Exp $ +* $Id: nanohttp-common.c,v 1.27 2006/02/18 20:14:36 snowdrop Exp $ * * CSOAP Project: A http client/server library in C * Copyright (C) 2003 Ferhat Ayaz @@ -21,17 +21,31 @@ * * Email: ayaz@jprogrammer.net ******************************************************************/ +#ifdef HAVE_CONFIG_H +#include +#endif -#include - - +#ifdef HAVE_STDIO_H #include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_STDARG_H #include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_CTYPE_H #include +#endif -#ifndef WIN32 +#ifdef HAVE_PTHREAD_H #include #endif @@ -39,19 +53,35 @@ #include #endif +#include #define MAX_OPTION_SIZE 50 #define MAX_OPTION_VALUE_SIZE 150 static char _hoption_table[MAX_OPTION_SIZE][MAX_OPTION_VALUE_SIZE]; -#ifdef HAVE_SSL -/*extern char *SSLCert; -extern char *SSLPass; -extern char *SSLCA; -extern int SSLCertLess; -*/ -#endif +static 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 0; + + for (i = 0; i < l1; i++) + if (toupper(s1[i]) != toupper(s2[i])) + return 0; + + return 1; +} /* option stuff */ void @@ -64,6 +94,8 @@ hoption_set(int opt, const char *value) } strncpy(_hoption_table[opt], value, MAX_OPTION_VALUE_SIZE); + + return; } @@ -173,7 +205,6 @@ typedef struct _herror_impl_t char func[100]; } herror_impl_t; - herror_t herror_new(const char *func, int errcode, const char *format, ...) { @@ -363,32 +394,6 @@ 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 0; - - 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) @@ -607,7 +612,6 @@ hurl_dump(const hurl_t * url) log_verbose2(" CONTEXT : %s", url->context); } - herror_t hurl_parse(hurl_t * url, const char *urlstr) { -- cgit v1.1-32-gdbae