That does indeed fix the content length in the header.  Thanks!

On Tue, May 19, 2015 at 06:08:37PM +0200, Mark Kettenis wrote:
> > The problem seems to be either low-memory or i386 related.  I tested on
> > an amd64 machine with 3GB RAM, and the problem goes away with 2+ GB
> > files.
> 
> Does the diff below fix the issue?
> 
> Index: httpd.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/httpd/httpd.h,v
> retrieving revision 1.82
> diff -u -p -r1.82 httpd.h
> --- httpd.h   15 Mar 2015 22:08:45 -0000      1.82
> +++ httpd.h   19 May 2015 15:58:12 -0000
> @@ -557,7 +557,7 @@ int        server_headers(struct client *, voi
>           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 *);
> Index: server_http.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/httpd/server_http.c,v
> retrieving revision 1.79
> diff -u -p -r1.79 server_http.c
> --- server_http.c     3 May 2015 18:39:58 -0000       1.79
> +++ server_http.c     19 May 2015 15:58:12 -0000
> @@ -1133,7 +1133,7 @@ server_getlocation(struct client *clt, c
>  
>  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,
>       /* 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", size) == -1)
>               return (-1);
>  
>       /* Set last modification time */

Reply via email to