mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
1008: Added upload_progress to the connection.
This commit is contained in:
parent
a685470da9
commit
6c0979aae9
@ -470,6 +470,8 @@ done_connection(struct connection *conn)
|
||||
mem_free(conn->socket);
|
||||
mem_free(conn->data_socket);
|
||||
done_progress(conn->progress);
|
||||
if (conn->upload_progress)
|
||||
done_progress(conn->upload_progress);
|
||||
mem_free(conn);
|
||||
check_queue_bugs();
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ struct connection {
|
||||
|
||||
LIST_OF(struct download) downloads;
|
||||
struct progress *progress;
|
||||
struct progress *upload_progress;
|
||||
|
||||
/* If no proxy is used uri and proxied_uri are the same. */
|
||||
struct uri *uri;
|
||||
|
@ -611,6 +611,18 @@ post_length(unsigned char *post_data, unsigned int *count)
|
||||
return size;
|
||||
}
|
||||
|
||||
static void
|
||||
update_upload_progress(struct connection *conn)
|
||||
{
|
||||
struct http_connection_info *http = conn->info;
|
||||
|
||||
assert(conn->upload_progress && http);
|
||||
if_assert_failed return;
|
||||
|
||||
update_progress(conn->upload_progress, http->uploaded,
|
||||
http->total_upload_length, http->uploaded);
|
||||
}
|
||||
|
||||
#define POST_BUFFER_SIZE 4096
|
||||
#define BIG_READ 655360
|
||||
|
||||
@ -1083,6 +1095,10 @@ http_send_header(struct socket *socket)
|
||||
assert(http->post_fd == -1);
|
||||
http->post_data = post_data;
|
||||
socket->state = SOCKET_END_ONCLOSE;
|
||||
if (!conn->upload_progress)
|
||||
conn->upload_progress = init_progress(0);
|
||||
start_update_progress(conn->upload_progress,
|
||||
(void (*)(void *))update_upload_progress, conn);
|
||||
write_to_socket(socket, header.source, header.length, S_TRANS,
|
||||
send_big_files);
|
||||
done_string(&header);
|
||||
|
Loading…
Reference in New Issue
Block a user