mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-30 03:26:23 -04:00
Revert "decompress_data: count bytes written to the pipe"
This reverts commit da5eed4dba
.
This commit is contained in:
parent
c1992b2f3d
commit
f0aa3909b1
@ -378,7 +378,6 @@ shutdown_connection_stream(struct connection *conn)
|
||||
if (conn->stream_pipes[1] >= 0)
|
||||
close(conn->stream_pipes[1]);
|
||||
conn->stream_pipes[0] = conn->stream_pipes[1] = -1;
|
||||
conn->stream_pipes_written = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -53,8 +53,6 @@ struct connection {
|
||||
int tries;
|
||||
timer_id_T timer;
|
||||
int stream_pipes[2];
|
||||
/* The number of bytes actually in the pipe. */
|
||||
int stream_pipes_written;
|
||||
|
||||
unsigned int running:1;
|
||||
unsigned int unrestartable:1;
|
||||
|
@ -1016,13 +1016,11 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
|
||||
|
||||
*new_len = 0; /* new_len must be zero if we would ever return NULL */
|
||||
|
||||
if (conn->stream_pipes[0] == -1) {
|
||||
if (c_pipe(conn->stream_pipes) < 0
|
||||
if (conn->stream_pipes[0] == -1
|
||||
&& (c_pipe(conn->stream_pipes) < 0
|
||||
|| set_nonblocking_fd(conn->stream_pipes[0]) < 0
|
||||
|| set_nonblocking_fd(conn->stream_pipes[1]) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
conn->stream_pipes_written = 0;
|
||||
|| set_nonblocking_fd(conn->stream_pipes[1]) < 0)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
@ -1031,15 +1029,13 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
|
||||
if (state == NORMAL) {
|
||||
/* ... we aren't finishing yet. */
|
||||
int written;
|
||||
int to_write = PIPE_BUF - conn->stream_pipes_written;
|
||||
|
||||
written = safe_write(conn->stream_pipes[1], data,
|
||||
len > to_write ? to_write : len);
|
||||
len > PIPE_BUF ? PIPE_BUF : len);
|
||||
|
||||
if (written > 0) {
|
||||
data += written;
|
||||
len -= written;
|
||||
conn->stream_pipes_written += written;
|
||||
|
||||
/* In non-keep-alive connections http->length == -1, so the test below */
|
||||
if (*length_of_block > 0)
|
||||
@ -1049,8 +1045,6 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
|
||||
if (!http->length) {
|
||||
/* That's all, folks - let's finish this. */
|
||||
state = FINISHING;
|
||||
} else if (!len) {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1065,7 +1059,6 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
|
||||
if (!output) break;
|
||||
|
||||
did_read = read_encoded(conn->stream, output + *new_len, BIG_READ);
|
||||
conn->stream_pipes_written = 0;
|
||||
|
||||
if (did_read > 0) *new_len += did_read;
|
||||
else if (did_read == -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user