Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/httpd minor style fixes. simplify bozo_match_conten...
details: https://anonhg.NetBSD.org/src/rev/a4cf26d023c1
branches: trunk
changeset: 994811:a4cf26d023c1
user: mrg <mrg%NetBSD.org@localhost>
date: Fri Nov 23 08:11:20 2018 +0000
description:
minor style fixes. simplify bozo_match_content_map().
diffstat:
libexec/httpd/bozohttpd.8 | 4 ++--
libexec/httpd/bozohttpd.c | 5 ++---
libexec/httpd/cgi-bozo.c | 17 ++++++++---------
libexec/httpd/content-bozo.c | 19 ++++++++-----------
4 files changed, 20 insertions(+), 25 deletions(-)
diffs (157 lines):
diff -r a38baf6e0dff -r a4cf26d023c1 libexec/httpd/bozohttpd.8
--- a/libexec/httpd/bozohttpd.8 Fri Nov 23 06:31:57 2018 +0000
+++ b/libexec/httpd/bozohttpd.8 Fri Nov 23 08:11:20 2018 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: bozohttpd.8,v 1.73 2018/11/20 01:06:46 mrg Exp $
+.\" $NetBSD: bozohttpd.8,v 1.74 2018/11/23 08:11:20 mrg Exp $
.\"
.\" $eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $
.\"
@@ -599,7 +599,7 @@
and regular code audits.
This manual documents
.Nm
-version 20181119.
+version 20181123.
.Sh AUTHORS
.An -nosplit
.Nm
diff -r a38baf6e0dff -r a4cf26d023c1 libexec/httpd/bozohttpd.c
--- a/libexec/httpd/bozohttpd.c Fri Nov 23 06:31:57 2018 +0000
+++ b/libexec/httpd/bozohttpd.c Fri Nov 23 08:11:20 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bozohttpd.c,v 1.93 2018/11/22 08:54:08 mrg Exp $ */
+/* $NetBSD: bozohttpd.c,v 1.94 2018/11/23 08:11:20 mrg Exp $ */
/* $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $ */
@@ -109,9 +109,8 @@
#define INDEX_HTML "index.html"
#endif
#ifndef SERVER_SOFTWARE
-#define SERVER_SOFTWARE "bozohttpd/20181122"
+#define SERVER_SOFTWARE "bozohttpd/20181123"
#endif
-
#ifndef PUBLIC_HTML
#define PUBLIC_HTML "public_html"
#endif
diff -r a38baf6e0dff -r a4cf26d023c1 libexec/httpd/cgi-bozo.c
--- a/libexec/httpd/cgi-bozo.c Fri Nov 23 06:31:57 2018 +0000
+++ b/libexec/httpd/cgi-bozo.c Fri Nov 23 08:11:20 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgi-bozo.c,v 1.43 2018/11/22 18:42:06 mrg Exp $ */
+/* $NetBSD: cgi-bozo.c,v 1.44 2018/11/23 08:11:20 mrg Exp $ */
/* $eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $ */
@@ -147,7 +147,7 @@
"%s: writing HTTP header "
"from status %s ..", __func__, hdr_value));
bozo_printf(httpd, "%s %s\r\n", request->hr_proto,
- hdr_value);
+ hdr_value);
bozo_flush(httpd, stdout);
write_header = 0;
free(hdr_name);
@@ -174,7 +174,7 @@
"%s: writing delayed HTTP headers ..", __func__));
SIMPLEQ_FOREACH_SAFE(hdr, &headers, h_next, nhdr) {
bozo_printf(httpd, "%s: %s\r\n", hdr->h_header,
- hdr->h_value);
+ hdr->h_value);
free(hdr->h_header);
free(hdr);
}
@@ -190,7 +190,7 @@
while (rbytes) {
wbytes = bozo_write(httpd, STDOUT_FILENO, buf,
- (size_t)rbytes);
+ (size_t)rbytes);
if (wbytes > 0) {
rbytes -= wbytes;
bp += wbytes;
@@ -223,9 +223,8 @@
*args_len = 0;
/* URI MUST not contain any unencoded '=' - RFC3875, section 4.4 */
- if (strchr(query, '=')) {
+ if (strchr(query, '='))
return NULL;
- }
str = bozostrdup(httpd, request, query);
@@ -289,7 +288,7 @@
/* search-word MUST have at least one schar */
if (*s == '\0')
goto parse_err;
- while(*s) {
+ while (*s) {
/* check if it's unreserved */
if (isalpha((int)*s) || isdigit((int)*s) ||
strchr(UNRESERVED_CHAR, *s)) {
@@ -348,7 +347,7 @@
{
httpd->cgibin = bozostrdup(httpd, NULL, path);
debug((httpd, DEBUG_OBESE, "cgibin (cgi-bin directory) is %s",
- httpd->cgibin));
+ httpd->cgibin));
}
/* help build up the environ pointer */
@@ -444,7 +443,7 @@
} else if (len - 1 == CGIBIN_PREFIX_LEN) /* url is "/cgi-bin/" */
append_index_html(httpd, &file);
- /* RFC3875 sect. 4.4. - search-string support */
+ /* RFC3875 sect. 4.4. - search-string support */
if (query != NULL) {
search_string_argv = parse_search_string(request, query,
&search_string_argc);
diff -r a38baf6e0dff -r a4cf26d023c1 libexec/httpd/content-bozo.c
--- a/libexec/httpd/content-bozo.c Fri Nov 23 06:31:57 2018 +0000
+++ b/libexec/httpd/content-bozo.c Fri Nov 23 08:11:20 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: content-bozo.c,v 1.15 2018/11/20 01:06:46 mrg Exp $ */
+/* $NetBSD: content-bozo.c,v 1.16 2018/11/23 08:11:20 mrg Exp $ */
/* $eterna: content-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $ */
@@ -181,6 +181,7 @@
static bozo_content_map_t *
search_map(bozo_content_map_t *map, const char *name, size_t len)
{
+
for ( ; map && map->name; map++) {
const size_t namelen = strlen(map->name);
@@ -194,21 +195,17 @@
/* match a suffix on a file - dynamiconly means no static content search */
bozo_content_map_t *
bozo_match_content_map(bozohttpd_t *httpd, const char *name,
- const int dynamiconly)
+ const int dynamiconly)
{
bozo_content_map_t *map;
size_t len;
len = strlen(name);
- if ((map = search_map(httpd->dynamic_content_map, name, len)) != NULL) {
- return map;
- }
- if (!dynamiconly) {
- if ((map = search_map(static_content_map, name, len)) != NULL) {
- return map;
- }
- }
- return NULL;
+ map = search_map(httpd->dynamic_content_map, name, len);
+ if (map == NULL && !dynamiconly)
+ map = search_map(static_content_map, name, len);
+
+ return map;
}
/*
Home |
Main Index |
Thread Index |
Old Index