summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/autogen.sh5
-rw-r--r--source4/build/smb_build/makefile.pm3
-rw-r--r--source4/dynconfig.c7
-rw-r--r--source4/dynconfig.h3
-rw-r--r--source4/dynconfig.mk2
-rw-r--r--source4/main.mk11
-rw-r--r--source4/param/loadparm.c11
-rwxr-xr-xsource4/script/installjsonrpc.sh32
-rwxr-xr-xsource4/script/installswat.sh37
-rwxr-xr-xsource4/script/installwebapps.sh51
-rw-r--r--source4/scripting/ejs/smbcalls.c46
-rw-r--r--source4/scripting/libjs/provision.js1
-rw-r--r--source4/web_server/http.c133
13 files changed, 70 insertions, 272 deletions
diff --git a/source4/autogen.sh b/source4/autogen.sh
index 984831bf90..e5aa69776f 100755
--- a/source4/autogen.sh
+++ b/source4/autogen.sh
@@ -63,11 +63,6 @@ $AUTOCONF $IPATHS || exit 1
rm -rf autom4te*.cache
-if test x"${AUTOGEN_SKIP_SWAT}" != x"yes"; then
- echo "$0: building Web Application Framework (SWAT)"
- (cd ../webapps/swat && make distclean build || exit 1)
-fi
-
echo "Now run ./configure and then make."
exit 0
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index b88a1ea72e..39ae54bba7 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -88,8 +88,7 @@ MODULESDIR = $self->{config}->{modulesdir}
INCLUDEDIR = $self->{config}->{includedir}
CONFIGDIR = $self->{config}->{sysconfdir}
DATADIR = $self->{config}->{datadir}
-WEBAPPSDIR = \$(DATADIR)/webapps
-SERVICESDIR = \$(DATADIR)/services
+SWATDIR = \$(DATADIR)/swat
JSDIR = \$(DATADIR)/js
SETUPDIR = \$(DATADIR)/setup
VARDIR = $self->{config}->{localstatedir}
diff --git a/source4/dynconfig.c b/source4/dynconfig.c
index ddd1f2ab74..6dbbf872d9 100644
--- a/source4/dynconfig.c
+++ b/source4/dynconfig.c
@@ -73,11 +73,8 @@ _PUBLIC_ const char *dyn_PIDDIR = PIDDIR;
/** Private data directory; holds ldb files and the like */
_PUBLIC_ const char *dyn_PRIVATE_DIR = PRIVATE_DIR;
-/** WEBAPPS directory */
-_PUBLIC_ const char *dyn_WEBAPPSDIR = WEBAPPSDIR;
-
-/** JSON-RPC Services script directory */
-_PUBLIC_ const char *dyn_SERVICESDIR = SERVICESDIR;
+/** SWAT directory */
+_PUBLIC_ const char *dyn_SWATDIR = SWATDIR;
/** SETUP files (source files used by the provision) */
_PUBLIC_ const char *dyn_SETUPDIR = SETUPDIR;
diff --git a/source4/dynconfig.h b/source4/dynconfig.h
index cb56bc6514..ac54db63d6 100644
--- a/source4/dynconfig.h
+++ b/source4/dynconfig.h
@@ -34,8 +34,7 @@ extern const char *dyn_MODULESDIR;
extern const char *dyn_LOCKDIR;
extern const char *dyn_PIDDIR;
extern const char *dyn_PRIVATE_DIR;
-extern const char *dyn_WEBAPPSDIR;
-extern const char *dyn_SERVICESDIR;
+extern const char *dyn_SWATDIR;
extern const char *dyn_JSDIR;
extern const char *dyn_SETUPDIR;
extern const char *dyn_WINBINDD_SOCKET_DIR;
diff --git a/source4/dynconfig.mk b/source4/dynconfig.mk
index 873ea5b45a..b86f441372 100644
--- a/source4/dynconfig.mk
+++ b/source4/dynconfig.mk
@@ -13,7 +13,7 @@ PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" \
-DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DDATADIR=\"$(DATADIR)\" \
-DLOGFILEBASE=\"$(LOGFILEBASE)\" \
-DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
- -DWEBAPPSDIR=\"$(WEBAPPSDIR)\" -DSERVICESDIR=\"$(SERVICESDIR)\" \
+ -DSWATDIR=\"$(SWATDIR)\" \
-DPRIVATE_DIR=\"$(PRIVATEDIR)\" \
-DMODULESDIR=\"$(MODULESDIR)\" -DJSDIR=\"$(JSDIR)\" \
-DTORTUREDIR=\"$(TORTUREDIR)\" \
diff --git a/source4/main.mk b/source4/main.mk
index 609560e4a7..2b175f62ab 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -58,8 +58,7 @@ showlayout:
@echo ' logfilebase: $(LOGFILEBASE)'
@echo ' setupdir: $(SETUPDIR)'
@echo ' jsdir: $(JSDIR)'
- @echo ' webappsdir: $(WEBAPPSDIR)'
- @echo ' servicesdir: $(SERVICESDIR)'
+ @echo ' swatdir: $(SWATDIR)'
@echo ' mandir: $(MANDIR)'
@echo ' torturedir: $(TORTUREDIR)'
@echo ' datadir: $(DATADIR)'
@@ -86,7 +85,7 @@ showflags:
# The permissions to give the executables
INSTALLPERMS = 0755
-install: showlayout everything installbin installdat installwebapps installmisc installlib \
+install: showlayout everything installbin installdat installswat installmisc installlib \
installheader installpc installplugins
# DESTDIR is used here to prevent packagers wasting their time
@@ -147,9 +146,8 @@ installheader: headers installdirs
installdat: installdirs
@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
-installwebapps: installdirs
- @$(SHELL) $(srcdir)/script/installwebapps.sh $(DESTDIR)$(WEBAPPSDIR) $(srcdir)
- @$(SHELL) $(srcdir)/script/installjsonrpc.sh $(DESTDIR)$(SERVICESDIR) $(srcdir)
+installswat: installdirs
+ @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
installman: manpages installdirs
@$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
@@ -268,7 +266,6 @@ distclean: clean
-rm -f config.status
-rm -f config.log config.cache
-rm -f config.pm config.mk
- -rm -rf ../webapps/qooxdoo-*-sdk/frontend/framework/.cache
-rm -f $(PC_FILES)
removebackup:
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index f5c0ba51eb..b83d66dfb4 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -126,7 +126,7 @@ struct global
char *szTemplateShell;
char *szTemplateHomedir;
int bWinbindSealedPipes;
- char *webapps_directory;
+ char *swat_directory;
int tls_enabled;
char *tls_keyfile;
char *tls_certfile;
@@ -460,7 +460,7 @@ static struct parm_struct parm_table[] = {
{"tls cafile", P_STRING, P_GLOBAL, &loadparm.Globals.tls_cafile, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"tls crlfile", P_STRING, P_GLOBAL, &loadparm.Globals.tls_crlfile, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"tls dh params file", P_STRING, P_GLOBAL, &loadparm.Globals.tls_dhpfile, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"web application directory", P_STRING, P_GLOBAL, &loadparm.Globals.webapps_directory, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"swat directory", P_STRING, P_GLOBAL, &loadparm.Globals.swat_directory, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"large readwrite", P_BOOL, P_GLOBAL, &loadparm.Globals.bLargeReadwrite, NULL, NULL, FLAG_DEVELOPER},
{"server max protocol", P_ENUM, P_GLOBAL, &loadparm.Globals.srv_maxprotocol, NULL, enum_protocol, FLAG_DEVELOPER},
{"server min protocol", P_ENUM, P_GLOBAL, &loadparm.Globals.srv_minprotocol, NULL, enum_protocol, FLAG_DEVELOPER},
@@ -549,7 +549,6 @@ static struct parm_struct parm_table[] = {
{"modules dir", P_STRING, P_GLOBAL, &loadparm.Globals.szModulesDir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"pid directory", P_STRING, P_GLOBAL, &loadparm.Globals.szPidDir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"js include", P_LIST, P_GLOBAL, &loadparm.Globals.jsInclude, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"jsonrpc services directory", P_STRING, P_GLOBAL, &loadparm.Globals.jsonrpcServicesDir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"setup directory", P_STRING, P_GLOBAL, &loadparm.Globals.szSetupDir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"socket address", P_STRING, P_GLOBAL, &loadparm.Globals.szSocketAddress, NULL, NULL, FLAG_DEVELOPER},
@@ -683,7 +682,7 @@ _PUBLIC_ FN_GLOBAL_INTEGER(lp_krb5_port, &loadparm.Globals.krb5_port)
_PUBLIC_ FN_GLOBAL_INTEGER(lp_kpasswd_port, &loadparm.Globals.kpasswd_port)
_PUBLIC_ FN_GLOBAL_INTEGER(lp_web_port, &loadparm.Globals.web_port)
_PUBLIC_ FN_GLOBAL_STRING(lp_dos_charset, &dos_charset)
-_PUBLIC_ FN_GLOBAL_STRING(lp_webapps_directory, &loadparm.Globals.webapps_directory)
+_PUBLIC_ FN_GLOBAL_STRING(lp_swat_directory, &loadparm.Globals.swat_directory)
_PUBLIC_ FN_GLOBAL_BOOL(lp_tls_enabled, &loadparm.Globals.tls_enabled)
_PUBLIC_ FN_GLOBAL_STRING(lp_tls_keyfile, &loadparm.Globals.tls_keyfile)
_PUBLIC_ FN_GLOBAL_STRING(lp_tls_certfile, &loadparm.Globals.tls_certfile)
@@ -766,7 +765,6 @@ _PUBLIC_ FN_GLOBAL_INTEGER(lp_security, &loadparm.Globals.security)
_PUBLIC_ FN_GLOBAL_BOOL(lp_paranoid_server_security, &loadparm.Globals.paranoid_server_security)
_PUBLIC_ FN_GLOBAL_INTEGER(lp_announce_as, &loadparm.Globals.announce_as)
_PUBLIC_ FN_GLOBAL_LIST(lp_js_include, &loadparm.Globals.jsInclude)
-_PUBLIC_ FN_GLOBAL_STRING(lp_jsonrpc_services_dir, &loadparm.Globals.jsonrpcServicesDir)
_PUBLIC_ FN_LOCAL_STRING(lp_servicename, szService)
_PUBLIC_ FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
_PUBLIC_ FN_LOCAL_STRING(lp_pathname, szPath)
@@ -2429,8 +2427,7 @@ bool loadparm_init(struct loadparm_context *lp_ctx)
lp_do_global_parameter(lp_ctx, "krb5 port", "88");
lp_do_global_parameter(lp_ctx, "kpasswd port", "464");
lp_do_global_parameter(lp_ctx, "web port", "901");
- lp_do_global_parameter(lp_ctx, "web application directory", dyn_WEBAPPSDIR);
- lp_do_global_parameter(lp_ctx, "jsonrpc services directory", dyn_SERVICESDIR);
+ lp_do_global_parameter(lp_ctx, "swat directory", dyn_SWATDIR);
lp_do_global_parameter(lp_ctx, "nt status support", "True");
diff --git a/source4/script/installjsonrpc.sh b/source4/script/installjsonrpc.sh
deleted file mode 100755
index b91f6bf3bb..0000000000
--- a/source4/script/installjsonrpc.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-SERVICESDIR=$1
-SRCDIR=$2
-
-echo Installing JSON-RPC services in $SERVICESDIR
-
-cd $SRCDIR/../services || exit 1
-
-mkdir -p $SERVICESDIR || exit 1
-
-installdir() {
- for f in $*; do
- dname=`dirname $f`
- echo "Installing $f in $dname"
- test -d $SERVICESDIR/$dname || mkdir -p $SERVICESDIR/$dname || exit 1
- cp $f $SERVICESDIR/$dname/ || exit 1
- chmod 0644 $SERVICESDIR/$f || exit 1
- done
-}
-
-installdir `find . -name '*.esp'`
-
-cat << EOF
-======================================================================
-The JSON-RPC services have been installed.
-======================================================================
-EOF
-
-
-exit 0
-
diff --git a/source4/script/installswat.sh b/source4/script/installswat.sh
new file mode 100755
index 0000000000..4304e3e490
--- /dev/null
+++ b/source4/script/installswat.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+SWATDIR=$1
+SRCDIR=$2
+
+echo Installing swat files in $SWATDIR
+
+cd $SRCDIR/../swat || exit 1
+
+mkdir -p $SWATDIR || exit 1
+
+installdir() {
+ for f in $*; do
+ dname=`dirname $f`
+ echo "Installing $f in $dname"
+ test -d $SWATDIR/$dname || mkdir -p $SWATDIR/$dname || exit 1
+ cp $f $SWATDIR/$dname/ || exit 1
+ chmod 0644 $SWATDIR/$f || exit 1
+ done
+}
+
+installdir `find . -name '*.js'`
+installdir `find . -name '*.esp'`
+installdir `find . -name '*.css'`
+installdir `find . -name '*.png'`
+installdir `find . -name '*.ico'`
+installdir `find . -name '*.gif'`
+installdir `find . -name '*.ejs'`
+
+cat << EOF
+======================================================================
+The swat files have been installed.
+======================================================================
+EOF
+
+exit 0
+
diff --git a/source4/script/installwebapps.sh b/source4/script/installwebapps.sh
deleted file mode 100755
index 25a43dba24..0000000000
--- a/source4/script/installwebapps.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-
-WEBAPPSDIR=$1
-SRCDIR=$2
-
-echo Installing web application files in $WEBAPPSDIR
-
-cd $SRCDIR/../webapps/swat || exit 1
-
-# building the web application framework is now done by autogen.sh
-#make build || exit 1
-
-mkdir -p $WEBAPPSDIR || exit 1
-
-installdir() {
- for f in $*; do
- dname=`dirname $f`
- echo "Installing $f in $dname"
- test -d $WEBAPPSDIR/$dname || mkdir -p $WEBAPPSDIR/$dname || exit 1
- cp $f $WEBAPPSDIR/$dname/ || exit 1
- chmod 0644 $WEBAPPSDIR/$f || exit 1
- done
-}
-
-# install our web application
-cd build || exit 1
-installdir `find . -type f -print`
-
-# install files from the 'scripting', 'style' and 'images' directories
-cd ../.. || exit 1
-installdir `find scripting -name '*.js'`
-installdir `find scripting -name '*.esp'`
-installdir `find style -name '*.css'`
-installdir `find images -name '*.png'`
-installdir `find images -name '*.gif'`
-installdir `find images -name '*.ico'`
-
-# install the old installation scripts, since there's no replacement yet
-installdir `find install -name '*.esp'`
-
-# install top-level scripts
-installdir index.esp login.esp logout.esp menu.js
-
-cat << EOF
-======================================================================
-The web application files have been installed.
-======================================================================
-EOF
-
-exit 0
-
diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c
index 08b9eac5c1..3cb860b9e3 100644
--- a/source4/scripting/ejs/smbcalls.c
+++ b/source4/scripting/ejs/smbcalls.c
@@ -161,51 +161,6 @@ static int ejs_version(MprVarHandle eid, int argc, struct MprVar **argv)
}
-/*
- * jsonrpc_include() allows you to include jsonrpc files from a path based at
- * "jsonrpc services directory =" in smb.conf.
- */
-static int jsonrpc_include(int eid, int argc, char **argv)
-{
- int ret = -1;
- char *path;
- char *emsg;
- const char *jsonrpc_services_dir = lp_jsonrpc_services_dir();
- struct MprVar result;
-
-
- if (jsonrpc_services_dir == NULL || jsonrpc_services_dir == NULL) {
- ejsSetErrorMsg(eid, "'jsonrpc services directory' not set");
- return -1;
- }
-
- if (argc != 1) {
- mpr_Return(eid, mprCreateIntegerVar(-1));
- return 0;
- }
-
- path = talloc_asprintf(mprMemCtx(), "%s/%s",
- jsonrpc_services_dir,
- argv[0]);
- if (path == NULL) {
- mpr_Return(eid, mprCreateIntegerVar(-1));
- return 0;
- }
-
- if (file_exist(path)) {
- ret = ejsEvalFile(eid, path, &result, &emsg);
- if (ret < 0) {
- ejsSetErrorMsg(eid, "Could not eval file");
- printf("file found; ret=%d (%s)\n", ret, emsg);
- }
- }
-
- mpr_Return(eid, mprCreateIntegerVar(ret));
- talloc_free(path);
- return 0;
-}
-
-
static void (*ejs_exception_handler) (const char *) = NULL;
_PUBLIC_ void ejs_exception(const char *reason)
@@ -240,6 +195,5 @@ void smb_setup_ejs_functions(void (*exception_handler)(const char *))
ejsDefineCFunction(-1, "nativeTypeOf", ejs_typeof_native, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineStringCFunction(-1, "libinclude", ejs_libinclude, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineCFunction(-1, "version", ejs_version, NULL, MPR_VAR_SCRIPT_HANDLE);
- ejsDefineStringCFunction(-1, "jsonrpc_include", jsonrpc_include, NULL, MPR_VAR_SCRIPT_HANDLE);
}
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js
index fd6de2695f..d6d4909499 100644
--- a/source4/scripting/libjs/provision.js
+++ b/source4/scripting/libjs/provision.js
@@ -162,7 +162,6 @@ function ldb_erase(info, ldb)
/* delete the specials */
ldb.del("@INDEXLIST");
ldb.del("@ATTRIBUTES");
- ldb.del("@SUBCLASSES");
ldb.del("@MODULES");
ldb.del("@PARTITION");
ldb.del("@KLUDGEACL");
diff --git a/source4/web_server/http.c b/source4/web_server/http.c
index fb103f16c5..150649e1bb 100644
--- a/source4/web_server/http.c
+++ b/source4/web_server/http.c
@@ -36,8 +36,6 @@
#define SAMBA_SESSION_KEY "SambaSessionId"
#define HTTP_PREAUTH_URI "/scripting/preauth.esp"
-#define JSONRPC_REQUEST "/services"
-#define JSONRPC_SERVER "/request.esp"
/* state of the esp subsystem for a specific request */
struct esp_state {
@@ -171,12 +169,12 @@ failed:
return -1;
}
-static int http_readFileFromWebappsDir(EspHandle handle,
+static int http_readFileFromSwatDir(EspHandle handle,
char **buf,
int *len,
const char *path)
{
- return http_readFile(handle, buf, len, path, lp_webapps_directory());
+ return http_readFile(handle, buf, len, path, lp_swat_directory());
}
@@ -390,7 +388,7 @@ static void http_simple_request(struct websrv_context *web)
const char *path;
struct stat st;
- path = http_local_path(web, url, lp_webapps_directory());
+ path = http_local_path(web, url, lp_swat_directory());
if (path == NULL) goto invalid;
/* looks ok */
@@ -472,7 +470,7 @@ static void http_setup_arrays(struct esp_state *esp)
talloc_asprintf(esp, "%u", socket_address->port));
}
- SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_webapps_directory());
+ SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_swat_directory());
SETVAR(ESP_SERVER_OBJ, "SERVER_PROTOCOL", tls_enabled(web->conn->socket)?"https":"http");
SETVAR(ESP_SERVER_OBJ, "SERVER_SOFTWARE", "SAMBA");
SETVAR(ESP_SERVER_OBJ, "GATEWAY_INTERFACE", "CGI/1.1");
@@ -517,7 +515,7 @@ static void esp_request(struct esp_state *esp, const char *url)
int res;
char *emsg = NULL, *buf;
- if (http_readFile(web, &buf, &size, url, lp_webapps_directory()) != 0) {
+ if (http_readFile(web, &buf, &size, url, lp_swat_directory()) != 0) {
http_error_unix(web, url);
return;
}
@@ -539,89 +537,17 @@ static void esp_request(struct esp_state *esp, const char *url)
}
/*
- process a JSON RPC request
-*/
-static void jsonrpc_request(struct esp_state *esp)
-{
- struct websrv_context *web = esp->web;
- const char *path = http_local_path(web,
- JSONRPC_SERVER,
- lp_jsonrpc_services_dir());
- MprVar *global;
- MprVar v;
- MprVar temp;
- int size;
- int res;
- char *emsg = NULL;
- char *emsg2 = NULL;
- char *buf;
- char *error_script =
- "error.setOrigin(jsonrpc.Constant.ErrorOrigin.Server); "
- "error.setError(jsonrpc.Constant.ErrorCode.UnexpectedOutput, "
- " global.errorString);"
- "error.Send();";
-
- /* Ensure we got a valid path. */
- if (path == NULL) {
- /* should never occur */
- http_error(esp->web, 500, "Internal server error");
- return;
- }
-
- /* Ensure that the JSON-RPC server request script exists */
- if (!file_exist(path)) {
- http_error_unix(esp->web, path);
- return;
- }
-
- /* Call the server request script */
- if (http_readFile(web, &buf, &size,
- JSONRPC_SERVER, lp_jsonrpc_services_dir()) != 0) {
- http_error_unix(web, JSONRPC_SERVER);
- return;
- }
-
-#if HAVE_SETJMP_H
- if (setjmp(ejs_exception_buf) != 0) {
- http_error(web, 500, exception_reason);
- return;
- }
-#endif
-
- res = espProcessRequest(esp->req, JSONRPC_SERVER, buf, &emsg);
- if (res != 0 && emsg) {
- /* Save the error in a string accessible from javascript */
- global = ejsGetGlobalObject(0);
- v = mprString(emsg);
- mprCreateProperty(global, "errorString", &v);
-
- /* Create and send a JsonRpcError object */
- if (ejsEvalScript(0,
- error_script,
- &temp,
- &emsg2) != 0) {
- http_writeBlock(web, "<pre>", 5);
- http_writeBlock(web, emsg, strlen(emsg));
- http_writeBlock(web, "</pre>", 6);
- }
- }
- talloc_free(buf);
-}
-
-/*
perform pre-authentication on every page if /scripting/preauth.esp
exists. If this script generates any non-whitepace output at all,
then we don't run the requested URL.
- note that the preauth is run even for static pages such as images, but not
- for JSON-RPC service requests which do their own authentication via the
- JSON-RPC server.
+ note that the preauth is run even for static pages such as images
*/
static BOOL http_preauth(struct esp_state *esp)
{
const char *path = http_local_path(esp->web,
HTTP_PREAUTH_URI,
- lp_webapps_directory());
+ lp_swat_directory());
int i;
if (path == NULL) {
http_error(esp->web, 500, "Internal server error");
@@ -834,7 +760,7 @@ static const struct Esp esp_control = {
.setHeader = http_setHeader,
.redirect = http_redirect,
.setResponseCode = http_setResponseCode,
- .readFile = http_readFileFromWebappsDir,
+ .readFile = http_readFileFromSwatDir,
.mapToStorage = http_mapToStorage,
.setCookie = http_setCookie,
.createSession = http_createSession,
@@ -858,8 +784,7 @@ void http_process_input(struct websrv_context *web)
const char *file_type = NULL;
enum page_type {
page_type_simple,
- page_type_esp,
- page_type_jsonrpc
+ page_type_esp
};
enum page_type page_type;
const struct {
@@ -945,35 +870,21 @@ void http_process_input(struct websrv_context *web)
esp->req = espCreateRequest(web, web->input.url, esp->variables);
if (esp->req == NULL) goto internal_error;
- /*
- * Work out the mime type. First, we see if the request is a JSON-RPC
- * service request. If not, we look at the extension.
- */
- if (strncmp(web->input.url,
- JSONRPC_REQUEST,
- sizeof(JSONRPC_REQUEST) - 1) == 0 &&
- (web->input.url[sizeof(JSONRPC_REQUEST) - 1] == '\0' ||
- web->input.url[sizeof(JSONRPC_REQUEST) - 1] == '/')) {
- page_type = page_type_jsonrpc;
- file_type = "text/json";
-
- } else {
- p = strrchr(web->input.url, '.');
- if (p == NULL) {
- page_type = page_type_esp;
- file_type = "text/html";
- }
- for (i=0;p && i<ARRAY_SIZE(mime_types);i++) {
+ p = strrchr(web->input.url, '.');
+ if (p == NULL) {
+ page_type = page_type_esp;
+ file_type = "text/html";
+ }
+ for (i=0;p && i<ARRAY_SIZE(mime_types);i++) {
if (strcmp(mime_types[i].extension, p+1) == 0) {
- page_type = mime_types[i].page_type;
- file_type = mime_types[i].mime_type;
+ page_type = mime_types[i].page_type;
+ file_type = mime_types[i].mime_type;
}
- }
- if (file_type == NULL) {
+ }
+ if (file_type == NULL) {
page_type = page_type_simple;
file_type = "text/html";
- }
- }
+ }
/* setup basic headers */
http_setResponseCode(web, 200);
@@ -1002,10 +913,6 @@ void http_process_input(struct websrv_context *web)
esp_request(esp, web->input.url);
}
break;
-
- case page_type_jsonrpc:
- jsonrpc_request(esp);
- break;
}
if (web->conn == NULL) {