1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

fsp: Pass the filesize by ctype (stderr).

This commit is contained in:
Witold Filipczyk 2007-01-18 18:17:59 +01:00 committed by Kalle Olavi Niemitalo
parent b517367cc8
commit ff087c3e06

View File

@ -19,6 +19,9 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include "elinks.h" #include "elinks.h"
@ -201,7 +204,7 @@ do_fsp(struct connection *conn)
/* Use the default way to find the MIME type, so write an /* Use the default way to find the MIME type, so write an
* 'empty' name, since something needs to be written in order * 'empty' name, since something needs to be written in order
* to avoid socket errors. */ * to avoid socket errors. */
fprintf(stderr, "%c", '\0'); fprintf(stderr, "%d\n", (unsigned int)(sb.st_size));
fclose(stderr); fclose(stderr);
while ((r = fsp_fread(buf, 1, READ_SIZE, file)) > 0) 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; error = 1;
mem_free(ctype); mem_free(ctype);
} else { } 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 else