Module Name:    src
Committed By:   mrg
Date:           Fri Nov 23 08:11:20 UTC 2018

Modified Files:
        src/libexec/httpd: bozohttpd.8 bozohttpd.c cgi-bozo.c content-bozo.c

Log Message:
minor style fixes.  simplify bozo_match_content_map().


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/libexec/httpd/bozohttpd.8
cvs rdiff -u -r1.93 -r1.94 src/libexec/httpd/bozohttpd.c
cvs rdiff -u -r1.43 -r1.44 src/libexec/httpd/cgi-bozo.c
cvs rdiff -u -r1.15 -r1.16 src/libexec/httpd/content-bozo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/bozohttpd.8
diff -u src/libexec/httpd/bozohttpd.8:1.73 src/libexec/httpd/bozohttpd.8:1.74
--- src/libexec/httpd/bozohttpd.8:1.73	Tue Nov 20 01:06:46 2018
+++ src/libexec/httpd/bozohttpd.8	Fri Nov 23 08:11:20 2018
@@ -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 @@ The focus has always been simplicity and
 and regular code audits.
 This manual documents
 .Nm
-version 20181119.
+version 20181123.
 .Sh AUTHORS
 .An -nosplit
 .Nm

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.93 src/libexec/httpd/bozohttpd.c:1.94
--- src/libexec/httpd/bozohttpd.c:1.93	Thu Nov 22 08:54:08 2018
+++ src/libexec/httpd/bozohttpd.c	Fri Nov 23 08:11:20 2018
@@ -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

Index: src/libexec/httpd/cgi-bozo.c
diff -u src/libexec/httpd/cgi-bozo.c:1.43 src/libexec/httpd/cgi-bozo.c:1.44
--- src/libexec/httpd/cgi-bozo.c:1.43	Thu Nov 22 18:42:06 2018
+++ src/libexec/httpd/cgi-bozo.c	Fri Nov 23 08:11:20 2018
@@ -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 @@ finish_cgi_output(bozohttpd_t *httpd, bo
 				"%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 @@ finish_cgi_output(bozohttpd_t *httpd, bo
 			"%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 @@ finish_cgi_output(bozohttpd_t *httpd, bo
 
 		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 @@ parse_search_string(bozo_httpreq_t *requ
 	*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 @@ parse_search_string(bozo_httpreq_t *requ
 		/* 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 @@ bozo_cgi_setbin(bozohttpd_t *httpd, cons
 {
 	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 @@ bozo_process_cgi(bozo_httpreq_t *request
 	} 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);

Index: src/libexec/httpd/content-bozo.c
diff -u src/libexec/httpd/content-bozo.c:1.15 src/libexec/httpd/content-bozo.c:1.16
--- src/libexec/httpd/content-bozo.c:1.15	Tue Nov 20 01:06:46 2018
+++ src/libexec/httpd/content-bozo.c	Fri Nov 23 08:11:20 2018
@@ -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 static_content
 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 @@ search_map(bozo_content_map_t *map, cons
 /* 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;
 }
 
 /*

Reply via email to