1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

changed the method used for auto-reload on the status page to use

JavaScript. This avoids the nasty inetd problem.
This commit is contained in:
Andrew Tridgell 0001-01-01 00:00:00 +00:00
parent b92c3b13d7
commit 9d9b138809
3 changed files with 23 additions and 6 deletions

View File

@ -1929,6 +1929,7 @@ char *cgi_rooturl(void);
char *cgi_pathinfo(void);
char *cgi_remote_host(void);
char *cgi_remote_addr(void);
BOOL cgi_waspost(void);
/*The following definitions come from web/diagnose.c */

View File

@ -26,7 +26,7 @@
/* set the expiry on fixed pages */
#define EXPIRY_TIME (60*60*24*7)
#define CGI_LOGGING 0
#define CGI_LOGGING 1
#ifdef DEBUG_COMMENTS
extern void print_title(char *fmt, ...);
@ -688,3 +688,15 @@ char *cgi_remote_addr(void)
}
return getenv("REMOTE_ADDR");
}
/***************************************************************************
return True if the request was a POST
***************************************************************************/
BOOL cgi_waspost(void)
{
if (baseurl) {
return request_post;
}
return strequal(getenv("REQUEST_METHOD"), "POST");
}

View File

@ -107,11 +107,6 @@ void status_page(void)
refresh_interval = atoi(v);
}
if (autorefresh) {
printf("<META HTTP-EQUIV=refresh CONTENT=\"%d;URL=%s/status?refresh=1&refresh_interval=%d\">\n",
refresh_interval, cgi_baseurl(), refresh_interval);
}
pstrcpy(fname,lp_lockdir());
standard_sub_basic(fname);
trim_string(fname,"","/");
@ -147,6 +142,15 @@ void status_page(void)
printf("<input type=submit value=\"Stop Refreshing\" name=norefresh>\n");
printf("<br>Refresh Interval: %d\n", refresh_interval);
printf("<input type=hidden name=refresh value=1>\n");
/* this little JavaScript allows for automatic refresh
of the page. There are other methods but this seems
to be the best alternative */
printf("<script language=\"JavaScript\">\n");
printf("<!--\nsetTimeout('window.location.replace(\"%s/status?refresh_interval=%d&refresh=1\")', %d)\n",
cgi_baseurl(),
refresh_interval,
refresh_interval*1000);
printf("//-->\n</script>\n");
}
printf("<p>\n");