summaryrefslogtreecommitdiff
path: root/source3/web/cgi.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-10-14 12:10:29 +0000
committerAndrew Tridgell <tridge@samba.org>2001-10-14 12:10:29 +0000
commita689b24db14436ab1faa2f2f79b9f27b777b1fdb (patch)
tree7195ae4dc635d1f2e18b44ae57408b03e99e7c63 /source3/web/cgi.c
parent47a0b69029857e92703ca5b00022dcfcb179c9c7 (diff)
downloadsamba-a689b24db14436ab1faa2f2f79b9f27b777b1fdb.tar.gz
samba-a689b24db14436ab1faa2f2f79b9f27b777b1fdb.tar.bz2
samba-a689b24db14436ab1faa2f2f79b9f27b777b1fdb.zip
the next step in the intl changeover. This should get us compiling agian,
and also completes the switch to lang_tdb.c. SWAT should now work with a po file in the lib/ directory also removed useless SYSLOG defines in many files (This used to be commit 5296b20ad85d7519c870768455cb4d8df048c55a)
Diffstat (limited to 'source3/web/cgi.c')
-rw-r--r--source3/web/cgi.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index caba28396f..e1b26d99b4 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -20,7 +20,6 @@
#include "includes.h"
#include "smb.h"
-#include "webintl.h"
#define MAX_VARIABLES 10000
@@ -138,7 +137,7 @@ void cgi_load_variables(void)
#ifdef DEBUG_COMMENTS
char dummy[100]="";
print_title(dummy);
- printf("<!== Start dump in cgi_load_variables() %s ==>\n",__FILE__);
+ d_printf("<!== Start dump in cgi_load_variables() %s ==>\n",__FILE__);
#endif
if (!content_length) {
@@ -270,7 +269,7 @@ static void cgi_setup_error(char *err, char *header, char *info)
}
}
- printf("HTTP/1.0 %s\r\n%sConnection: close\r\nContent-Type: text/html\r\n\r\n<HTML><HEAD><TITLE>%s</TITLE></HEAD><BODY><H1>%s</H1>%s<p></BODY></HTML>\r\n\r\n", err, header, err, err, info);
+ d_printf("HTTP/1.0 %s\r\n%sConnection: close\r\nContent-Type: text/html\r\n\r\n<HTML><HEAD><TITLE>%s</TITLE></HEAD><BODY><H1>%s</H1>%s<p></BODY></HTML>\r\n\r\n", err, header, err, err, info);
fclose(stdin);
fclose(stdout);
exit(0);
@@ -448,9 +447,7 @@ static void cgi_download(char *file)
char buf[1024];
int fd, l, i;
char *p;
-#if I18N_SWAT
- int nLangDesc;
-#endif
+ char *lang;
/* sanitise the filename */
for (i=0;file[i];i++) {
@@ -464,11 +461,8 @@ static void cgi_download(char *file)
cgi_setup_error("404 File Not Found","",
"The requested file was not found");
}
-#if I18N_SWAT
- fd = sys_open(ln_get_pref_file(file, &st, &nLangDesc),O_RDONLY,0);
-#else
- fd = sys_open(file,O_RDONLY,0);
-#endif
+
+ fd = web_open(file,O_RDONLY,0);
if (fd == -1) {
cgi_setup_error("404 File Not Found","",
"The requested file was not found");
@@ -486,10 +480,12 @@ static void cgi_download(char *file)
}
}
printf("Expires: %s\r\n", http_timestring(time(NULL)+EXPIRY_TIME));
-#if I18N_SWAT
- if(ln_get_lang(nLangDesc))
- printf("Content-Language: %s\r\n", ln_get_lang(nLangDesc));
-#endif
+
+ lang = lang_tdb_current();
+ if (lang) {
+ printf("Content-Language: %s\r\n", lang);
+ }
+
printf("Content-Length: %d\r\n\r\n", (int)st.st_size);
while ((l=read(fd,buf,sizeof(buf)))>0) {
fwrite(buf, 1, l, stdout);
@@ -511,6 +507,7 @@ void cgi_setup(char *rootdir, int auth_required)
char line[1024];
char *url=NULL;
char *p;
+ char *lang;
if (chdir(rootdir)) {
cgi_setup_error("400 Server Error", "",
@@ -520,10 +517,10 @@ void cgi_setup(char *rootdir, int auth_required)
/* Handle the possability we might be running as non-root */
sec_init();
-#if I18N_SWAT
- if(getenv("HTTP_ACCEPT_LANGUAGE")) /* if running as a cgi program */
- ln_negotiate_language(getenv("HTTP_ACCEPT_LANGUAGE"));
-#endif
+ if ((lang=getenv("HTTP_ACCEPT_LANGUAGE"))) {
+ /* if running as a cgi program */
+ web_set_lang(lang);
+ }
/* maybe we are running under a web server */
if (getenv("CONTENT_LENGTH") || getenv("REQUEST_METHOD")) {
@@ -559,10 +556,8 @@ void cgi_setup(char *rootdir, int auth_required)
authenticated = cgi_handle_authorization(&line[15]);
} else if (strncasecmp(line,"Content-Length: ", 16)==0) {
content_length = atoi(&line[16]);
-#if I18N_SWAT
} else if (strncasecmp(line,"Accept-Language: ", 17)==0) {
- ln_negotiate_language(&line[17]);
-#endif
+ web_set_lang(&line[17]);
}
/* ignore all other requests! */
}