diff --git a/src/network/connection.c b/src/network/connection.c index d084ef1a..a6a9321e 100644 --- a/src/network/connection.c +++ b/src/network/connection.c @@ -303,7 +303,6 @@ init_connection(struct uri *uri, struct uri *proxied_uri, struct uri *referrer, conn->content_encoding = ENCODING_NONE; conn->stream_pipes[0] = conn->stream_pipes[1] = -1; - conn->cgi_pipes[0] = conn->cgi_pipes[1] = -1; init_list(conn->downloads); conn->est_length = -1; conn->timer = TIMER_ID_UNDEF; @@ -401,12 +400,6 @@ free_connection_data(struct connection *conn) shutdown_connection_stream(conn); - if (conn->cgi_pipes[0] >= 0) - close(conn->cgi_pipes[0]); - if (conn->cgi_pipes[1] >= 0) - close(conn->cgi_pipes[1]); - conn->cgi_pipes[0] = conn->cgi_pipes[1] = -1; - mem_free_set(&conn->info, NULL); kill_timer(&conn->timer); diff --git a/src/network/connection.h b/src/network/connection.h index aaa702c5..cfde199c 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -51,7 +51,6 @@ struct connection { int tries; timer_id_T timer; - int cgi_pipes[2]; int stream_pipes[2]; unsigned int running:1; diff --git a/src/protocol/file/cgi.c b/src/protocol/file/cgi.c index 91ee73bf..81b22a11 100644 --- a/src/protocol/file/cgi.c +++ b/src/protocol/file/cgi.c @@ -73,8 +73,8 @@ close_pipe_and_read(struct socket *data_socket) rb->freespace -= 17; conn->unrestartable = 1; - close(conn->cgi_pipes[1]); - data_socket->fd = conn->cgi_pipes[1] = -1; + close(data_socket->fd); + data_socket->fd = -1; conn->socket->state = SOCKET_END_ONCLOSE; read_from_socket(conn->socket, rb, S_SENT, http_got_header); @@ -119,9 +119,6 @@ send_post_data(struct connection *conn) if (n) add_bytes_to_string(&data, buffer, n); - /* Use data socket for passing the pipe. It will be cleaned up in - * close_pipe_and_read(). */ - conn->data_socket->fd = conn->cgi_pipes[1]; write_to_socket(conn->data_socket, data.source, data.length, S_SENT, close_pipe_and_read); @@ -383,9 +380,11 @@ execute_cgi(struct connection *conn) mem_free(script); close(pipe_read[1]); close(pipe_write[0]); - conn->cgi_pipes[0] = pipe_read[0]; - conn->cgi_pipes[1] = pipe_write[1]; - conn->socket->fd = conn->cgi_pipes[0]; + conn->socket->fd = pipe_read[0]; + + /* Use data socket for passing the pipe. It will be cleaned up in + * close_pipe_and_read(). */ + conn->data_socket->fd = pipe_read[1]; send_request(conn); return 0;