Hello, I had nothing better to do tonight after work so I read a little in httpd. I have come up with a patch for i386 and any architecture where off_t != size_t.
So on i386 there is this: uranus$ ./sizetest off_t = 8 size_t = 4 and I have these files in a directory: uranus$ ls -lhi total 12672 364207 -rw-r--r-- 3 root daemon 4.9G Jan 15 21:06 output.txt 364207 -rw-r--r-- 3 root daemon 4.9G Jan 15 21:06 output2.txt 364207 -rw-r--r-- 3 root daemon 4.9G Jan 15 21:06 output3.txt A download (cancelled, but it doesn't matter) of the httpd without my patch looks like so: default 192.168.1.127 - - [15/Jan/2016:21:11:55 +0100] "GET /public/output2.txt HTTP/1.1" 200 948961280 "http://192.168.1.1/public/" "Mozilla/5.0 (X11; OpenBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" A download (cancelled again) of the httpd with my patch looks like so: default 192.168.1.127 - - [15/Jan/2016:21:18:07 +0100] "GET /public/output3.txt HTTP/1.1" 200 5243928576 "http://192.168.1.1/public/" "Mozilla/5.0 (X11; OpenBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36" It looks accurate in this case. Checking again with ls: uranus$ ls -li output3.txt 364207 -rw-r--r-- 3 root daemon 5243928576 Jan 15 21:06 output3.txt Absolutely. patch follows: Cheers, -peter ? httpd.patch Index: httpd.h =================================================================== RCS file: /cvs/src/usr.sbin/httpd/httpd.h,v retrieving revision 1.96 diff -u -p -u -r1.96 httpd.h --- httpd.h 3 Aug 2015 11:45:17 -0000 1.96 +++ httpd.h 15 Jan 2016 20:19:12 -0000 @@ -602,7 +602,7 @@ const char * server_http_host(struct sockaddr_storage *, char *, size_t); char *server_http_parsehost(char *, char *, size_t, int *); ssize_t server_http_time(time_t, char *, size_t); -int server_log_http(struct client *, u_int, size_t); +int server_log_http(struct client *, u_int, off_t); /* server_file.c */ int server_file(struct httpd *, struct client *); Index: server_http.c =================================================================== RCS file: /cvs/src/usr.sbin/httpd/server_http.c,v retrieving revision 1.96 diff -u -p -u -r1.96 server_http.c --- server_http.c 31 Jul 2015 00:10:51 -0000 1.96 +++ server_http.c 15 Jan 2016 20:19:12 -0000 @@ -1450,7 +1450,7 @@ server_httperror_cmp(const void *a, cons } int -server_log_http(struct client *clt, u_int code, size_t len) +server_log_http(struct client *clt, u_int code, off_t len) { static char tstamp[64]; static char ip[INET6_ADDRSTRLEN]; @@ -1511,7 +1511,7 @@ server_log_http(struct client *clt, u_in goto done; ret = evbuffer_add_printf(clt->clt_log, - "%s %s - %s [%s] \"%s %s%s%s%s%s\" %03d %zu\n", + "%s %s - %s [%s] \"%s %s%s%s%s%s\" %03d %qu\n", srv_conf->name, ip, clt->clt_remote_user == NULL ? "-" : user, tstamp, server_httpmethod_byid(desc->http_method), @@ -1559,7 +1559,7 @@ server_log_http(struct client *clt, u_in ret = evbuffer_add_printf(clt->clt_log, "%s %s - %s [%s] \"%s %s%s%s%s%s\"" - " %03d %zu \"%s\" \"%s\"\n", + " %03d %qu \"%s\" \"%s\"\n", srv_conf->name, ip, clt->clt_remote_user == NULL ? "-" : user, tstamp, server_httpmethod_byid(desc->http_method),
