aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@esdenera.com>2015-06-20 13:48:43 +0200
committerReyk Floeter <reyk@esdenera.com>2015-06-20 13:48:43 +0200
commit43aa296392eea581bb39cdc1b3d0a282164c05c6 (patch)
tree073401ba96ebb819435ced7268a791b80ec2864a
parentfbefc9a818a5ed612c0df918598057a8b551cb95 (diff)
downloadhttpd-43aa296392eea581bb39cdc1b3d0a282164c05c6.tar.gz
httpd-43aa296392eea581bb39cdc1b3d0a282164c05c6.zip
sync with -current
-rw-r--r--httpd/control.c3
-rw-r--r--httpd/http.h8
-rw-r--r--httpd/httpd.c18
-rw-r--r--httpd/httpd.conf.532
-rw-r--r--httpd/httpd.h4
-rw-r--r--httpd/server_fcgi.c5
-rw-r--r--httpd/server_http.c6
7 files changed, 39 insertions, 37 deletions
diff --git a/httpd/control.c b/httpd/control.c
index fe60375..5c71545 100644
--- a/httpd/control.c
+++ b/httpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.6 2015/01/21 22:21:05 reyk Exp $ */
+/* $OpenBSD: control.c,v 1.7 2015/05/28 17:08:08 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -126,7 +126,6 @@ control_cleanup(struct control_sock *cs)
return;
event_del(&cs->cs_ev);
event_del(&cs->cs_evt);
- (void)unlink(cs->cs_name);
}
/* ARGSUSED */
diff --git a/httpd/http.h b/httpd/http.h
index 00cf235..9042342 100644
--- a/httpd/http.h
+++ b/httpd/http.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: http.h,v 1.12 2015/02/11 12:52:01 florian Exp $ */
+/* $OpenBSD: http.h,v 1.13 2015/06/11 18:49:09 reyk Exp $ */
/*
* Copyright (c) 2012 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -16,8 +16,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef _HTTP_H
-#define _HTTP_H
+#ifndef HTTP_H
+#define HTTP_H
#define HTTP_PORT 80
#define HTTPS_PORT 443
@@ -250,4 +250,4 @@ struct http_descriptor {
struct kvtree http_headers;
};
-#endif /* _HTTP_H */
+#endif /* HTTP_H */
diff --git a/httpd/httpd.c b/httpd/httpd.c
index c6f183f..5f6788c 100644
--- a/httpd/httpd.c
+++ b/httpd/httpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.c,v 1.35 2015/02/23 18:43:18 reyk Exp $ */
+/* $OpenBSD: httpd.c,v 1.37 2015/06/03 02:24:36 millert Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
@@ -80,6 +80,8 @@ parent_sig_handler(int sig, short event, void *arg)
/* FALLTHROUGH */
case SIGCHLD:
do {
+ int len;
+
pid = waitpid(WAIT_ANY, &status, WNOHANG);
if (pid <= 0)
continue;
@@ -87,17 +89,21 @@ parent_sig_handler(int sig, short event, void *arg)
fail = 0;
if (WIFSIGNALED(status)) {
fail = 1;
- asprintf(&cause, "terminated; signal %d",
+ len = asprintf(&cause, "terminated; signal %d",
WTERMSIG(status));
} else if (WIFEXITED(status)) {
if (WEXITSTATUS(status) != 0) {
fail = 1;
- asprintf(&cause, "exited abnormally");
+ len = asprintf(&cause,
+ "exited abnormally");
} else
- asprintf(&cause, "exited okay");
+ len = asprintf(&cause, "exited okay");
} else
fatalx("unexpected cause of SIGCHLD");
+ if (len == -1)
+ fatal("asprintf");
+
die = 1;
for (id = 0; id < PROC_MAX; id++)
@@ -210,7 +216,7 @@ main(int argc, char *argv[])
errx(1, "unknown user %s", HTTPD_USER);
/* Configure the control socket */
- ps->ps_csock.cs_name = HTTPD_SOCKET;
+ ps->ps_csock.cs_name = NULL;
log_init(debug);
log_verbose(verbose);
@@ -404,6 +410,8 @@ parent_shutdown(struct httpd *env)
proc_kill(env->sc_ps);
control_cleanup(&env->sc_ps->ps_csock);
+ if (env->sc_ps->ps_csock.cs_name != NULL)
+ (void)unlink(env->sc_ps->ps_csock.cs_name);
free(env->sc_ps);
free(env);
diff --git a/httpd/httpd.conf.5 b/httpd/httpd.conf.5
index 26d6798..87866d2 100644
--- a/httpd/httpd.conf.5
+++ b/httpd/httpd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: httpd.conf.5,v 1.57 2015/03/26 19:16:57 jmc Exp $
+.\" $OpenBSD: httpd.conf.5,v 1.61 2015/05/28 19:29:40 jmc Exp $
.\"
.\" Copyright (c) 2014, 2015 Reyk Floeter <reyk@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: March 26 2015 $
+.Dd $Mdocdate: May 28 2015 $
.Dt HTTPD.CONF 5
.Os
.Sh NAME
@@ -152,7 +152,7 @@ Use the
directive to disable authentication in a location.
.It Ic block drop
Drop the connection without sending an error page.
-.It Ic block Op Ic return Ar code Op uri
+.It Ic block Op Ic return Ar code Op Ar uri
Close the connection and send an error page.
If the optional return code is not specified,
.Xr httpd 8
@@ -166,7 +166,7 @@ argument can be used with return codes in the 3xx range to send a
header for redirection to a specified URI.
.Pp
The
-.Ar url
+.Ar uri
may contain predefined macros that will be expanded at runtime:
.Pp
.Bl -tag -width $DOCUMENT_URI -offset indent -compact
@@ -451,14 +451,14 @@ server "default" {
}
types {
- text/css css
- text/html htm html
- text/txt txt
- image/gif gif
- image/jpeg jpg jpeg
- image/png png
- application/javascript js
- application/xml xml
+ text/css css
+ text/html html htm
+ text/txt txt
+ image/gif gif
+ image/jpeg jpeg jpg
+ image/png png
+ application/javascript js
+ application/xml xml
}
.Ed
.Pp
@@ -514,14 +514,6 @@ server "www.example.com" {
listen on 10.0.0.1 port 80
}
.Ed
-.Pp
-The syntax of the types section is also compatible with the format
-used by nginx, so it is possible to include its
-.Pa mime.types
-file directly:
-.Bd -literal -offset indent
-include "/etc/nginx/mime.types"
-.Ed
.Sh SEE ALSO
.Xr htpasswd 1 ,
.Xr httpd 8 ,
diff --git a/httpd/httpd.h b/httpd/httpd.h
index 50f300a..1431eaa 100644
--- a/httpd/httpd.h
+++ b/httpd/httpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: httpd.h,v 1.82 2015/03/15 22:08:45 florian Exp $ */
+/* $OpenBSD: httpd.h,v 1.83 2015/05/20 09:28:47 kettenis Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -557,7 +557,7 @@ int server_headers(struct client *, void *,
int (*)(struct client *, struct kv *, void *), void *);
int server_writeresponse_http(struct client *);
int server_response_http(struct client *, u_int, struct media_type *,
- size_t, time_t);
+ off_t, time_t);
void server_reset_http(struct client *);
void server_close_http(struct client *);
int server_response(struct httpd *, struct client *);
diff --git a/httpd/server_fcgi.c b/httpd/server_fcgi.c
index d0a8800..c91c98b 100644
--- a/httpd/server_fcgi.c
+++ b/httpd/server_fcgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_fcgi.c,v 1.53 2015/03/26 09:01:51 florian Exp $ */
+/* $OpenBSD: server_fcgi.c,v 1.54 2015/06/09 08:50:52 jung Exp $ */
/*
* Copyright (c) 2014 Florian Obser <florian@openbsd.org>
@@ -32,6 +32,7 @@
#include <time.h>
#include <ctype.h>
#include <event.h>
+#include <unistd.h>
#include "httpd.h"
#include "http.h"
@@ -153,7 +154,9 @@ server_fcgi(struct httpd *env, struct client *clt)
goto fail;
}
+ close(clt->clt_fd);
clt->clt_fd = fd;
+
if (clt->clt_srvbev != NULL)
bufferevent_free(clt->clt_srvbev);
diff --git a/httpd/server_http.c b/httpd/server_http.c
index 7b65a5e..99d5267 100644
--- a/httpd/server_http.c
+++ b/httpd/server_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_http.c,v 1.79 2015/05/03 18:39:58 florian Exp $ */
+/* $OpenBSD: server_http.c,v 1.80 2015/05/20 09:28:47 kettenis Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -1133,7 +1133,7 @@ server_getlocation(struct client *clt, const char *path)
int
server_response_http(struct client *clt, u_int code,
- struct media_type *media, size_t size, time_t mtime)
+ struct media_type *media, off_t size, time_t mtime)
{
struct http_descriptor *desc = clt->clt_descreq;
struct http_descriptor *resp = clt->clt_descresp;
@@ -1174,7 +1174,7 @@ server_response_http(struct client *clt, u_int code,
/* Set content length, if specified */
if ((cl =
kv_add(&resp->http_headers, "Content-Length", NULL)) == NULL ||
- kv_set(cl, "%ld", size) == -1)
+ kv_set(cl, "%lld", (long long)size) == -1)
return (-1);
/* Set last modification time */