summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd/server_http.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-05-20 09:28:48 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2015-05-20 09:28:48 +0000
commita1bb22e082bc6c044f3cc6766b287df2dd17a740 (patch)
treed29be391ee57e76030c25bc21c6f8752de20dfb3 /usr.sbin/httpd/server_http.c
parent3b7ec84b5ee80f37de3b360cc79ffa81028d91ee (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/server_http.c')
-rw-r--r--usr.sbin/httpd/server_http.c6
1 files changed, 3 insertions, 3 deletions
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 */