diff options
author | kx <kx@radix.pro> | 2023-03-24 03:55:33 +0300 |
---|---|---|
committer | kx <kx@radix.pro> | 2023-03-24 03:55:33 +0300 |
commit | bfc1508d26c89c9a36d2d9a827fe2c4ed128884d (patch) | |
tree | 8d41298a7072a3e289e4912f77ece75cbea1bd54 /csvncgi/http.h | |
parent | c836ae3775cf72f17e0b7e3792d156fdb389bee3 (diff) | |
download | csvn-ui-bfc1508d26c89c9a36d2d9a827fe2c4ed128884d.tar.xz |
Version 0.1.4
Diffstat (limited to 'csvncgi/http.h')
-rw-r--r-- | csvncgi/http.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/csvncgi/http.h b/csvncgi/http.h new file mode 100644 index 0000000..6304b64 --- /dev/null +++ b/csvncgi/http.h @@ -0,0 +1,52 @@ + +#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 */ |