1 Index: boa-0.94.14rc21/src/boa.h
2 ===================================================================
3 --- boa-0.94.14rc21.orig/src/boa.h 2007-11-03 00:51:46.000000000 -0400
4 +++ boa-0.94.14rc21/src/boa.h 2007-11-03 01:05:20.000000000 -0400
9 +/* Important, include before anything else */
13 #include <stdlib.h> /* malloc, free, etc. */
14 #include <stdio.h> /* stdin, stdout, stderr */
16 void clean_pathname(char *pathname);
17 char *get_commonlog_time(void);
18 void rfc822_time_buf(char *buf, time_t s);
19 -char *simple_itoa(unsigned int i);
20 +char *simple_itoa(uint64_t i);
21 int boa_atoi(const char *s);
22 int month2int(const char *month);
23 int modified_since(time_t * mtime, const char *if_modified_since);
24 Index: boa-0.94.14rc21/src/buffer.c
25 ===================================================================
26 --- boa-0.94.14rc21.orig/src/buffer.c 2007-11-03 00:51:46.000000000 -0400
27 +++ boa-0.94.14rc21/src/buffer.c 2007-11-03 01:05:20.000000000 -0400
33 + off_t bytes_written;
35 bytes_written = write(req->fd, req->buffer + req->buffer_start,
37 Index: boa-0.94.14rc21/src/config.h.in
38 ===================================================================
39 --- boa-0.94.14rc21.orig/src/config.h.in 2007-11-03 00:51:46.000000000 -0400
40 +++ boa-0.94.14rc21/src/config.h.in 2007-11-03 01:08:36.000000000 -0400
43 /* Define to `int' if <sys/types.h> doesn't define. */
46 +/* Those enable the LFS ready structures in the system headers */
47 +#define _FILE_OFFSET_BITS 64 /* glibc style */
48 +#define _LARGEFILE_SOURCE 1 /* To make ftello() visible (HP-UX 10.20). */
49 +#define _LARGE_FILES 1 /* Large file defined on AIX-style hosts. */
51 +#define _LARGEFILE64_SOURCE /* tell kernel headers to provide the O_LARGEFILE value */
54 +#define PRINTF_OFF_T_ARG "%ld"
55 +#elif __WORDSIZE == 32
56 +#define PRINTF_OFF_T_ARG "%lld"
58 Index: boa-0.94.14rc21/src/get.c
59 ===================================================================
60 --- boa-0.94.14rc21.orig/src/get.c 2007-11-03 00:51:46.000000000 -0400
61 +++ boa-0.94.14rc21/src/get.c 2007-11-03 01:08:20.000000000 -0400
66 +#include <sys/types.h>
67 +#include <sys/stat.h>
70 #define STR(s) __STR(s)
75 int data_fd, saved_errno;
77 - volatile unsigned int bytes_free;
78 + volatile off_t bytes_free;
80 - data_fd = open(req->pathname, O_RDONLY);
81 + data_fd = open(req->pathname, O_RDONLY|O_LARGEFILE);
82 saved_errno = errno; /* might not get used */
86 memcpy(gzip_pathname, req->pathname, len);
87 memcpy(gzip_pathname + len, ".gz", 3);
88 gzip_pathname[len + 3] = '\0';
89 - data_fd = open(gzip_pathname, O_RDONLY);
90 + data_fd = open(gzip_pathname, O_RDONLY|O_LARGEFILE);
96 int process_get(request * req)
99 - volatile unsigned int bytes_to_write;
100 + off_t bytes_written;
101 + volatile off_t bytes_to_write;
103 if (req->method == M_HEAD) {
104 return complete_response(req);
106 memcpy(pathname_with_index, req->pathname, l1); /* doesn't copy NUL */
107 memcpy(pathname_with_index + l1, directory_index, l2 + 1); /* does */
109 - data_fd = open(pathname_with_index, O_RDONLY);
110 + data_fd = open(pathname_with_index, O_RDONLY|O_LARGEFILE);
112 if (data_fd != -1) { /* user's index file */
113 /* We have to assume that directory_index will fit, because
117 strcat(pathname_with_index, ".gz");
118 - data_fd = open(pathname_with_index, O_RDONLY);
119 + data_fd = open(pathname_with_index, O_RDONLY|O_LARGEFILE);
120 if (data_fd != -1) { /* user's index file */
124 * include the NUL when calculating if the size is enough
126 snprintf(pathname_with_index, sizeof(pathname_with_index),
127 - "%s/dir.%d.%ld", cachedir,
128 + "%s/dir.%d." PRINTF_OFF_T_ARG, cachedir,
129 (int) statbuf->st_dev, statbuf->st_ino);
130 - data_fd = open(pathname_with_index, O_RDONLY);
131 + data_fd = open(pathname_with_index, O_RDONLY|O_LARGEFILE);
133 if (data_fd != -1) { /* index cache */
136 if (index_directory(req, pathname_with_index) == -1)
139 - data_fd = open(pathname_with_index, O_RDONLY); /* Last chance */
140 + data_fd = open(pathname_with_index, O_RDONLY|O_LARGEFILE); /* Last chance */
142 strcpy(req->request_uri, directory_index); /* for mimetype */
143 fstat(data_fd, statbuf);
147 struct dirent *dirbuf;
150 char *escname = NULL;
152 if (chdir(req->pathname) == -1) {
153 Index: boa-0.94.14rc21/src/globals.h
154 ===================================================================
155 --- boa-0.94.14rc21.orig/src/globals.h 2007-11-03 00:51:46.000000000 -0400
156 +++ boa-0.94.14rc21/src/globals.h 2007-11-03 01:05:20.000000000 -0400
160 int data_fd; /* fd of data */
161 - unsigned long filesize; /* filesize */
162 - unsigned long filepos; /* position in file */
163 - unsigned long bytes_written; /* total bytes written (sans header) */
164 + off_t filesize; /* filesize */
165 + off_t filepos; /* position in file */
166 + size_t bytes_written; /* total bytes written (sans header) */
167 char *data_mem; /* mmapped/malloced char array */
169 char *logline; /* line to log file */
170 Index: boa-0.94.14rc21/src/index_dir.c
171 ===================================================================
172 --- boa-0.94.14rc21.orig/src/index_dir.c 2007-11-03 00:51:46.000000000 -0400
173 +++ boa-0.94.14rc21/src/index_dir.c 2007-11-03 01:08:11.000000000 -0400
176 /* $Id: index_dir.c,v 1.32.2.7 2005/02/22 03:00:24 jnelson Exp $*/
180 #include <sys/stat.h>
181 #include <limits.h> /* for PATH_MAX */
182 @@ -266,10 +267,12 @@
184 "<td width=\"40%%\"><a href=\"%s/\">%s/</a></td>"
185 "<td align=right>%s</td>"
186 - "<td align=right>%ld bytes</td>"
191 escaped_filename, html_filename,
192 - ctime(&statbuf.st_mtime), (long) statbuf.st_size);
193 + ctime(&statbuf.st_mtime), (off_t) statbuf.st_size);
197 @@ -312,10 +315,12 @@
198 "<td width=\"40%%\"><a href=\"%s\">%s</a> "
199 "<a href=\"%s.gz\">(.gz)</a></td>"
200 "<td align=right>%s</td>"
201 - "<td align=right>%ld bytes</td>"
206 escaped_filename, html_filename, http_filename,
207 - ctime(&statbuf.st_mtime), (long) statbuf.st_size);
208 + ctime(&statbuf.st_mtime), (off_t) statbuf.st_size);
211 if (html_escape_string(http_filename, escaped_filename,
212 @@ -326,10 +331,12 @@
214 "<td width=\"40%%\"><a href=\"%s\">%s</a></td>"
215 "<td align=right>%s</td>"
216 - "<td align=right>%ld bytes</td>"
221 escaped_filename, html_filename,
222 - ctime(&statbuf.st_mtime), (long) statbuf.st_size);
223 + ctime(&statbuf.st_mtime), (off_t) statbuf.st_size);
227 Index: boa-0.94.14rc21/src/log.c
228 ===================================================================
229 --- boa-0.94.14rc21.orig/src/log.c 2007-11-03 00:51:46.000000000 -0400
230 +++ boa-0.94.14rc21/src/log.c 2007-11-03 01:05:20.000000000 -0400
232 } else if (vhost_root) {
233 printf("%s ", (req->host ? req->host : "(null)"));
235 - printf("%s - - %s\"%s\" %d %ld \"%s\" \"%s\"\n",
236 + printf("%s - - %s\"%s\" %d %zu \"%s\" \"%s\"\n",
238 get_commonlog_time(),
239 req->logline ? req->logline : "-",
240 Index: boa-0.94.14rc21/src/mmap_cache.c
241 ===================================================================
242 --- boa-0.94.14rc21.orig/src/mmap_cache.c 2007-11-03 00:51:46.000000000 -0400
243 +++ boa-0.94.14rc21/src/mmap_cache.c 2007-11-03 01:05:20.000000000 -0400
247 struct mmap_entry *e;
248 - data_fd = open(fname, O_RDONLY);
249 + data_fd = open(fname, O_RDONLY|O_LARGEFILE);
253 Index: boa-0.94.14rc21/src/pipe.c
254 ===================================================================
255 --- boa-0.94.14rc21.orig/src/pipe.c 2007-11-03 01:05:20.000000000 -0400
256 +++ boa-0.94.14rc21/src/pipe.c 2007-11-03 01:05:20.000000000 -0400
259 int read_from_pipe(request * req)
261 - int bytes_read; /* signed */
262 - unsigned int bytes_to_read; /* unsigned */
263 + off_t bytes_read; /* signed */
264 + off_t bytes_to_read; /* unsigned */ /* XXX really? */
266 bytes_to_read = BUFFER_SIZE - (req->header_end - req->buffer - 1);
270 int write_from_pipe(request * req)
273 - size_t bytes_to_write = req->header_end - req->header_line;
274 + off_t bytes_written;
275 + off_t bytes_to_write = req->header_end - req->header_line;
277 if (bytes_to_write == 0) {
278 if (req->cgi_status == CGI_DONE)
281 int io_shuffle_sendfile(request * req)
284 - size_t bytes_to_write;
285 off_t sendfile_offset;
286 + off_t bytes_written;
287 + off_t bytes_to_write;
289 if (req->method == M_HEAD) {
290 return complete_response(req);
293 int io_shuffle(request * req)
296 - int bytes_written, bytes_to_write;
297 + off_t bytes_to_read;
298 + off_t bytes_written, bytes_to_write;
300 if (req->method == M_HEAD) {
301 return complete_response(req);
303 bytes_to_read = bytes_to_write;
305 if (bytes_to_read > 0 && req->data_fd) {
310 temp = lseek(req->data_fd, req->ranges->start, SEEK_SET);
311 Index: boa-0.94.14rc21/src/range.c
312 ===================================================================
313 --- boa-0.94.14rc21.orig/src/range.c 2007-11-03 00:51:46.000000000 -0400
314 +++ boa-0.94.14rc21/src/range.c 2007-11-03 01:05:20.000000000 -0400
316 * 5) start > stop && start != -1 :: invalid
319 - fprintf(stderr, "range.c: ranges_fixup: %lu-%lu\n", r->start, r->stop);
320 + fprintf(stderr, "range.c: ranges_fixup: %lu - %lu\n", r->start, r->stop);
323 /* no stop range specified or stop is too big.
324 Index: boa-0.94.14rc21/src/read.c
325 ===================================================================
326 --- boa-0.94.14rc21.orig/src/read.c 2007-11-03 00:51:46.000000000 -0400
327 +++ boa-0.94.14rc21/src/read.c 2007-11-03 01:05:20.000000000 -0400
330 int read_header(request * req)
334 char *check, *buffer;
340 if (req->content_length) {
341 - int content_length;
342 + off_t content_length;
344 content_length = boa_atoi(req->content_length);
345 /* Is a content-length of 0 legal? */
347 && content_length > single_post_limit) {
350 - "Content-Length [%d] > SinglePostLimit [%d] on POST!\n",
351 + "Content-Length [" PRINTF_OFF_T_ARG "] > SinglePostLimit [%d] on POST!\n",
352 content_length, single_post_limit);
353 send_r_bad_request(req);
357 if (req->status < BODY_READ) {
358 /* only reached if request is split across more than one packet */
359 - unsigned int buf_bytes_left;
360 + off_t buf_bytes_left;
362 buf_bytes_left = CLIENT_STREAM_SIZE - req->client_stream_pos;
363 if (buf_bytes_left < 1 || buf_bytes_left > CLIENT_STREAM_SIZE) {
365 DEBUG(DEBUG_HEADER_READ) {
367 req->client_stream[req->client_stream_pos] = '\0';
368 - fprintf(stderr, "%s:%d -- We read %d bytes: \"%s\"\n",
369 + fprintf(stderr, "%s:%d -- We read " PRINTF_OFF_T_ARG " bytes: \"%s\"\n",
370 __FILE__, __LINE__, bytes,
371 #ifdef VERY_FASCIST_LOGGING2
372 req->client_stream + req->client_stream_pos - bytes
375 int read_body(request * req)
378 - unsigned int bytes_to_read, bytes_free;
380 + off_t bytes_to_read, bytes_free;
382 bytes_free = BUFFER_SIZE - (req->header_end - req->header_line);
383 bytes_to_read = req->filesize - req->filepos;
386 int write_body(request * req)
389 - unsigned int bytes_to_write = req->header_end - req->header_line;
390 + off_t bytes_written;
391 + off_t bytes_to_write = req->header_end - req->header_line;
393 if (req->filepos + bytes_to_write > req->filesize)
394 bytes_to_write = req->filesize - req->filepos;
397 DEBUG(DEBUG_HEADER_READ) {
399 - fprintf(stderr, "%s:%d - wrote %d bytes of CGI body. %ld of %ld\n",
400 + fprintf(stderr, "%s:%d - wrote " PRINTF_OFF_T_ARG " bytes of CGI body. " PRINTF_OFF_T_ARG " of " PRINTF_OFF_T_ARG "\n",
402 bytes_written, req->filepos, req->filesize);
406 req->header_line[bytes_written] = '\0';
408 - "%s:%d - wrote %d bytes (%s). %lu of %lu\n",
409 + "%s:%d - wrote " PRINTF_OFF_T_ARG " bytes (%s). " PRINTF_OFF_T_ARG " of " PRINTF_OFF_T_ARG "\n",
410 __FILE__, __LINE__, bytes_written,
411 req->header_line, req->filepos, req->filesize);
412 req->header_line[bytes_written] = c;
413 Index: boa-0.94.14rc21/src/request.c
414 ===================================================================
415 --- boa-0.94.14rc21.orig/src/request.c 2007-11-03 00:51:46.000000000 -0400
416 +++ boa-0.94.14rc21/src/request.c 2007-11-03 01:05:20.000000000 -0400
417 @@ -259,14 +259,14 @@
419 static void sanitize_request(request * req, int new_req)
421 - static unsigned int bytes_to_zero = offsetof(request, fd);
422 + static off_t bytes_to_zero = offsetof(request, fd);
425 req->kacount = ka_max;
426 req->time_last = current_time;
427 req->client_stream_pos = 0;
429 - unsigned int bytes_to_move =
430 + off_t bytes_to_move =
431 req->client_stream_pos - req->parse_pos;
436 DEBUG(DEBUG_REQUEST) {
438 - fprintf(stderr, "req: %p, offset: %u\n", (void *) req,
439 + fprintf(stderr, "req: %p, offset: " PRINTF_OFF_T_ARG "\n", (void *) req,
443 Index: boa-0.94.14rc21/src/util.c
444 ===================================================================
445 --- boa-0.94.14rc21.orig/src/util.c 2007-11-03 01:05:20.000000000 -0400
446 +++ boa-0.94.14rc21/src/util.c 2007-11-03 01:05:20.000000000 -0400
448 memcpy(p, day_tab + t->tm_wday * 4, 4);
451 -char *simple_itoa(unsigned int i)
452 +char *simple_itoa(uint64_t i)
454 /* 21 digits plus null terminator, good for 64-bit or smaller ints
455 * for bigger ints, use a bigger buffer!