mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
httpd: use fd#1 in inetd mode
inetd: micro style fix
This commit is contained in:
parent
d1a6e8d320
commit
b64eed6030
@ -846,7 +846,7 @@ static int sendHeaders(HttpResponseNum responseNum)
|
|||||||
const char *responseString = "";
|
const char *responseString = "";
|
||||||
const char *infoString = 0;
|
const char *infoString = 0;
|
||||||
const char *mime_type;
|
const char *mime_type;
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
time_t timer = time(0);
|
time_t timer = time(0);
|
||||||
char timeStr[80];
|
char timeStr[80];
|
||||||
int len;
|
int len;
|
||||||
@ -901,7 +901,9 @@ static int sendHeaders(HttpResponseNum responseNum)
|
|||||||
}
|
}
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
fprintf(stderr, "headers: '%s'\n", buf);
|
fprintf(stderr, "headers: '%s'\n", buf);
|
||||||
return full_write(config->accepted_socket, buf, len);
|
i = config->accepted_socket;
|
||||||
|
if (i == 0) i++; /* write to fd# 1 in inetd mode */
|
||||||
|
return full_write(i, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -1302,7 +1304,9 @@ static int sendFile(const char *url)
|
|||||||
sendHeaders(HTTP_OK);
|
sendHeaders(HTTP_OK);
|
||||||
/* TODO: sendfile() */
|
/* TODO: sendfile() */
|
||||||
while ((count = full_read(f, buf, MAX_MEMORY_BUFF)) > 0) {
|
while ((count = full_read(f, buf, MAX_MEMORY_BUFF)) > 0) {
|
||||||
if (full_write(config->accepted_socket, buf, count) != count)
|
int fd = config->accepted_socket;
|
||||||
|
if (fd == 0) fd++; /* write to fd# 1 in inetd mode */
|
||||||
|
if (full_write(fd, buf, count) != count)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
close(f);
|
close(f);
|
||||||
@ -1321,8 +1325,10 @@ static int checkPermIP(void)
|
|||||||
|
|
||||||
/* This could stand some work */
|
/* This could stand some work */
|
||||||
for (cur = config->ip_a_d; cur; cur = cur->next) {
|
for (cur = config->ip_a_d; cur; cur = cur->next) {
|
||||||
#if DEBUG
|
#if ENABLE_FEATURE_HTTPD_CGI && DEBUG
|
||||||
fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
|
fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
|
||||||
|
#endif
|
||||||
|
#if DEBUG
|
||||||
fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
|
fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
|
||||||
(unsigned char)(cur->ip >> 24),
|
(unsigned char)(cur->ip >> 24),
|
||||||
(unsigned char)(cur->ip >> 16),
|
(unsigned char)(cur->ip >> 16),
|
||||||
|
Loading…
Reference in New Issue
Block a user