diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-05-20 09:28:48 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-05-20 09:28:48 +0000 |
commit | a1bb22e082bc6c044f3cc6766b287df2dd17a740 (patch) | |
tree | d29be391ee57e76030c25bc21c6f8752de20dfb3 /usr.sbin/httpd | |
parent | 3b7ec84b5ee80f37de3b360cc79ffa81028d91ee (diff) |
Use off_t instead of size_t to pass file size and print it using %lld when
constructing the Content-Length header field. Should fix some, but probably
not all, problems with serving files bigger than 2G on 32-bit architectures.
ok reyk@, florian@
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r-- | usr.sbin/httpd/httpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/server_http.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index 50f300a468d..1431eaa2c9e 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/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/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c index 7b65a5e1777..99d52674790 100644 --- a/usr.sbin/httpd/server_http.c +++ b/usr.sbin/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 */ |