From d49a53b2a93dd2d12783f83d1734b709fea8f0da Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Thu, 18 Jan 2007 18:17:59 +0100 Subject: [PATCH] fsp: Pass the filesize by ctype (stderr). --- src/protocol/fsp/fsp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/protocol/fsp/fsp.c b/src/protocol/fsp/fsp.c index 2ccd79db..f7d098e8 100644 --- a/src/protocol/fsp/fsp.c +++ b/src/protocol/fsp/fsp.c @@ -19,6 +19,9 @@ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_NETINET_IN_H +#include +#endif #include "elinks.h" @@ -201,7 +204,7 @@ do_fsp(struct connection *conn) /* Use the default way to find the MIME type, so write an * 'empty' name, since something needs to be written in order * to avoid socket errors. */ - fprintf(stderr, "%c", '\0'); + fprintf(stderr, "%d\n", (unsigned int)(sb.st_size)); fclose(stderr); while ((r = fsp_fread(buf, 1, READ_SIZE, file)) > 0) @@ -291,7 +294,11 @@ fsp_got_header(struct socket *socket, struct read_buffer *rb) error = 1; mem_free(ctype); } else { - mem_free_set(&conn->cached->content_type, ctype); + if (ctype[0] >= '0' && ctype[0] <= '9') { + conn->est_length = (off_t)atoi(ctype); + mem_free(ctype); + } + else mem_free_set(&conn->cached->content_type, ctype); } } else