Commit Diff


commit - 0baf6bed2a419b617d47e27c4687fccb1e721e49
commit + 07b0a14218f3779013d657d5e737c4a2e739a9eb
blob - a60d7c0a55f19c7fa56a947d1abd7f3618467f89
blob + 3df7bfb4bb72151709bcaed4c2ef346d47d159d1
--- gmid.h
+++ gmid.h
@@ -176,13 +176,13 @@ const char	*mime(struct vhost*, const char*);
 
 /* server.c */
 int		 check_path(struct client*, const char*, int*);
-int		 open_file(struct pollfd*, struct client*);
-int		 check_for_cgi(char *, char*, struct pollfd*, struct client*);
+void		 open_file(struct pollfd*, struct client*);
+void		 check_for_cgi(char *, char*, struct pollfd*, struct client*);
 void		 mark_nonblock(int);
 void		 handle_handshake(struct pollfd*, struct client*);
 void		 handle_open_conn(struct pollfd*, struct client*);
 void		 start_reply(struct pollfd*, struct client*, int, const char*);
-int		 start_cgi(const char*, const char*, const char*, struct pollfd*, struct client*);
+void		 start_cgi(const char*, const char*, const char*, struct pollfd*, struct client*);
 void		 send_file(struct pollfd*, struct client*);
 void		 send_dir(struct pollfd*, struct client*);
 void		 cgi_poll_on_child(struct pollfd*, struct client*);
blob - 4de3a7daccf45cf8e6aa56f61b5494aed92d8aa1
blob + 59760b3804a3f834b19d459916cb04956b9b30f9
--- server.c
+++ server.c
@@ -64,13 +64,15 @@ check_path(struct client *c, const char *path, int *fd
 	return FILE_EXISTS;
 }
 
-int
+void
 open_file(struct pollfd *fds, struct client *c)
 {
 	switch (check_path(c, c->iri.path, &c->fd)) {
 	case FILE_EXECUTABLE:
-		if (c->host->cgi != NULL && starts_with(c->iri.path, c->host->cgi))
-			return start_cgi(c->iri.path, "", c->iri.query, fds, c);
+		if (c->host->cgi != NULL && starts_with(c->iri.path, c->host->cgi)) {
+			start_cgi(c->iri.path, "", c->iri.query, fds, c);
+			return;
+		}
 
 		/* fallthrough */
 
@@ -78,31 +80,33 @@ open_file(struct pollfd *fds, struct client *c)
 		if ((c->len = filesize(c->fd)) == -1) {
 			LOGE(c, "failed to get file size for %s", c->iri.path);
 			close_conn(fds, c);
-			return 0;
+			return;
 		}
 
 		if ((c->buf = mmap(NULL, c->len, PROT_READ, MAP_PRIVATE,
 			    c->fd, 0)) == MAP_FAILED) {
 			LOGW(c, "mmap: %s: %s", c->iri.path, strerror(errno));
 			close_conn(fds, c);
-			return 0;
+			return;
 		}
 		c->i = c->buf;
 		c->next = S_SENDING_FILE;
 		start_reply(fds, c, SUCCESS, mime(c->host, c->iri.path));
-		return 0;
+		return;
 
 	case FILE_DIRECTORY:
 		close(c->fd);
 		c->fd = -1;
 		send_dir(fds, c);
-		return 0;
+		return;
 
 	case FILE_MISSING:
-		if (c->host->cgi != NULL && starts_with(c->iri.path, c->host->cgi))
-			return check_for_cgi(c->iri.path, c->iri.query, fds, c);
+		if (c->host->cgi != NULL && starts_with(c->iri.path, c->host->cgi)) {
+			check_for_cgi(c->iri.path, c->iri.query, fds, c);
+			return;
+		}
 		start_reply(fds, c, NOT_FOUND, "not found");
-		return 0;
+		return;
 
 	default:
 		/* unreachable */
@@ -118,7 +122,7 @@ open_file(struct pollfd *fds, struct client *c)
  * from the end and strip one component at a time, until either an
  * executable is found or we emptied the path.
  */
-int
+void
 check_for_cgi(char *path, char *query, struct pollfd *fds, struct client *c)
 {
 	char *end;
@@ -136,7 +140,8 @@ check_for_cgi(char *path, char *query, struct pollfd *
 
 		switch (check_path(c, path, &c->fd)) {
 		case FILE_EXECUTABLE:
-			return start_cgi(path, end+1, query, fds,c);
+			start_cgi(path, end+1, query, fds,c);
+			return;
 		case FILE_MISSING:
 			break;
 		default:
@@ -149,7 +154,7 @@ check_for_cgi(char *path, char *query, struct pollfd *
 
 err:
 	start_reply(fds, c, NOT_FOUND, "not found");
-	return 0;
+	return;
 }
 
 void
@@ -291,7 +296,7 @@ start_reply(struct pollfd *pfd, struct client *c, int 
 	handle(pfd, c);
 }
 
-int
+void
 start_cgi(const char *spath, const char *relpath, const char *query,
     struct pollfd *fds, struct client *c)
 {
@@ -329,13 +334,13 @@ start_cgi(const char *spath, const char *relpath, cons
 	close(c->fd);
 	if ((c->fd = recv_fd(exfd)) == -1) {
 		start_reply(fds, c, TEMP_FAILURE, "internal server error");
-		return 0;
+		return;
 	}
 	c->state = S_SENDING_CGI;
 	cgi_poll_on_child(fds, c);
 	c->code = -1;
 	/* handle_cgi(fds, c); */
-	return 0;
+	return;
 
 err:
 	/* fatal("cannot talk to the executor process: %s", strerror(errno)); */