#ifndef __HTTP_H #define __HTTP_H #define HTTP_VERSION "2" #ifdef __cplusplus extern "C" { #endif typedef void (*http_errfunc)( const char *fmt, ... ); extern void http_error( const char *fmt, ... ) __attribute__((format (printf,1,2))); extern http_errfunc http_fatal; /* Default Fatal Error Function == http_error() */ extern const signed char hexval_table[256]; static inline unsigned int hexval( unsigned char c ) { return hexval_table[c]; } /******************************************************************* Convert two consecutive hexadecimal digits into a char. Return a negative value on error. Don't run over the end of short strings. */ static inline int hex2chr( const char *s ) { unsigned int val = hexval(s[0]); return (val & ~0xf) ? val : (val << 4) | hexval(s[1]); } extern char *url_decode_mem( const char *url, int len ); extern char *url_percent_decode( const char *encoded ); extern char *url_decode_parameter_name( const char **query ); extern char *url_decode_parameter_value( const char **query ); extern void http_parse_querystring( const char *txt, void (*fn)(const char *name, const char *value) ); extern char *fmt( const char *format,... ) __attribute__((format (printf,1,2))); extern char *fmtalloc( const char *format,... ) __attribute__((format (printf,1,2))); extern char *http_date( time_t t ); extern const char *http_status( int status_code ); #ifdef __cplusplus } #endif #endif /* __HTTP_H */