mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-12-04 14:46:31 -05:00
minor cleanups.
svn path=/icecast/trunk/httpp/; revision=16213
This commit is contained in:
parent
6ddf620a21
commit
8e7def3ad4
@ -22,7 +22,7 @@
|
|||||||
#include <avl/avl.h>
|
#include <avl/avl.h>
|
||||||
#include "httpp.h"
|
#include "httpp.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(HAVE_STRCASECMP)
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -358,6 +358,7 @@ int httpp_parse(http_parser_t *parser, const char *http_data, unsigned long len)
|
|||||||
char *query;
|
char *query;
|
||||||
if((query = strchr(uri, '?')) != NULL) {
|
if((query = strchr(uri, '?')) != NULL) {
|
||||||
httpp_setvar(parser, HTTPP_VAR_RAWURI, uri);
|
httpp_setvar(parser, HTTPP_VAR_RAWURI, uri);
|
||||||
|
httpp_setvar(parser, HTTPP_VAR_QUERYARGS, query);
|
||||||
*query = 0;
|
*query = 0;
|
||||||
query++;
|
query++;
|
||||||
parse_query(parser, 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;
|
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)
|
void httpp_setvar(http_parser_t *parser, const char *name, const char *value)
|
||||||
{
|
{
|
||||||
http_var_t *var;
|
http_var_t *var;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#define HTTPP_VAR_VERSION "__version"
|
#define HTTPP_VAR_VERSION "__version"
|
||||||
#define HTTPP_VAR_URI "__uri"
|
#define HTTPP_VAR_URI "__uri"
|
||||||
#define HTTPP_VAR_RAWURI "__rawuri"
|
#define HTTPP_VAR_RAWURI "__rawuri"
|
||||||
|
#define HTTPP_VAR_QUERYARGS " __queryargs"
|
||||||
#define HTTPP_VAR_REQ_TYPE "__req_type"
|
#define HTTPP_VAR_REQ_TYPE "__req_type"
|
||||||
#define HTTPP_VAR_ERROR_MESSAGE "__errormessage"
|
#define HTTPP_VAR_ERROR_MESSAGE "__errormessage"
|
||||||
#define HTTPP_VAR_ERROR_CODE "__errorcode"
|
#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_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);
|
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_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);
|
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);
|
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);
|
const char *httpp_get_query_param(http_parser_t *parser, const char *name);
|
||||||
|
@ -11,15 +11,22 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAVE_STDINT_H
|
|
||||||
# include <stdint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#ifdef TIME_WITH_SYS_TIME
|
||||||
|
# include <sys/time.h>
|
||||||
|
# include <time.h>
|
||||||
|
#else
|
||||||
|
# ifdef HAVE_SYS_TIME_H
|
||||||
|
# include <sys/time.h>
|
||||||
|
# else
|
||||||
|
# include <time.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -56,6 +63,7 @@ uint64_t timing_get_time(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void timing_sleep(uint64_t sleeptime)
|
void timing_sleep(uint64_t sleeptime)
|
||||||
{
|
{
|
||||||
struct timeval sleeper;
|
struct timeval sleeper;
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
#define __TIMING_H__
|
#define __TIMING_H__
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAVE_STDINT_H
|
#ifdef HAVE_INTTYPES_H
|
||||||
|
#include <inttypes.h>
|
||||||
|
#elif defined(HAVE_STDINT_H)
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user