diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-31 16:25:02 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2003-01-31 16:25:02 +0000 |
commit | 92fc697f221b9332fdd791213442ce2241ff9be3 (patch) | |
tree | 0695831452d4ce2f77593ef75205398935942a5e /url.c | |
parent | [w3m-dev 03720] mark remains (diff) | |
download | w3m-92fc697f221b9332fdd791213442ce2241ff9be3.tar.gz w3m-92fc697f221b9332fdd791213442ce2241ff9be3.zip |
[w3m-dev 03721] PATH_INFO support of local CGI
* local.c (CGIFN_DROOT): deleted
(CGIFN_LIBDIR): added
(CGIFN_MODE): deleted
(CGIFN_CONTAIN_SLASH): deleted
(check_local_cgi): rewrite
(cgi_filename): rewrite
(localcgi_post): support PATH_INFO
* url.c (openURL): rewrite
* Bonus/smb.cgi: use PATH_INFO
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to 'url.c')
-rw-r--r-- | url.c | 46 |
1 files changed, 9 insertions, 37 deletions
@@ -1,4 +1,4 @@ -/* $Id: url.c,v 1.71 2003/01/29 17:33:28 ukai Exp $ */ +/* $Id: url.c,v 1.72 2003/01/31 16:25:10 ukai Exp $ */ #include "fm.h" #include <sys/types.h> #include <sys/socket.h> @@ -1463,14 +1463,13 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, URLFile *ouf, HRequest *hr, unsigned char *status) { Str tmp; - int i, sock, scheme; + int sock, scheme; char *p, *q, *u; URLFile uf; HRequest hr0; #ifdef USE_SSL SSL *sslh = NULL; #endif /* USE_SSL */ - int extlen = strlen(CGI_EXTENSION); if (hr == NULL) hr = &hr0; @@ -1521,49 +1520,22 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, switch (pu->scheme) { case SCM_LOCAL: case SCM_LOCAL_CGI: - if (request && request->body) { + if (request && request->body) /* local CGI: POST */ - if ((q = strchr(pu->file, '?')) != NULL) { - p = Strnew_charp_n(pu->file, (int)(q - pu->file))->ptr; - pu->real_file = cleanupName(file_unquote(p)); - q++; - } - uf.stream = newFileStream(localcgi_post(pu->real_file, - pu->query, - request, - option->referer), + uf.stream = newFileStream(localcgi_post(pu->real_file, pu->query, + request, option->referer), (void (*)())pclose); - if (uf.stream == NULL) - goto ordinary_local_file; - uf.is_cgi = TRUE; - uf.scheme = pu->scheme = SCM_LOCAL_CGI; - } - else if (pu->query != NULL) { + else /* lodal CGI: GET */ uf.stream = newFileStream(localcgi_get(pu->real_file, pu->query, option->referer), (void (*)())pclose); - if (uf.stream == NULL) { - goto ordinary_local_file; - } + if (uf.stream) { uf.is_cgi = TRUE; uf.scheme = pu->scheme = SCM_LOCAL_CGI; + return uf; } - else if ((i = strlen(pu->file)) > extlen && - !strncmp(pu->file + i - extlen, CGI_EXTENSION, extlen)) { - /* lodal CGI: GET */ - uf.stream = newFileStream(localcgi_get(pu->real_file, NULL, - option->referer), - (void (*)())pclose); - if (uf.stream == NULL) - goto ordinary_local_file; - uf.is_cgi = TRUE; - uf.scheme = pu->scheme = SCM_LOCAL_CGI; - } - else { - ordinary_local_file: - examineFile(pu->real_file, &uf); - } + examineFile(pu->real_file, &uf); if (uf.stream == NULL) { if (dir_exist(pu->real_file)) { add_index_file(pu, &uf); |