1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-01 02:05:33 +00:00

bug 991: Added the bit field cgi to the structs connection and type_query.

CGI scripts are distinguishable from normal files. I hope that this
fixes the bug 991. This commit also reverts the previous revert.
This commit is contained in:
Witold Filipczyk 2008-03-09 11:50:09 +00:00 committed by Kalle Olavi Niemitalo
parent 13a04b8fbc
commit 7ceba1e461
4 changed files with 31 additions and 0 deletions

View File

@ -58,6 +58,7 @@ struct connection {
unsigned int unrestartable:1;
unsigned int detached:1;
unsigned int popen:1;
unsigned int cgi:1;
/* Each document is downloaded with some priority. When downloading a
* document, the existing connections are checked to see if a

View File

@ -393,6 +393,7 @@ execute_cgi(struct connection *conn)
/* Use data socket for passing the pipe. It will be cleaned up in
* close_pipe_and_read(). */
conn->data_socket->fd = pipe_write[1];
conn->cgi = 1;
set_nonblocking_fd(conn->socket->fd);
set_nonblocking_fd(conn->data_socket->fd);

View File

@ -977,6 +977,9 @@ init_type_query(struct session *ses, struct download *download,
{
struct type_query *type_query;
assert(download && download->conn);
if_assert_failed return NULL;
/* There can be only one ... */
foreach (type_query, ses->type_queries)
if (compare_uri(type_query->uri, ses->loading_uri, 0))
@ -990,6 +993,7 @@ init_type_query(struct session *ses, struct download *download,
type_query->target_frame = null_or_stracpy(ses->task.target.frame);
type_query->cached = cached;
type_query->cgi = download->conn->cgi;
object_lock(type_query->cached);
move_download(download, &type_query->download, PRI_MAIN);
@ -1088,6 +1092,30 @@ tp_open(struct type_query *type_query)
return;
}
if (type_query->uri->protocol == PROTOCOL_FILE && !type_query->cgi) {
unsigned char *file = get_uri_string(type_query->uri, URI_PATH);
unsigned char *handler = NULL;
if (file) {
decode_uri(file);
handler = subst_file(type_query->external_handler, file);
mem_free(file);
}
if (handler) {
if (type_query->copiousoutput)
read_from_popen(type_query->ses, handler, NULL);
else
exec_on_terminal(type_query->ses->tab->term,
handler, "",
type_query->block ? TERM_EXEC_FG : TERM_EXEC_BG);
mem_free(handler);
}
done_type_query(type_query);
return;
}
continue_download(type_query, "");
}

View File

@ -49,6 +49,7 @@ struct type_query {
unsigned char *external_handler;
int block;
unsigned int copiousoutput:1;
unsigned int cgi:1;
/* int frame; */
};