summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-05-13 12:08:59 +0000
committermichael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-05-13 12:08:59 +0000
commit3020058fadb5de1ff8e38dfd7155c0b7737383f7 (patch)
treef6edc2f4355c82f7d2b0a8adf880331fd06297a1
parent1ce4be41d33f84fdbd8c91a24e71013bcc16f94e (diff)
downloadfpc-3020058fadb5de1ff8e38dfd7155c0b7737383f7.tar.gz
* Reworked session management.
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@17442 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--packages/fcl-web/src/base/Makefile154
-rw-r--r--packages/fcl-web/src/base/Makefile.fpc2
-rw-r--r--packages/fcl-web/src/base/fpapache.pp5
-rw-r--r--packages/fcl-web/src/base/fphttp.pp203
-rw-r--r--packages/fcl-web/src/base/fpweb.pp2
-rw-r--r--packages/fcl-web/src/base/httpdefs.pp1
-rw-r--r--packages/fcl-web/src/base/websession.pp382
-rw-r--r--packages/fcl-web/src/jsonrpc/fpextdirect.pp4
-rw-r--r--packages/fcl-web/src/jsonrpc/webjsonrpc.pp2
-rw-r--r--packages/fcl-web/src/webdata/extjsjson.pp1
-rw-r--r--packages/fcl-web/src/webdata/fpwebdata.pp2
11 files changed, 323 insertions, 435 deletions
diff --git a/packages/fcl-web/src/base/Makefile b/packages/fcl-web/src/base/Makefile
index c767770759..eb35373a1f 100644
--- a/packages/fcl-web/src/base/Makefile
+++ b/packages/fcl-web/src/base/Makefile
@@ -1,8 +1,8 @@
#
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/09/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/03/21]
#
default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
BSDs = freebsd netbsd openbsd darwin
UNIXs = linux $(BSDs) solaris qnx haiku
LIMIT83fs = go32v2 os2 emx watcom
@@ -268,190 +268,193 @@ override PACKAGE_NAME=fcl-web
override PACKAGE_VERSION=2.5.1
PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-web/Makefile.fpc,$(PACKAGESDIR))))))
ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-nativent)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
endif
ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate custfcgi fpfcgi
endif
ifeq ($(FULL_TARGET),i386-linux)
override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp
@@ -564,6 +567,9 @@ endif
ifeq ($(FULL_TARGET),powerpc-embedded)
override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp
endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp
+endif
ifeq ($(FULL_TARGET),sparc-linux)
override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp
endif
@@ -751,6 +757,9 @@ endif
ifeq ($(FULL_TARGET),powerpc-embedded)
override COMPILER_OPTIONS+=-S2h
endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_OPTIONS+=-S2h
+endif
ifeq ($(FULL_TARGET),sparc-linux)
override COMPILER_OPTIONS+=-S2h
endif
@@ -1203,6 +1212,11 @@ ifeq ($(OS_TARGET),NativeNT)
SHAREDLIBEXT=.dll
SHORTSUFFIX=nativent
endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
else
ifeq ($(OS_TARGET),go32v1)
PPUEXT=.pp1
@@ -2196,6 +2210,18 @@ REQUIRE_PACKAGES_FCL-PASSRC=1
REQUIRE_PACKAGES_FCL-ASYNC=1
REQUIRE_PACKAGES_FCL-NET=1
endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_FCL-BASE=1
+REQUIRE_PACKAGES_FCL-XML=1
+REQUIRE_PACKAGES_FCL-DB=1
+REQUIRE_PACKAGES_FCL-PROCESS=1
+REQUIRE_PACKAGES_HTTPD22=1
+REQUIRE_PACKAGES_FASTCGI=1
+REQUIRE_PACKAGES_FCL-PASSRC=1
+REQUIRE_PACKAGES_FCL-ASYNC=1
+REQUIRE_PACKAGES_FCL-NET=1
+endif
ifeq ($(FULL_TARGET),sparc-linux)
REQUIRE_PACKAGES_RTL=1
REQUIRE_PACKAGES_FCL-BASE=1
diff --git a/packages/fcl-web/src/base/Makefile.fpc b/packages/fcl-web/src/base/Makefile.fpc
index b384ce40ac..d4efc0294c 100644
--- a/packages/fcl-web/src/base/Makefile.fpc
+++ b/packages/fcl-web/src/base/Makefile.fpc
@@ -7,7 +7,7 @@ main=fcl-web
version=2.5.1
[target]
-units=httpdefs fphttp custweb custcgi fpcgi fphtml websession fpweb \
+units=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb \
webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate
rsts=fpcgi fphtml fpweb websession cgiapp
diff --git a/packages/fcl-web/src/base/fpapache.pp b/packages/fcl-web/src/base/fpapache.pp
index fa760feffe..62e0a9f0ec 100644
--- a/packages/fcl-web/src/base/fpapache.pp
+++ b/packages/fcl-web/src/base/fpapache.pp
@@ -617,7 +617,8 @@ end;
function __dummythread(p: pointer): ptrint;
begin
-//empty
+ sleep(1000);
+ Result:=0;
end;
{ TCustomApacheApplication }
@@ -739,8 +740,6 @@ end;
Initialization
BeginThread(@__dummythread);//crash prevention for simultaneous requests
- sleep(300);
-
InitApache;
Finalization
diff --git a/packages/fcl-web/src/base/fphttp.pp b/packages/fcl-web/src/base/fphttp.pp
index 4ee4c424a7..e160477fb6 100644
--- a/packages/fcl-web/src/base/fphttp.pp
+++ b/packages/fcl-web/src/base/fphttp.pp
@@ -112,9 +112,64 @@ Type
property Kind: TWebModuleKind read FWebModuleKind write FWebModuleKind default wkPooled;
Property BaseURL : String Read FBaseURL Write FBaseURL;
end;
-
TCustomHTTPModuleClass = Class of TCustomHTTPModule;
+ { TSessionHTTPModule }
+
+ TSessionHTTPModule = Class(TCustomHTTPModule)
+ Private
+ FCreateSession : Boolean;
+ FOnNewSession: TNotifyEvent;
+ FOnSessionExpired: TNotifyEvent;
+ FSession: TCustomSession;
+ FSessionRequest : TRequest;
+ function GetSession: TCustomSession;
+ procedure SetSession(const AValue: TCustomSession);
+ Protected
+ Procedure CheckSession(ARequest : TRequest);
+ Procedure InitSession(AResponse : TResponse);
+ Procedure UpdateSession(AResponse : TResponse);
+ Procedure DoneSession; virtual;
+ Public
+ destructor destroy; override;
+ Procedure Notification(AComponent : TComponent;Operation : TOperation); override;
+ Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); override;
+ Property CreateSession : Boolean Read FCreateSession Write FCreateSession;
+ Property Session : TCustomSession Read GetSession Write SetSession;
+ Property OnNewSession : TNotifyEvent Read FOnNewSession Write FOnNewSession;
+ Property OnSessionExpired : TNotifyEvent Read FOnSessionExpired Write FOnSessionExpired;
+ end;
+ TSessionHTTPModuleClass = Class of TSessionHTTPModule;
+
+ EWebSessionError = Class(HTTPError);
+
+ { TSessionFactory }
+
+ TSessionFactory = Class(TComponent)
+ private
+ FTimeOut: Integer;
+ FCleanupInterval: Integer;
+ FDoneCount: Integer;
+ protected
+ // Override in descendants
+ Function DoCreateSession(ARequest : TRequest) : TCustomSession; virtual; abstract;
+ Procedure DoDoneSession(Var ASession : TCustomSession); virtual; abstract;
+ Procedure DoCleanupSessions; virtual; abstract;
+ Property DoneCount : Integer Read FDoneCount;
+ Public
+ Function CreateSession(ARequest : TRequest) : TCustomSession;
+ Procedure DoneSession(Var ASession : TCustomSession);
+ Procedure CleanupSessions;
+ // Number of requests before sweeping sessions for stale sessions.
+ // Default 1000. Set to 0 to disable.
+ // Note that for cgi programs, this will never happen, since the count is reset to 0
+ // with each invocation. It takes a special factory to handle that, or a value of 1.
+ Property CleanupInterval : Integer read FCleanupInterval Write FCleanUpInterval;
+ // Default timeout for sessions, in minutes.
+ Property DefaultTimeOutMinutes : Integer Read FTimeOut Write FTimeOut;
+ end;
+ TSessionFactoryClass = Class of TSessionFactory;
+
{ TModuleItem }
TModuleItem = Class(TCollectionItem)
@@ -148,7 +203,10 @@ Procedure RegisterHTTPModule(Const ModuleName : String; ModuleClass : TCustomHTT
Var
ModuleFactory : TModuleFactory;
-
+ SessionFactoryClass : TSessionFactoryClass = nil;
+
+Function SessionFactory : TSessionFactory;
+
Resourcestring
SErrNosuchModule = 'No such module registered: "%s"';
SErrNoSuchAction = 'No action found for action: "%s"';
@@ -156,13 +214,54 @@ Resourcestring
SErrNoDefaultAction = 'No action name and no default action';
SErrInvActNoDefaultAction = 'Invalid action name and no default action';
SErrRequestNotHandled = 'Web request was not handled by actions.';
-
+ SErrNoSessionFactoryClass = 'No session manager class available. Include iniwebsession unit and recompile.';
+ SErrNoSessionOutsideRequest = 'Default session not available outside handlerequest';
Implementation
{$ifdef cgidebug}
uses dbugintf;
{$endif}
+Var
+ GSM : TSessionFactory;
+
+Function SessionFactory : TSessionFactory;
+
+begin
+ if GSM=Nil then
+ begin
+ if (SessionFactoryClass=Nil) then
+ Raise EFPHTTPError.Create(SErrNoSessionFactoryClass);
+ GSM:=SessionFactoryClass.Create(Nil)
+ end;
+ Result:=GSM;
+end;
+
+{ TSessionFactory }
+
+function TSessionFactory.CreateSession(ARequest: TRequest): TCustomSession;
+begin
+ Result:=DoCreateSession(ARequest);
+ if (FTimeOut<>0) and Assigned(Result) then
+ Result.TimeoutMinutes:=FTimeOut;
+end;
+
+procedure TSessionFactory.DoneSession(var ASession: TCustomSession);
+begin
+ DoDoneSession(ASession);
+ if (FCleanupInterval>0) then
+ begin
+ Inc(FDoneCount);
+ If (FDoneCount>=FCleanupInterval) then
+ CleanupSessions;
+ end;
+end;
+
+procedure TSessionFactory.CleanupSessions;
+begin
+ FDoneCount:=0;
+ DoCleanupSessions;
+end;
{ TModuleFactory }
@@ -464,9 +563,107 @@ begin
Dec(Result);
end;
+function TSessionHTTPModule.GetSession: TCustomSession;
+begin
+{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule.GetSession');{$endif}
+ If (csDesigning in ComponentState) then
+ begin
+{$ifdef cgidebug}SendDebug('Sending session');{$endif}
+ Result:=FSession
+ end
+ else
+ begin
+ If (FSession=Nil) then
+ begin
+{$ifdef cgidebug}SendDebug('Getting default session');{$endif}
+ if (FSessionRequest=Nil) then
+ Raise EFPHTTPError.Create(SErrNoSessionOutsideRequest);
+ FSession:=SessionFactory.CreateSession(FSessionRequest);
+ FSession.FreeNotification(Self);
+ end;
+ Result:=FSession
+ end;
+{$ifdef cgidebug}SendMethodExit('SessionHTTPModule.GetSession');{$endif}
+end;
+
+procedure TSessionHTTPModule.SetSession(const AValue: TCustomSession);
+
+begin
+ if FSession<>AValue then
+ begin
+ If Assigned(FSession) then
+ FSession.RemoveFreeNotification(Self);
+ FSession:=AValue;
+ If Assigned(FSession) then
+ FSession.FreeNotification(Self);
+ end;
+end;
+
+procedure TSessionHTTPModule.CheckSession(ARequest : TRequest);
+
+begin
+{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule('+Name+').CheckSession');{$endif}
+ If CreateSession then
+ begin
+ If (FSession=Nil) then
+ FSession:=SessionFactory.CreateSession(ARequest);
+ if Assigned(FSession) then
+ FSession.InitSession(ARequest,FOnNewSession,FOnSessionExpired);
+ end;
+{$ifdef cgidebug}SendMethodExit('SessionHTTPModule('+Name+').CheckSession');{$endif}
+end;
+
+procedure TSessionHTTPModule.InitSession(AResponse: TResponse);
+begin
+{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule('+Name+').InitSession');{$endif}
+ If CreateSession and Assigned(FSession) then
+ FSession.InitResponse(AResponse);
+{$ifdef cgidebug}SendMethodExit('SessionHTTPModule('+Name+').InitSession');{$endif}
+end;
+
+procedure TSessionHTTPModule.UpdateSession(AResponse: TResponse);
+begin
+ If CreateSession And Assigned(FSession) then
+ FSession.UpdateResponse(AResponse);
+end;
+
+procedure TSessionHTTPModule.DoneSession;
+begin
+ // Session manager may or may not destroy the session.
+ SessionFactory.DoneSession(FSession);
+ // In each case, our reference is no longer valid.
+ FSession:=Nil;
+end;
+
+destructor TSessionHTTPModule.destroy;
+begin
+ // Prevent memory leaks.
+ If Assigned(FSession) then
+ DoneSession;
+ inherited destroy;
+end;
+
+procedure TSessionHTTPModule.Notification(AComponent: TComponent;
+ Operation: TOperation);
+begin
+{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule('+Name+').Notification');{$endif}
+ inherited Notification(AComponent, Operation);
+ If (Operation=opRemove) then
+ if (AComponent=FSession) Then
+ FSession:=Nil;
+{$ifdef cgidebug}SendMethodExit('SessionHTTPModule('+Name+').Notification');{$endif}
+end;
+
+procedure TSessionHTTPModule.HandleRequest(ARequest: TRequest;
+ AResponse: TResponse);
+begin
+ FSessionRequest:=ARequest;
+end;
+
Initialization
ModuleFactory:=TModuleFactory.Create(TModuleItem);
Finalization
FreeAndNil(ModuleFactory);
+ FreeAndNil(GSM);
end.
diff --git a/packages/fcl-web/src/base/fpweb.pp b/packages/fcl-web/src/base/fpweb.pp
index ebac7c1256..6a3a70e2ad 100644
--- a/packages/fcl-web/src/base/fpweb.pp
+++ b/packages/fcl-web/src/base/fpweb.pp
@@ -18,7 +18,7 @@ unit fpWeb;
interface
uses
- Classes, SysUtils, httpdefs, fphttp, fptemplate, websession;
+ Classes, SysUtils, httpdefs, fphttp, fptemplate;
Type
diff --git a/packages/fcl-web/src/base/httpdefs.pp b/packages/fcl-web/src/base/httpdefs.pp
index e0ff09c05c..7a01039d96 100644
--- a/packages/fcl-web/src/base/httpdefs.pp
+++ b/packages/fcl-web/src/base/httpdefs.pp
@@ -1700,6 +1700,7 @@ Var
begin
CreateGUID(G);
Result:=GuiDToString(G);
+ Result:=Copy(Result,2,36);
end;
constructor TCustomSession.Create(AOwner: TComponent);
diff --git a/packages/fcl-web/src/base/websession.pp b/packages/fcl-web/src/base/websession.pp
index 4a607db441..badd035054 100644
--- a/packages/fcl-web/src/base/websession.pp
+++ b/packages/fcl-web/src/base/websession.pp
@@ -11,76 +11,19 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
-unit websession;
+unit websession deprecated;
{$mode objfpc}{$H+}
{ $define cgidebug}
interface
uses
- Classes, SysUtils, fphttp, inifiles, httpdefs;
+ Classes, SysUtils, fphttp, iniwebsession, httpdefs;
Type
+ TIniWebSession = iniwebsession.TIniWebSession;
- { TSessionHTTPModule }
-
- TSessionHTTPModule = Class(TCustomHTTPModule)
- Private
- FCreateSession : Boolean;
- FOnNewSession: TNotifyEvent;
- FOnSessionExpired: TNotifyEvent;
- FSession: TCustomSession;
- function GetSession: TCustomSession;
- procedure SetSession(const AValue: TCustomSession);
- Protected
- Procedure CheckSession(ARequest : TRequest);
- Procedure InitSession(AResponse : TResponse);
- Procedure UpdateSession(AResponse : TResponse);
- Procedure DoneSession; virtual;
- Public
- destructor destroy; override;
- Procedure Notification(AComponent : TComponent;Operation : TOperation); override;
- Procedure Loaded; Override;
- Property CreateSession : Boolean Read FCreateSession Write FCreateSession;
- Property Session : TCustomSession Read GetSession Write SetSession;
- Property OnNewSession : TNotifyEvent Read FOnNewSession Write FOnNewSession;
- Property OnSessionExpired : TNotifyEvent Read FOnSessionExpired Write FOnSessionExpired;
- end;
-
- { TIniWebSession }
-
- TIniWebSession = Class(TCustomSession)
- Private
- FSessionStarted : Boolean;
- FCached: Boolean;
- FIniFile : TMemInifile;
- FSessionCookie: String;
- FSessionCookiePath: String;
- FSessionDir: String;
- FTerminated :Boolean;
- SID : String;
- private
- procedure FreeIniFile;
- function GetSessionDir: String;
- Protected
- Procedure CheckSession;
- Function GetSessionID : String; override;
- Function GetSessionVariable(VarName : String) : String; override;
- procedure SetSessionVariable(VarName : String; const AValue: String); override;
- Property Cached : Boolean Read FCached Write FCached;
- property SessionCookie : String Read FSessionCookie Write FSessionCookie;
- Property SessionDir : String Read GetSessionDir Write FSessionDir;
- Property SessionCookiePath : String Read FSessionCookiePath write FSessionCookiePath;
- Public
- Destructor Destroy; override;
- Procedure Terminate; override;
- Procedure UpdateResponse(AResponse : TResponse); override;
- Procedure InitSession(ARequest : TRequest; OnNewSession, OnExpired: TNotifyEvent); override;
- Procedure InitResponse(AResponse : TResponse); override;
- Procedure RemoveVariable(VariableName : String); override;
- end;
-
- TFPWebSession = Class(TIniWebSession)
+ TFPWebSession = Class(iniwebsession.TIniWebSession)
Public
Property Cached;
property SessionCookie;
@@ -88,44 +31,32 @@ Type
Property SessionDir;
end;
- EWebSessionError = Class(HTTPError);
+Type
TGetSessionEvent = Procedure(Var ASession : TCustomSession) of object;
-
Var
- GlobalSessionDir : String;
- OnGetDefaultSession : TGetSessionEvent;
+ GlobalSessionDir : String deprecated;
+ OnGetDefaultSession : TGetSessionEvent deprecated;
Function GetDefaultSession : TCustomSession;
implementation
-{$ifdef cgidebug}
-uses dbugintf;
-{$endif}
-
-Const
- // Sections in ini file
- SSession = 'Session';
- SData = 'Data';
-
- KeyStart = 'Start'; // Start time of session
- KeyLast = 'Last'; // Last seen time of session
- KeyTimeOut = 'Timeout'; // Timeout in seconds;
-
- SFPWebSession = 'FPWebSession'; // Cookie name for session.
-
-resourcestring
- SErrSessionTerminated = 'No web session active: Session was terminated';
- SErrNoSession = 'No web session active: Session was not started';
-
Function GetDefaultSession : TCustomSession;
+Var
+ TD : String;
+
begin
{$ifdef cgidebug}SendMethodEnter('GetDefaultSession');{$endif}
Result:=Nil;
If (GlobalSessionDir='') then
- GlobalSessionDir:=IncludeTrailingPathDelimiter(GetTempDir(True))
+ begin
+ TD:=IncludeTrailingPathDelimiter(GetTempDir(True));
+ GlobalSessionDir:=TD+'fpwebsessions'+PathDelim;
+ if Not ForceDirectories(GlobalSessionDir) then
+ GlobalSessionDir:=TD; // Assuming temp dir is writeable
+ end
else
GlobalSessionDir:=IncludeTrailingPathDelimiter(GlobalSessionDir);
{$ifdef cgidebug}SendDebug('GetDefaultSession, session dir: '+GlobalSessionDir);{$endif}
@@ -134,285 +65,16 @@ begin
if (Result=Nil) then
begin
{$ifdef cgidebug}Senddebug('Creating iniwebsession');{$endif}
- Result:=TFPWebSession.Create(Nil);
+ if (SessionFactory is TIniSessionFactory) then
+ if ((SessionFactory as TIniSessionFactory).SessionDir='') then
+ (SessionFactory as TIniSessionFactory).SessionDir:=GlobalSessionDir;
+ Result:=SessionFactory.CreateSession(Nil);
end;
{$ifdef cgidebug}SendMethodExit('GetDefaultSession');{$endif}
end;
-{ TIniWebSession }
-
-function TIniWebSession.GetSessionID: String;
-begin
- If (SID='') then
- SID:=inherited GetSessionID;
- Result:=SID;
-end;
-
-procedure TIniWebSession.FreeIniFile;
-begin
- If Cached and Assigned(FIniFile) then
- TMemIniFile(FIniFile).UpdateFile;
- FreeAndNil(FIniFile);
-end;
-
-function TIniWebSession.GetSessionDir: String;
-begin
- Result:=FSessionDir;
- If (Result='') then
- Result:=GlobalSessionDir;
-end;
-
-Procedure TIniWebSession.CheckSession;
-
-begin
- If Not Assigned(FInifile) then
- if FTerminated then
- Raise EWebSessionError.Create(SErrSessionTerminated)
- else
- Raise EWebSessionError.Create(SErrNoSession)
-
-end;
-
-function TIniWebSession.GetSessionVariable(VarName: String): String;
-begin
- CheckSession;
- Result:=FIniFile.ReadString(SData,VarName,'');
-end;
-
-procedure TIniWebSession.SetSessionVariable(VarName: String;
- const AValue: String);
-begin
- CheckSession;
- FIniFile.WriteString(SData,VarName,AValue);
- If Not Cached then
- TMemIniFile(FIniFile).UpdateFile;
-end;
-
-destructor TIniWebSession.Destroy;
-begin
- // In case an exception occured and UpdateResponse is not called,
- // write the updates to disk and free FIniFile
- FreeIniFile;
- inherited Destroy;
-end;
-
-procedure TIniWebSession.Terminate;
-begin
- FTerminated:=True;
- If Assigned(FIniFile) Then
- begin
- DeleteFile(Finifile.FileName);
- FreeAndNil(FIniFile);
- end;
-end;
-
-procedure TIniWebSession.UpdateResponse(AResponse: TResponse);
-begin
- // Do nothing. Init has done the job.
- FreeIniFile;
-end;
-
-procedure TIniWebSession.InitSession(ARequest: TRequest; OnNewSession,OnExpired: TNotifyEvent);
-
-Var
- L,D : TDateTime;
- T : Integer;
- S : String;
-begin
-{$ifdef cgidebug}SendMethodEnter('TIniWebSession.InitSession');{$endif}
- // First initialize all session-dependent properties to their default, because
- // in Apache-modules or fcgi programs the session-instance is re-used
- SID := '';
- FSessionStarted := False;
- FTerminated := False;
- // If a exception occured during a prior request FIniFile is still not freed
- if assigned(FIniFile) then FreeIniFile;
-
- If (SessionCookie='') then
- SessionCookie:=SFPWebSession;
- S:=ARequest.CookieFields.Values[SessionCookie];
- // have session cookie ?
- If (S<>'') then
- begin
-{$ifdef cgidebug}SendDebug('Reading ini file:'+S);{$endif}
- FiniFile:=TMemIniFile.Create(IncludeTrailingPathDelimiter(SessionDir)+S);
- L:=Finifile.ReadDateTime(SSession,KeyLast,0);
-{$ifdef cgidebug}
- If (L=0) then
- SendDebug('No datetime in inifile (or not valid datetime : '+Finifile.ReadString(SSession,KeyLast,''));
-{$endif}
- T:=FIniFile.ReadInteger(SSession,KeyTimeOut,Self.TimeOutMinutes);
-{$ifdef cgidebug}SendDebug('Timeout :'+IntToStr(t));{$endif}
-{$ifdef cgidebug}SendDebug('Last :'+FormatDateTime('yyyy/mm/dd hh:nn:ss.zzz',L));{$endif}
- If ((Now-L)>(T/(24*60))) then
- begin
-{$ifdef cgidebug}SendDebug('Timeout :'+FloatToStr(T/(24*60)));{$endif}
-{$ifdef cgidebug}SendDebug('Timeout :'+FormatDateTime('hh:nn:ss.zzz',(T/(24*60))));{$endif}
-{$ifdef cgidebug}SendDebug('Diff :'+FormatDateTime('hh:nn:ss.zzz',Now-L));{$endif}
-{$ifdef cgidebug}SendDebug('Ini file session expired: '+S);{$endif}
- // Expire session.
- If Assigned(OnExpired) then
- OnExpired(Self);
- DeleteFile(FIniFIle.FileName);
- FreeAndNil(FInifile);
- S:='';
- end
- else
- SID:=S;
- end;
- If (S='') then
- begin
- If Assigned(OnNewSession) then
- OnNewSession(Self);
- GetSessionID;
- S:=IncludeTrailingPathDelimiter(SessionDir)+SessionID;
-{$ifdef cgidebug}SendDebug('Creating new Ini file : '+S);{$endif}
- FIniFile:=TMemIniFile.Create(S);
- FIniFile.WriteDateTime(SSession,KeyStart,Now);
- FIniFile.WriteInteger(SSession,KeyTimeOut,Self.TimeOutMinutes);
- FSessionStarted:=True;
- end;
- FIniFile.WriteDateTime(SSession,KeyLast,Now);
- If not FCached then
- FIniFile.UpdateFile;
-{$ifdef cgidebug}SendMethodExit('TIniWebSession.InitSession');{$endif}
-end;
-
-procedure TIniWebSession.InitResponse(AResponse: TResponse);
-
-Var
- C : TCookie;
-
-begin
-{$ifdef cgidebug}SendMethodEnter('TIniWebSession.InitResponse');{$endif}
- If FSessionStarted then
- begin
-{$ifdef cgidebug}SendDebug('Session started');{$endif}
- C:=AResponse.Cookies.FindCookie(SessionCookie);
- If (C=Nil) then
- begin
- C:=AResponse.Cookies.Add;
- C.Name:=SessionCookie;
- end;
- C.Value:=SID;
- C.Path:=FSessionCookiePath;
- end
- else If FTerminated then
- begin
-{$ifdef cgidebug}SendDebug('Session terminated');{$endif}
- C:=AResponse.Cookies.Add;
- C.Name:=SessionCookie;
- C.Value:='';
- end;
-{$ifdef cgidebug}SendMethodExit('TIniWebSession.InitResponse');{$endif}
-end;
-
-procedure TIniWebSession.RemoveVariable(VariableName: String);
-begin
-{$ifdef cgidebug}SendMethodEnter('TIniWebSession.RemoveVariable');{$endif}
- CheckSession;
- FIniFile.DeleteKey(SData,VariableName);
- If Not Cached then
- TMemIniFile(FIniFile).UpdateFile;
-{$ifdef cgidebug}SendMethodExit('TIniWebSession.RemoveVariable');{$endif}
-end;
-
-
-function TSessionHTTPModule.GetSession: TCustomSession;
-begin
-{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule.GetSession');{$endif}
- If (csDesigning in ComponentState) then
- begin
-{$ifdef cgidebug}SendDebug('Sending session');{$endif}
- Result:=FSession
- end
- else
- begin
- If (FSession=Nil) then
- begin
-{$ifdef cgidebug}SendDebug('Getting default session');{$endif}
- FSession:=GetDefaultSession;
- FSession.FreeNotification(Self);
- end;
- Result:=FSession
- end;
-{$ifdef cgidebug}SendMethodExit('SessionHTTPModule.GetSession');{$endif}
-end;
-
-procedure TSessionHTTPModule.SetSession(const AValue: TCustomSession);
-
-begin
- if FSession<>AValue then
- begin
- If Assigned(FSession) then
- FSession.RemoveFreeNotification(Self);
- FSession:=AValue;
- If Assigned(FSession) then
- FSession.FreeNotification(Self);
- end;
-end;
-
-procedure TSessionHTTPModule.CheckSession(ARequest : TRequest);
-
-begin
-{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule('+Name+').CheckSession');{$endif}
- If CreateSession then
- begin
- If (FSession=Nil) then
- FSession:=GetDefaultSession;
- if Assigned(FSession) then
- FSession.InitSession(ARequest,FOnNewSession,FOnSessionExpired);
- end;
-{$ifdef cgidebug}SendMethodExit('SessionHTTPModule('+Name+').CheckSession');{$endif}
-end;
-
-procedure TSessionHTTPModule.InitSession(AResponse: TResponse);
-begin
-{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule('+Name+').InitSession');{$endif}
- If CreateSession and Assigned(FSession) then
- FSession.InitResponse(AResponse);
-{$ifdef cgidebug}SendMethodExit('SessionHTTPModule('+Name+').InitSession');{$endif}
-end;
-
-procedure TSessionHTTPModule.UpdateSession(AResponse: TResponse);
-begin
- If CreateSession And Assigned(FSession) then
- FSession.UpdateResponse(AResponse);
-end;
-
-procedure TSessionHTTPModule.DoneSession;
-begin
- FreeAndNil(FSession);
-end;
-
-destructor TSessionHTTPModule.destroy;
-begin
- // Prevent memory leaks.
- If Assigned(FSession) then
- DoneSession;
- inherited destroy;
-end;
-
-procedure TSessionHTTPModule.Notification(AComponent: TComponent;
- Operation: TOperation);
-begin
-{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule('+Name+').Notification');{$endif}
- inherited Notification(AComponent, Operation);
- If (Operation=opRemove) then
- if (AComponent=FSession) Then
- FSession:=Nil;
-{$ifdef cgidebug}SendMethodExit('SessionHTTPModule('+Name+').Notification');{$endif}
-end;
-
-procedure TSessionHTTPModule.Loaded;
-
-begin
-{$ifdef cgidebug}SendMethodEnter('SessionHTTPModule.Loaded');{$endif}
- inherited Loaded;
- If CreateSession And (FSession=Nil) then
- FSession:=GetDefaultSession;
-{$ifdef cgidebug}SendMethodExit('SessionHTTPModule.Loaded');{$endif}
-end;
+initialization
+ IniWebSessionClass:=TFPWebSession;
end.
diff --git a/packages/fcl-web/src/jsonrpc/fpextdirect.pp b/packages/fcl-web/src/jsonrpc/fpextdirect.pp
index c8fde13c81..5921b641cf 100644
--- a/packages/fcl-web/src/jsonrpc/fpextdirect.pp
+++ b/packages/fcl-web/src/jsonrpc/fpextdirect.pp
@@ -6,7 +6,7 @@ unit fpextdirect;
interface
uses
- Classes, SysUtils, fpjson, fpjsonrpc, webjsonrpc, httpdefs,websession;
+ Classes, SysUtils, fpjson, fpjsonrpc, webjsonrpc, httpdefs;
Const
DefaultExtDirectOptions = DefaultDispatchOptions + [jdoRequireClass];
@@ -132,6 +132,8 @@ Type
Property RouterPath;
Property CreateSession;
Property NameSpace;
+ Property OnNewSession;
+ Property OnSessionExpired;
end;
implementation
diff --git a/packages/fcl-web/src/jsonrpc/webjsonrpc.pp b/packages/fcl-web/src/jsonrpc/webjsonrpc.pp
index e7144e0bb2..4a5995a7dd 100644
--- a/packages/fcl-web/src/jsonrpc/webjsonrpc.pp
+++ b/packages/fcl-web/src/jsonrpc/webjsonrpc.pp
@@ -6,7 +6,7 @@ unit webjsonrpc;
interface
uses
- Classes, SysUtils, fpjson, fpjsonrpc, httpdefs, fphttp, jsonparser, websession;
+ Classes, SysUtils, fpjson, fpjsonrpc, httpdefs, fphttp, jsonparser;
Type
{ ---------------------------------------------------------------------
diff --git a/packages/fcl-web/src/webdata/extjsjson.pp b/packages/fcl-web/src/webdata/extjsjson.pp
index 01595bdc74..6f44894ae5 100644
--- a/packages/fcl-web/src/webdata/extjsjson.pp
+++ b/packages/fcl-web/src/webdata/extjsjson.pp
@@ -571,6 +571,7 @@ Var
I : Integer;
begin
+ Avalue:='';
Result:=False;
if CheckData then
begin
diff --git a/packages/fcl-web/src/webdata/fpwebdata.pp b/packages/fcl-web/src/webdata/fpwebdata.pp
index 68c3591e61..8d5e8a3b80 100644
--- a/packages/fcl-web/src/webdata/fpwebdata.pp
+++ b/packages/fcl-web/src/webdata/fpwebdata.pp
@@ -5,7 +5,7 @@ unit fpwebdata;
interface
uses
- Classes, SysUtils, httpdefs, fphttp, db, websession;
+ Classes, SysUtils, httpdefs, fphttp, db;
type