diff --git a/httpp/httpp.c b/httpp/httpp.c index 1636627..6987b15 100644 --- a/httpp/httpp.c +++ b/httpp/httpp.c @@ -22,7 +22,7 @@ #include #include "httpp.h" -#ifdef _WIN32 +#if defined(_WIN32) && !defined(HAVE_STRCASECMP) #define strcasecmp stricmp #endif @@ -358,6 +358,7 @@ int httpp_parse(http_parser_t *parser, const char *http_data, unsigned long len) char *query; if((query = strchr(uri, '?')) != NULL) { httpp_setvar(parser, HTTPP_VAR_RAWURI, uri); + httpp_setvar(parser, HTTPP_VAR_QUERYARGS, query); *query = 0; query++; parse_query(parser, query); @@ -425,6 +426,17 @@ int httpp_parse(http_parser_t *parser, const char *http_data, unsigned long len) return 1; } +void httpp_deletevar(http_parser_t *parser, const char *name) +{ + http_var_t var; + + if (parser == NULL || name == NULL) + return; + var.name = (char*)name; + var.value = NULL; + avl_delete(parser->vars, (void *)&var, _free_vars); +} + void httpp_setvar(http_parser_t *parser, const char *name, const char *value) { http_var_t *var; diff --git a/httpp/httpp.h b/httpp/httpp.h index c62feed..f174028 100644 --- a/httpp/httpp.h +++ b/httpp/httpp.h @@ -15,6 +15,7 @@ #define HTTPP_VAR_VERSION "__version" #define HTTPP_VAR_URI "__uri" #define HTTPP_VAR_RAWURI "__rawuri" +#define HTTPP_VAR_QUERYARGS " __queryargs" #define HTTPP_VAR_REQ_TYPE "__req_type" #define HTTPP_VAR_ERROR_MESSAGE "__errormessage" #define HTTPP_VAR_ERROR_CODE "__errorcode" @@ -62,6 +63,7 @@ int httpp_parse(http_parser_t *parser, const char *http_data, unsigned long len) int httpp_parse_icy(http_parser_t *parser, const char *http_data, unsigned long len); int httpp_parse_response(http_parser_t *parser, const char *http_data, unsigned long len, const char *uri); void httpp_setvar(http_parser_t *parser, const char *name, const char *value); +void httpp_deletevar(http_parser_t *parser, const char *name); const char *httpp_getvar(http_parser_t *parser, const char *name); void httpp_set_query_param(http_parser_t *parser, const char *name, const char *value); const char *httpp_get_query_param(http_parser_t *parser, const char *name); diff --git a/timing/timing.c b/timing/timing.c index 4aeaa25..dd80231 100644 --- a/timing/timing.c +++ b/timing/timing.c @@ -11,15 +11,22 @@ #include #include -#ifdef HAVE_STDINT_H -# include -#endif #ifdef _WIN32 #include #include #else -#include +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + #include #endif @@ -47,15 +54,16 @@ uint64_t timing_get_time(void) return (uint64_t)(mtv.tv_sec) * 1000 + (uint64_t)(mtv.tv_usec) / 1000; #elif HAVE_FTIME - struct timeb t; + struct timeb t; - ftime(&t); - return t.time * 1000 + t.millitm; + ftime(&t); + return t.time * 1000 + t.millitm; #else #error need time query handler #endif } + void timing_sleep(uint64_t sleeptime) { struct timeval sleeper; diff --git a/timing/timing.h b/timing/timing.h index 0c0b825..2ecd524 100644 --- a/timing/timing.h +++ b/timing/timing.h @@ -9,7 +9,9 @@ #define __TIMING_H__ #include -#ifdef HAVE_STDINT_H +#ifdef HAVE_INTTYPES_H +#include +#elif defined(HAVE_STDINT_H) #include #endif