lsmod: repair indentation
httpd: ifdef CONFIG -> if ENABLE (shorted, catched typos)
This commit is contained in:
parent
3038ac9c19
commit
55a994055f
@ -97,7 +97,7 @@ static const char default_path_httpd_conf[] = "/etc";
|
|||||||
static const char httpd_conf[] = "httpd.conf";
|
static const char httpd_conf[] = "httpd.conf";
|
||||||
static const char home[] = "./";
|
static const char home[] = "./";
|
||||||
|
|
||||||
#ifdef CONFIG_LFS
|
#if ENABLE_LFS
|
||||||
# define cont_l_fmt "%lld"
|
# define cont_l_fmt "%lld"
|
||||||
# define cont_l_type (long long)
|
# define cont_l_type (long long)
|
||||||
#else
|
#else
|
||||||
@ -146,7 +146,7 @@ typedef struct {
|
|||||||
const char *configFile;
|
const char *configFile;
|
||||||
|
|
||||||
unsigned int rmt_ip;
|
unsigned int rmt_ip;
|
||||||
#if defined(CONFIG_FEATURE_HTTPD_CGI) || DEBUG
|
#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
|
||||||
char rmt_ip_str[16]; /* for set env REMOTE_ADDR */
|
char rmt_ip_str[16]; /* for set env REMOTE_ADDR */
|
||||||
#endif
|
#endif
|
||||||
unsigned port; /* server initial port and for
|
unsigned port; /* server initial port and for
|
||||||
@ -161,14 +161,14 @@ typedef struct {
|
|||||||
|
|
||||||
Htaccess_IP *ip_a_d; /* config allow/deny lines */
|
Htaccess_IP *ip_a_d; /* config allow/deny lines */
|
||||||
int flg_deny_all;
|
int flg_deny_all;
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
Htaccess *auth; /* config user:password lines */
|
Htaccess *auth; /* config user:password lines */
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
||||||
Htaccess *mime_a; /* config mime types */
|
Htaccess *mime_a; /* config mime types */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
int accepted_socket;
|
int accepted_socket;
|
||||||
# define a_c_r config->accepted_socket
|
# define a_c_r config->accepted_socket
|
||||||
# define a_c_w config->accepted_socket
|
# define a_c_w config->accepted_socket
|
||||||
@ -178,7 +178,7 @@ typedef struct {
|
|||||||
#endif
|
#endif
|
||||||
volatile int alarm_signaled;
|
volatile int alarm_signaled;
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
||||||
Htaccess *script_i; /* config script interpreters */
|
Htaccess *script_i; /* config script interpreters */
|
||||||
#endif
|
#endif
|
||||||
} HttpdConfig;
|
} HttpdConfig;
|
||||||
@ -209,8 +209,7 @@ static const char* const suffixTable [] = {
|
|||||||
0, "application/octet-stream" /* default */
|
0, "application/octet-stream" /* default */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
HTTP_OK = 200,
|
HTTP_OK = 200,
|
||||||
HTTP_MOVED_TEMPORARILY = 302,
|
HTTP_MOVED_TEMPORARILY = 302,
|
||||||
HTTP_BAD_REQUEST = 400, /* malformed syntax */
|
HTTP_BAD_REQUEST = 400, /* malformed syntax */
|
||||||
@ -237,8 +236,7 @@ typedef enum
|
|||||||
#endif
|
#endif
|
||||||
} HttpResponseNum;
|
} HttpResponseNum;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
HttpResponseNum type;
|
HttpResponseNum type;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *info;
|
const char *info;
|
||||||
@ -251,7 +249,7 @@ static const HttpEnumString httpResponseNames[] = {
|
|||||||
"No request appeared within a reasonable time period." },
|
"No request appeared within a reasonable time period." },
|
||||||
{ HTTP_NOT_IMPLEMENTED, "Not Implemented",
|
{ HTTP_NOT_IMPLEMENTED, "Not Implemented",
|
||||||
"The requested method is not recognized by this server." },
|
"The requested method is not recognized by this server." },
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
{ HTTP_UNAUTHORIZED, "Unauthorized", "" },
|
{ HTTP_UNAUTHORIZED, "Unauthorized", "" },
|
||||||
#endif
|
#endif
|
||||||
{ HTTP_NOT_FOUND, "Not Found",
|
{ HTTP_NOT_FOUND, "Not Found",
|
||||||
@ -277,8 +275,7 @@ static const char RFC1123FMT[] = "%a, %d %b %Y %H:%M:%S GMT";
|
|||||||
static const char Content_length[] = "Content-length:";
|
static const char Content_length[] = "Content-length:";
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int scan_ip(const char **ep, unsigned int *ip, unsigned char endc)
|
||||||
scan_ip (const char **ep, unsigned int *ip, unsigned char endc)
|
|
||||||
{
|
{
|
||||||
const char *p = *ep;
|
const char *p = *ep;
|
||||||
int auto_mask = 8;
|
int auto_mask = 8;
|
||||||
@ -315,8 +312,7 @@ scan_ip (const char **ep, unsigned int *ip, unsigned char endc)
|
|||||||
return auto_mask;
|
return auto_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int scan_ip_mask(const char *ipm, unsigned int *ip, unsigned int *mask)
|
||||||
scan_ip_mask (const char *ipm, unsigned int *ip, unsigned int *mask)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned int msk;
|
unsigned int msk;
|
||||||
@ -331,7 +327,7 @@ scan_ip_mask (const char *ipm, unsigned int *ip, unsigned int *mask)
|
|||||||
while (*p) {
|
while (*p) {
|
||||||
if (*p < '0' || *p > '9') {
|
if (*p < '0' || *p > '9') {
|
||||||
if (*p == '.') {
|
if (*p == '.') {
|
||||||
i = scan_ip (&ipm, mask, 0);
|
i = scan_ip(&ipm, mask, 0);
|
||||||
return i != 32;
|
return i != 32;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -353,7 +349,7 @@ scan_ip_mask (const char *ipm, unsigned int *ip, unsigned int *mask)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_FEATURE_HTTPD_BASIC_AUTH) || defined(CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES)
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
||||||
static void free_config_lines(Htaccess **pprev)
|
static void free_config_lines(Htaccess **pprev)
|
||||||
{
|
{
|
||||||
Htaccess *prev = *pprev;
|
Htaccess *prev = *pprev;
|
||||||
@ -401,7 +397,7 @@ static void free_config_lines(Htaccess **pprev)
|
|||||||
static void parse_conf(const char *path, int flag)
|
static void parse_conf(const char *path, int flag)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
Htaccess *prev, *cur;
|
Htaccess *prev, *cur;
|
||||||
#elif CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
#elif CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
||||||
Htaccess *cur;
|
Htaccess *cur;
|
||||||
@ -425,16 +421,16 @@ static void parse_conf(const char *path, int flag)
|
|||||||
|
|
||||||
config->flg_deny_all = 0;
|
config->flg_deny_all = 0;
|
||||||
|
|
||||||
#if defined(CONFIG_FEATURE_HTTPD_BASIC_AUTH) || defined(CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES) || defined(CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR)
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
||||||
/* retain previous auth and mime config only for subdir parse */
|
/* retain previous auth and mime config only for subdir parse */
|
||||||
if (flag != SUBDIR_PARSE) {
|
if (flag != SUBDIR_PARSE) {
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
free_config_lines(&config->auth);
|
free_config_lines(&config->auth);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
||||||
free_config_lines(&config->mime_a);
|
free_config_lines(&config->mime_a);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
||||||
free_config_lines(&config->script_i);
|
free_config_lines(&config->script_i);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -461,11 +457,11 @@ static void parse_conf(const char *path, int flag)
|
|||||||
cf = httpd_conf;
|
cf = httpd_conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
prev = config->auth;
|
prev = config->auth;
|
||||||
#endif
|
#endif
|
||||||
/* This could stand some work */
|
/* This could stand some work */
|
||||||
while ( (p0 = fgets(buf, sizeof(buf), f)) != NULL) {
|
while ((p0 = fgets(buf, sizeof(buf), f)) != NULL) {
|
||||||
c = NULL;
|
c = NULL;
|
||||||
for (p = p0; *p0 != 0 && *p0 != '#'; p0++) {
|
for (p = p0; *p0 != 0 && *p0 != '#'; p0++) {
|
||||||
if (!isspace(*p0)) {
|
if (!isspace(*p0)) {
|
||||||
@ -494,13 +490,13 @@ static void parse_conf(const char *path, int flag)
|
|||||||
if (*p0 == 'a')
|
if (*p0 == 'a')
|
||||||
*p0 = 'A';
|
*p0 = 'A';
|
||||||
else if (*p0 != 'D' && *p0 != 'A'
|
else if (*p0 != 'D' && *p0 != 'A'
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
&& *p0 != '/'
|
&& *p0 != '/'
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
||||||
&& *p0 != '.'
|
&& *p0 != '.'
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
||||||
&& *p0 != '*'
|
&& *p0 != '*'
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
@ -509,7 +505,7 @@ static void parse_conf(const char *path, int flag)
|
|||||||
/* storing current config IP line */
|
/* storing current config IP line */
|
||||||
pip = calloc(1, sizeof(Htaccess_IP));
|
pip = calloc(1, sizeof(Htaccess_IP));
|
||||||
if (pip) {
|
if (pip) {
|
||||||
if (scan_ip_mask (c, &(pip->ip), &(pip->mask))) {
|
if (scan_ip_mask(c, &(pip->ip), &(pip->mask))) {
|
||||||
/* syntax IP{/mask} error detected, protect all */
|
/* syntax IP{/mask} error detected, protect all */
|
||||||
*p0 = 'D';
|
*p0 = 'D';
|
||||||
pip->mask = 0;
|
pip->mask = 0;
|
||||||
@ -534,7 +530,7 @@ static void parse_conf(const char *path, int flag)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
if (*p0 == '/') {
|
if (*p0 == '/') {
|
||||||
/* make full path from httpd root / curent_path / config_line_path */
|
/* make full path from httpd root / curent_path / config_line_path */
|
||||||
cf = flag == SUBDIR_PARSE ? path : "";
|
cf = flag == SUBDIR_PARSE ? path : "";
|
||||||
@ -574,7 +570,7 @@ static void parse_conf(const char *path, int flag)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_FEATURE_HTTPD_BASIC_AUTH) || defined(CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES) || defined(CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR)
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH || ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES || ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
||||||
/* storing current config line */
|
/* storing current config line */
|
||||||
cur = calloc(1, sizeof(Htaccess) + strlen(p0));
|
cur = calloc(1, sizeof(Htaccess) + strlen(p0));
|
||||||
if (cur) {
|
if (cur) {
|
||||||
@ -582,7 +578,7 @@ static void parse_conf(const char *path, int flag)
|
|||||||
c = strchr(cf, ':');
|
c = strchr(cf, ':');
|
||||||
*c++ = 0;
|
*c++ = 0;
|
||||||
cur->after_colon = c;
|
cur->after_colon = c;
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
||||||
if (*cf == '.') {
|
if (*cf == '.') {
|
||||||
/* config .mime line move top for overwrite previous */
|
/* config .mime line move top for overwrite previous */
|
||||||
cur->next = config->mime_a;
|
cur->next = config->mime_a;
|
||||||
@ -590,7 +586,7 @@ static void parse_conf(const char *path, int flag)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
||||||
if (*cf == '*' && cf[1] == '.') {
|
if (*cf == '*' && cf[1] == '.') {
|
||||||
/* config script interpreter line move top for overwrite previous */
|
/* config script interpreter line move top for overwrite previous */
|
||||||
cur->next = config->script_i;
|
cur->next = config->script_i;
|
||||||
@ -598,7 +594,7 @@ static void parse_conf(const char *path, int flag)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
free(p0);
|
free(p0);
|
||||||
if (prev == NULL) {
|
if (prev == NULL) {
|
||||||
/* first line */
|
/* first line */
|
||||||
@ -636,7 +632,7 @@ static void parse_conf(const char *path, int flag)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_ENCODE_URL_STR
|
#if ENABLE_FEATURE_HTTPD_ENCODE_URL_STR
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
> $Function: encodeString()
|
> $Function: encodeString()
|
||||||
@ -725,7 +721,7 @@ static char *decodeString(char *orig, int flag_plus_to_space)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
> $Function: addEnv()
|
> $Function: addEnv()
|
||||||
@ -760,7 +756,7 @@ static void addEnv(const char *name_before_underline,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV) || defined(CONFIG_FEATURE_HTTPD_WITHOUT_INETD)
|
#if ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV || ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
/* set environs SERVER_PORT and REMOTE_PORT */
|
/* set environs SERVER_PORT and REMOTE_PORT */
|
||||||
static void addEnvPort(const char *port_name)
|
static void addEnvPort(const char *port_name)
|
||||||
{
|
{
|
||||||
@ -773,7 +769,7 @@ static void addEnvPort(const char *port_name)
|
|||||||
#endif /* CONFIG_FEATURE_HTTPD_CGI */
|
#endif /* CONFIG_FEATURE_HTTPD_CGI */
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
> $Function: decodeBase64()
|
> $Function: decodeBase64()
|
||||||
@ -832,7 +828,7 @@ static void decodeBase64(char *Data)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
> $Function: openServer()
|
> $Function: openServer()
|
||||||
@ -860,9 +856,9 @@ static int openServer(void)
|
|||||||
/* tell the OS it's OK to reuse a previous address even though */
|
/* tell the OS it's OK to reuse a previous address even though */
|
||||||
/* it may still be in a close down state. Allows bind to succeed. */
|
/* it may still be in a close down state. Allows bind to succeed. */
|
||||||
#ifdef SO_REUSEPORT
|
#ifdef SO_REUSEPORT
|
||||||
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (void *)&on, sizeof(on)) ;
|
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (void *)&on, sizeof(on));
|
||||||
#else
|
#else
|
||||||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)) ;
|
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on));
|
||||||
#endif
|
#endif
|
||||||
xbind(fd, (struct sockaddr *)&lsocket, sizeof(lsocket));
|
xbind(fd, (struct sockaddr *)&lsocket, sizeof(lsocket));
|
||||||
xlisten(fd, 9);
|
xlisten(fd, 9);
|
||||||
@ -916,7 +912,7 @@ static int sendHeaders(HttpResponseNum responseNum)
|
|||||||
"Date: %s\r\nConnection: close\r\n",
|
"Date: %s\r\nConnection: close\r\n",
|
||||||
responseNum, responseString, mime_type, timeStr);
|
responseNum, responseString, mime_type, timeStr);
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
if (responseNum == HTTP_UNAUTHORIZED) {
|
if (responseNum == HTTP_UNAUTHORIZED) {
|
||||||
len += sprintf(buf+len, "WWW-Authenticate: Basic realm=\"%s\"\r\n",
|
len += sprintf(buf+len, "WWW-Authenticate: Basic realm=\"%s\"\r\n",
|
||||||
config->realm);
|
config->realm);
|
||||||
@ -978,7 +974,7 @@ static int getLine(void)
|
|||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
> $Function: sendCgi()
|
> $Function: sendCgi()
|
||||||
@ -1091,7 +1087,7 @@ static int sendCgi(const char *url,
|
|||||||
addEnv("SERVER", "PROTOCOL", "HTTP/1.0");
|
addEnv("SERVER", "PROTOCOL", "HTTP/1.0");
|
||||||
addEnv("GATEWAY_INTERFACE", "", "CGI/1.1");
|
addEnv("GATEWAY_INTERFACE", "", "CGI/1.1");
|
||||||
addEnv("REMOTE", "ADDR", config->rmt_ip_str);
|
addEnv("REMOTE", "ADDR", config->rmt_ip_str);
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
|
#if ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
|
||||||
addEnvPort("REMOTE");
|
addEnvPort("REMOTE");
|
||||||
#endif
|
#endif
|
||||||
if (bodyLen) {
|
if (bodyLen) {
|
||||||
@ -1104,7 +1100,7 @@ static int sendCgi(const char *url,
|
|||||||
addEnv("HTTP", "COOKIE", cookie);
|
addEnv("HTTP", "COOKIE", cookie);
|
||||||
if (content_type)
|
if (content_type)
|
||||||
addEnv("CONTENT", "TYPE", content_type);
|
addEnv("CONTENT", "TYPE", content_type);
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
if (config->remoteuser) {
|
if (config->remoteuser) {
|
||||||
addEnv("REMOTE", "USER", config->remoteuser);
|
addEnv("REMOTE", "USER", config->remoteuser);
|
||||||
addEnv("AUTH_TYPE", "", "Basic");
|
addEnv("AUTH_TYPE", "", "Basic");
|
||||||
@ -1124,7 +1120,7 @@ static int sendCgi(const char *url,
|
|||||||
// now run the program. If it fails,
|
// now run the program. If it fails,
|
||||||
// use _exit() so no destructors
|
// use _exit() so no destructors
|
||||||
// get called and make a mess.
|
// get called and make a mess.
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
||||||
char *interpr = NULL;
|
char *interpr = NULL;
|
||||||
char *suffix = strrchr(purl, '.');
|
char *suffix = strrchr(purl, '.');
|
||||||
|
|
||||||
@ -1138,7 +1134,7 @@ static int sendCgi(const char *url,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*script = '/';
|
*script = '/';
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
|
||||||
if (interpr)
|
if (interpr)
|
||||||
execv(interpr, argp);
|
execv(interpr, argp);
|
||||||
else
|
else
|
||||||
@ -1147,7 +1143,7 @@ static int sendCgi(const char *url,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
config->accepted_socket = 1; /* send to stdout */
|
config->accepted_socket = 1; /* send to stdout */
|
||||||
#endif
|
#endif
|
||||||
sendHeaders(HTTP_NOT_FOUND);
|
sendHeaders(HTTP_NOT_FOUND);
|
||||||
@ -1298,7 +1294,7 @@ static int sendFile(const char *url)
|
|||||||
}
|
}
|
||||||
/* also, if not found, set default as "application/octet-stream"; */
|
/* also, if not found, set default as "application/octet-stream"; */
|
||||||
config->httpd_found.found_mime_type = *(table+1);
|
config->httpd_found.found_mime_type = *(table+1);
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
||||||
if (suffix) {
|
if (suffix) {
|
||||||
Htaccess * cur;
|
Htaccess * cur;
|
||||||
|
|
||||||
@ -1380,7 +1376,7 @@ static int checkPermIP(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
static int checkPerm(const char *path, const char *request)
|
static int checkPerm(const char *path, const char *request)
|
||||||
{
|
{
|
||||||
Htaccess * cur;
|
Htaccess * cur;
|
||||||
@ -1396,7 +1392,7 @@ static int checkPerm(const char *path, const char *request)
|
|||||||
continue; /* find next identical */
|
continue; /* find next identical */
|
||||||
p = cur->after_colon;
|
p = cur->after_colon;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
fprintf(stderr,"checkPerm: '%s' ? '%s'\n", p0, request);
|
fprintf(stderr, "checkPerm: '%s' ? '%s'\n", p0, request);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
size_t l = strlen(p0);
|
size_t l = strlen(p0);
|
||||||
@ -1413,7 +1409,7 @@ static int checkPerm(const char *path, const char *request)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_AUTH_MD5
|
#if ENABLE_FEATURE_HTTPD_AUTH_MD5
|
||||||
{
|
{
|
||||||
char *cipher;
|
char *cipher;
|
||||||
char *pp;
|
char *pp;
|
||||||
@ -1435,7 +1431,7 @@ static int checkPerm(const char *path, const char *request)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (strcmp(p, request) == 0) {
|
if (strcmp(p, request) == 0) {
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_AUTH_MD5
|
#if ENABLE_FEATURE_HTTPD_AUTH_MD5
|
||||||
set_remoteuser_var:
|
set_remoteuser_var:
|
||||||
#endif
|
#endif
|
||||||
config->remoteuser = strdup(request);
|
config->remoteuser = strdup(request);
|
||||||
@ -1483,7 +1479,7 @@ static void handleIncoming(void)
|
|||||||
char *test;
|
char *test;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int ip_allowed;
|
int ip_allowed;
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
const char *prequest = request_GET;
|
const char *prequest = request_GET;
|
||||||
long length=0;
|
long length=0;
|
||||||
char *cookie = 0;
|
char *cookie = 0;
|
||||||
@ -1494,7 +1490,7 @@ static void handleIncoming(void)
|
|||||||
int retval;
|
int retval;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
int credentials = -1; /* if not requred this is Ok */
|
int credentials = -1; /* if not requred this is Ok */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1517,7 +1513,7 @@ BAD_REQUEST:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*purl = 0;
|
*purl = 0;
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
if (strcasecmp(buf, prequest) != 0) {
|
if (strcasecmp(buf, prequest) != 0) {
|
||||||
prequest = "POST";
|
prequest = "POST";
|
||||||
if (strcasecmp(buf, prequest) != 0) {
|
if (strcasecmp(buf, prequest) != 0) {
|
||||||
@ -1559,7 +1555,7 @@ BAD_REQUEST:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* algorithm stolen from libbb bb_simplify_path(),
|
/* algorithm stolen from libbb bb_simplify_path(),
|
||||||
but don`t strdup and reducing trailing slash and protect out root */
|
but don't strdup and reducing trailing slash and protect out root */
|
||||||
purl = test = url;
|
purl = test = url;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -1620,7 +1616,7 @@ BAD_REQUEST:
|
|||||||
fprintf(stderr, "Header: '%s'\n", buf);
|
fprintf(stderr, "Header: '%s'\n", buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
/* try and do our best to parse more lines */
|
/* try and do our best to parse more lines */
|
||||||
if ((strncasecmp(buf, Content_length, 15) == 0)) {
|
if ((strncasecmp(buf, Content_length, 15) == 0)) {
|
||||||
if (prequest != request_GET)
|
if (prequest != request_GET)
|
||||||
@ -1640,7 +1636,7 @@ BAD_REQUEST:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
if (strncasecmp(buf, "Authorization:", 14) == 0) {
|
if (strncasecmp(buf, "Authorization:", 14) == 0) {
|
||||||
/* We only allow Basic credentials.
|
/* We only allow Basic credentials.
|
||||||
* It shows up as "Authorization: Basic <userid:password>" where
|
* It shows up as "Authorization: Basic <userid:password>" where
|
||||||
@ -1665,14 +1661,14 @@ BAD_REQUEST:
|
|||||||
|
|
||||||
if (strcmp(strrchr(url, '/') + 1, httpd_conf) == 0 || ip_allowed == 0) {
|
if (strcmp(strrchr(url, '/') + 1, httpd_conf) == 0 || ip_allowed == 0) {
|
||||||
/* protect listing [/path]/httpd_conf or IP deny */
|
/* protect listing [/path]/httpd_conf or IP deny */
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
FORBIDDEN: /* protect listing /cgi-bin */
|
FORBIDDEN: /* protect listing /cgi-bin */
|
||||||
#endif
|
#endif
|
||||||
sendHeaders(HTTP_FORBIDDEN);
|
sendHeaders(HTTP_FORBIDDEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
if (credentials <= 0 && checkPerm(url, ":") == 0) {
|
if (credentials <= 0 && checkPerm(url, ":") == 0) {
|
||||||
sendHeaders(HTTP_UNAUTHORIZED);
|
sendHeaders(HTTP_UNAUTHORIZED);
|
||||||
break;
|
break;
|
||||||
@ -1690,7 +1686,7 @@ FORBIDDEN: /* protect listing /cgi-bin */
|
|||||||
|
|
||||||
test = url + 1; /* skip first '/' */
|
test = url + 1; /* skip first '/' */
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
/* if strange Content-Length */
|
/* if strange Content-Length */
|
||||||
if (length < 0)
|
if (length < 0)
|
||||||
break;
|
break;
|
||||||
@ -1711,12 +1707,12 @@ FORBIDDEN: /* protect listing /cgi-bin */
|
|||||||
config->last_mod = sb.st_mtime;
|
config->last_mod = sb.st_mtime;
|
||||||
}
|
}
|
||||||
sendFile(test);
|
sendFile(test);
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
/* unset if non inetd looped */
|
/* unset if non inetd looped */
|
||||||
config->ContentLength = -1;
|
config->ContentLength = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1724,8 +1720,8 @@ FORBIDDEN: /* protect listing /cgi-bin */
|
|||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
/* from inetd don`t looping: freeing, closing automatic from exit always */
|
/* from inetd don't looping: freeing, closing automatic from exit always */
|
||||||
# if DEBUG
|
# if DEBUG
|
||||||
fprintf(stderr, "closing socket\n");
|
fprintf(stderr, "closing socket\n");
|
||||||
# endif
|
# endif
|
||||||
@ -1733,7 +1729,7 @@ FORBIDDEN: /* protect listing /cgi-bin */
|
|||||||
free(cookie);
|
free(cookie);
|
||||||
free(content_type);
|
free(content_type);
|
||||||
free(config->referer);
|
free(config->referer);
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
free(config->remoteuser);
|
free(config->remoteuser);
|
||||||
#endif
|
#endif
|
||||||
# endif
|
# endif
|
||||||
@ -1741,17 +1737,17 @@ FORBIDDEN: /* protect listing /cgi-bin */
|
|||||||
shutdown(a_c_w, SHUT_WR);
|
shutdown(a_c_w, SHUT_WR);
|
||||||
|
|
||||||
/* Properly wait for remote to closed */
|
/* Properly wait for remote to closed */
|
||||||
FD_ZERO (&s_fd) ;
|
FD_ZERO(&s_fd);
|
||||||
FD_SET (a_c_r, &s_fd) ;
|
FD_SET(a_c_r, &s_fd);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
tv.tv_sec = 2 ;
|
tv.tv_sec = 2;
|
||||||
tv.tv_usec = 0 ;
|
tv.tv_usec = 0;
|
||||||
retval = select (a_c_r + 1, &s_fd, NULL, NULL, &tv);
|
retval = select(a_c_r + 1, &s_fd, NULL, NULL, &tv);
|
||||||
} while (retval > 0 && (read (a_c_r, buf, sizeof (config->buf)) > 0));
|
} while (retval > 0 && read(a_c_r, buf, sizeof(config->buf) > 0));
|
||||||
|
|
||||||
shutdown(a_c_r, SHUT_RD);
|
shutdown(a_c_r, SHUT_RD);
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
close(config->accepted_socket);
|
close(config->accepted_socket);
|
||||||
#endif /* CONFIG_FEATURE_HTTPD_WITHOUT_INETD */
|
#endif /* CONFIG_FEATURE_HTTPD_WITHOUT_INETD */
|
||||||
}
|
}
|
||||||
@ -1771,7 +1767,7 @@ FORBIDDEN: /* protect listing /cgi-bin */
|
|||||||
* $Return: (int) . . . . Always 0.
|
* $Return: (int) . . . . Always 0.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
static int miniHttpd(int server)
|
static int miniHttpd(int server)
|
||||||
{
|
{
|
||||||
fd_set readfd, portfd;
|
fd_set readfd, portfd;
|
||||||
@ -1798,7 +1794,7 @@ static int miniHttpd(int server)
|
|||||||
}
|
}
|
||||||
config->accepted_socket = s;
|
config->accepted_socket = s;
|
||||||
config->rmt_ip = ntohl(fromAddr.sin_addr.s_addr);
|
config->rmt_ip = ntohl(fromAddr.sin_addr.s_addr);
|
||||||
#if defined(CONFIG_FEATURE_HTTPD_CGI) || DEBUG
|
#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
|
||||||
sprintf(config->rmt_ip_str, "%u.%u.%u.%u",
|
sprintf(config->rmt_ip_str, "%u.%u.%u.%u",
|
||||||
(unsigned char)(config->rmt_ip >> 24),
|
(unsigned char)(config->rmt_ip >> 24),
|
||||||
(unsigned char)(config->rmt_ip >> 16),
|
(unsigned char)(config->rmt_ip >> 16),
|
||||||
@ -1813,14 +1809,14 @@ static int miniHttpd(int server)
|
|||||||
|
|
||||||
/* set the KEEPALIVE option to cull dead connections */
|
/* set the KEEPALIVE option to cull dead connections */
|
||||||
on = 1;
|
on = 1;
|
||||||
setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, sizeof (on));
|
setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, sizeof(on));
|
||||||
|
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
if (fork() == 0)
|
if (fork() == 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* This is the spawned thread */
|
/* This is the spawned thread */
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
|
#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
|
||||||
/* protect reload config, may be confuse checking */
|
/* protect reload config, may be confuse checking */
|
||||||
signal(SIGHUP, SIG_IGN);
|
signal(SIGHUP, SIG_IGN);
|
||||||
#endif
|
#endif
|
||||||
@ -1842,11 +1838,11 @@ static int miniHttpd(int server)
|
|||||||
static int miniHttpd(void)
|
static int miniHttpd(void)
|
||||||
{
|
{
|
||||||
struct sockaddr_in fromAddrLen;
|
struct sockaddr_in fromAddrLen;
|
||||||
socklen_t sinlen = sizeof (struct sockaddr_in);
|
socklen_t sinlen = sizeof(struct sockaddr_in);
|
||||||
|
|
||||||
getpeername (0, (struct sockaddr *)&fromAddrLen, &sinlen);
|
getpeername(0, (struct sockaddr *)&fromAddrLen, &sinlen);
|
||||||
config->rmt_ip = ntohl(fromAddrLen.sin_addr.s_addr);
|
config->rmt_ip = ntohl(fromAddrLen.sin_addr.s_addr);
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
sprintf(config->rmt_ip_str, "%u.%u.%u.%u",
|
sprintf(config->rmt_ip_str, "%u.%u.%u.%u",
|
||||||
(unsigned char)(config->rmt_ip >> 24),
|
(unsigned char)(config->rmt_ip >> 24),
|
||||||
(unsigned char)(config->rmt_ip >> 16),
|
(unsigned char)(config->rmt_ip >> 16),
|
||||||
@ -1859,7 +1855,7 @@ static int miniHttpd(void)
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_FEATURE_HTTPD_WITHOUT_INETD */
|
#endif /* CONFIG_FEATURE_HTTPD_WITHOUT_INETD */
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
|
#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
|
||||||
static void sighup_handler(int sig)
|
static void sighup_handler(int sig)
|
||||||
{
|
{
|
||||||
/* set and reset */
|
/* set and reset */
|
||||||
@ -1884,7 +1880,7 @@ enum httpd_opts_nums {
|
|||||||
USE_FEATURE_HTTPD_WITHOUT_INETD(p_opt_port,)
|
USE_FEATURE_HTTPD_WITHOUT_INETD(p_opt_port,)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char httpd_opts[]="c:d:h:"
|
static const char httpd_opts[] = "c:d:h:"
|
||||||
USE_FEATURE_HTTPD_ENCODE_URL_STR("e:")
|
USE_FEATURE_HTTPD_ENCODE_URL_STR("e:")
|
||||||
USE_FEATURE_HTTPD_BASIC_AUTH("r:")
|
USE_FEATURE_HTTPD_BASIC_AUTH("r:")
|
||||||
USE_FEATURE_HTTPD_AUTH_MD5("m:")
|
USE_FEATURE_HTTPD_AUTH_MD5("m:")
|
||||||
@ -1926,11 +1922,11 @@ int httpd_main(int argc, char *argv[])
|
|||||||
USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;)
|
USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;)
|
||||||
|
|
||||||
config = xzalloc(sizeof(*config));
|
config = xzalloc(sizeof(*config));
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
|
||||||
config->realm = "Web Server Authentication";
|
config->realm = "Web Server Authentication";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
config->port = 80;
|
config->port = 80;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1949,22 +1945,22 @@ int httpd_main(int argc, char *argv[])
|
|||||||
printf("%s", decodeString(url_for_decode, 1));
|
printf("%s", decodeString(url_for_decode, 1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_ENCODE_URL_STR
|
#if ENABLE_FEATURE_HTTPD_ENCODE_URL_STR
|
||||||
if (opt & OPT_ENCODE_URL) {
|
if (opt & OPT_ENCODE_URL) {
|
||||||
printf("%s", encodeString(url_for_encode));
|
printf("%s", encodeString(url_for_encode));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_AUTH_MD5
|
#if ENABLE_FEATURE_HTTPD_AUTH_MD5
|
||||||
if (opt & OPT_MD5) {
|
if (opt & OPT_MD5) {
|
||||||
printf("%s\n", pw_encrypt(pass, "$1$"));
|
puts(pw_encrypt(pass, "$1$"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
if (opt & OPT_PORT)
|
if (opt & OPT_PORT)
|
||||||
config->port = bb_xgetlarg(s_port, 10, 1, 0xffff);
|
config->port = bb_xgetlarg(s_port, 10, 1, 0xffff);
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_SETUID
|
#if ENABLE_FEATURE_HTTPD_SETUID
|
||||||
if (opt & OPT_SETUID) {
|
if (opt & OPT_SETUID) {
|
||||||
char *e;
|
char *e;
|
||||||
|
|
||||||
@ -1978,7 +1974,7 @@ int httpd_main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
xchdir(home_httpd);
|
xchdir(home_httpd);
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
server = openServer();
|
server = openServer();
|
||||||
# ifdef CONFIG_FEATURE_HTTPD_SETUID
|
# ifdef CONFIG_FEATURE_HTTPD_SETUID
|
||||||
/* drop privileges */
|
/* drop privileges */
|
||||||
@ -1987,7 +1983,7 @@ int httpd_main(int argc, char *argv[])
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
#if ENABLE_FEATURE_HTTPD_CGI
|
||||||
{
|
{
|
||||||
char *p = getenv("PATH");
|
char *p = getenv("PATH");
|
||||||
if (p) {
|
if (p) {
|
||||||
@ -2002,15 +1998,15 @@ int httpd_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
|
#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
|
||||||
sighup_handler(0);
|
sighup_handler(0);
|
||||||
#else
|
#else
|
||||||
parse_conf(default_path_httpd_conf, FIRST_PARSE);
|
parse_conf(default_path_httpd_conf, FIRST_PARSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_WITHOUT_INETD
|
#if ENABLE_FEATURE_HTTPD_WITHOUT_INETD
|
||||||
# if !DEBUG
|
# if !DEBUG
|
||||||
xdaemon(1, 0); /* don`t change curent directory */
|
xdaemon(1, 0); /* don't change curent directory */
|
||||||
# endif
|
# endif
|
||||||
return miniHttpd(server);
|
return miniHttpd(server);
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user