1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-01 03:36:26 -04:00

1008: HTTP upload counters are off_t, not size_t.

So that ELinks can upload files larger than 4 GiB even if size_t is
32-bit.
This commit is contained in:
Kalle Olavi Niemitalo 2008-05-21 08:20:03 +03:00 committed by Kalle Olavi Niemitalo
parent 3b5e10d3da
commit 2256a8c94a
2 changed files with 8 additions and 8 deletions

View File

@ -580,10 +580,10 @@ accept_encoding_header(struct string *header)
}
/* This sets the Content-Length of POST data and counts files. */
static size_t
static off_t
post_length(unsigned char *post_data, unsigned int *count)
{
size_t size = 0;
off_t size = 0;
size_t length = strlen(post_data);
unsigned char *end = post_data;
@ -1109,7 +1109,7 @@ http_send_header(struct socket *socket)
* as set by get_form_uri(). This '\n' is dropped if any
* and replaced by correct '\r\n' termination here. */
unsigned char *postend = strchr(uri->post, '\n');
size_t size;
off_t size;
if (postend) {
add_to_string(&header, "Content-Type: ");
@ -1118,11 +1118,11 @@ http_send_header(struct socket *socket)
}
post_data = postend ? postend + 1 : uri->post;
add_to_string(&header, "Content-Length: ");
size = post_length(post_data, &files);
http->total_upload_length = size;
add_long_to_string(&header, size);
add_crlf_to_string(&header);
add_format_to_string(&header, "Content-Length: "
"%" OFF_PRINT_FORMAT "\x0D\x0A",
(off_print_T) size);
}
#ifdef CONFIG_COOKIES

View File

@ -28,10 +28,10 @@ struct http_connection_info {
int code;
/** Total size of the POST body to be uploaded */
size_t total_upload_length;
off_t total_upload_length;
/** Amount of POST body data uploaded so far */
size_t uploaded;
off_t uploaded;
/** Points to the next byte to be read from connection.uri->post.
* Does not point to const because http_read_post() momentarily