mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05: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:
parent
13a04b8fbc
commit
7ceba1e461
@ -58,6 +58,7 @@ struct connection {
|
|||||||
unsigned int unrestartable:1;
|
unsigned int unrestartable:1;
|
||||||
unsigned int detached:1;
|
unsigned int detached:1;
|
||||||
unsigned int popen:1;
|
unsigned int popen:1;
|
||||||
|
unsigned int cgi:1;
|
||||||
|
|
||||||
/* Each document is downloaded with some priority. When downloading a
|
/* Each document is downloaded with some priority. When downloading a
|
||||||
* document, the existing connections are checked to see if a
|
* document, the existing connections are checked to see if a
|
||||||
|
@ -393,6 +393,7 @@ execute_cgi(struct connection *conn)
|
|||||||
/* Use data socket for passing the pipe. It will be cleaned up in
|
/* Use data socket for passing the pipe. It will be cleaned up in
|
||||||
* close_pipe_and_read(). */
|
* close_pipe_and_read(). */
|
||||||
conn->data_socket->fd = pipe_write[1];
|
conn->data_socket->fd = pipe_write[1];
|
||||||
|
conn->cgi = 1;
|
||||||
set_nonblocking_fd(conn->socket->fd);
|
set_nonblocking_fd(conn->socket->fd);
|
||||||
set_nonblocking_fd(conn->data_socket->fd);
|
set_nonblocking_fd(conn->data_socket->fd);
|
||||||
|
|
||||||
|
@ -977,6 +977,9 @@ init_type_query(struct session *ses, struct download *download,
|
|||||||
{
|
{
|
||||||
struct type_query *type_query;
|
struct type_query *type_query;
|
||||||
|
|
||||||
|
assert(download && download->conn);
|
||||||
|
if_assert_failed return NULL;
|
||||||
|
|
||||||
/* There can be only one ... */
|
/* There can be only one ... */
|
||||||
foreach (type_query, ses->type_queries)
|
foreach (type_query, ses->type_queries)
|
||||||
if (compare_uri(type_query->uri, ses->loading_uri, 0))
|
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->target_frame = null_or_stracpy(ses->task.target.frame);
|
||||||
|
|
||||||
type_query->cached = cached;
|
type_query->cached = cached;
|
||||||
|
type_query->cgi = download->conn->cgi;
|
||||||
object_lock(type_query->cached);
|
object_lock(type_query->cached);
|
||||||
|
|
||||||
move_download(download, &type_query->download, PRI_MAIN);
|
move_download(download, &type_query->download, PRI_MAIN);
|
||||||
@ -1088,6 +1092,30 @@ tp_open(struct type_query *type_query)
|
|||||||
return;
|
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, "");
|
continue_download(type_query, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ struct type_query {
|
|||||||
unsigned char *external_handler;
|
unsigned char *external_handler;
|
||||||
int block;
|
int block;
|
||||||
unsigned int copiousoutput:1;
|
unsigned int copiousoutput:1;
|
||||||
|
unsigned int cgi:1;
|
||||||
/* int frame; */
|
/* int frame; */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user