Browse Source

+ Added HTTPApp for standalone webserver and webfilemodule for standalone serving of files

git-svn-id: trunk@17632 -
michael 14 years ago
parent
commit
c41061f1aa

+ 3 - 0
.gitattributes

@@ -2472,6 +2472,7 @@ packages/fcl-web/src/base/README.txt svneol=native#text/plain
 packages/fcl-web/src/base/cgiapp.pp svneol=native#text/plain
 packages/fcl-web/src/base/custcgi.pp svneol=native#text/plain
 packages/fcl-web/src/base/custfcgi.pp svneol=native#text/plain
+packages/fcl-web/src/base/custhttpapp.pp svneol=native#text/plain
 packages/fcl-web/src/base/custweb.pp svneol=native#text/plain
 packages/fcl-web/src/base/ezcgi.pp svneol=native#text/plain
 packages/fcl-web/src/base/fcgigate.pp svneol=native#text/plain
@@ -2481,9 +2482,11 @@ packages/fcl-web/src/base/fpdatasetform.pp svneol=native#text/plain
 packages/fcl-web/src/base/fpfcgi.pp svneol=native#text/plain
 packages/fcl-web/src/base/fphtml.pp svneol=native#text/plain
 packages/fcl-web/src/base/fphttp.pp svneol=native#text/plain
+packages/fcl-web/src/base/fphttpapp.pp svneol=native#text/plain
 packages/fcl-web/src/base/fphttpclient.pp svneol=native#text/plain
 packages/fcl-web/src/base/fphttpserver.pp svneol=native#text/plain
 packages/fcl-web/src/base/fpweb.pp svneol=native#text/plain
+packages/fcl-web/src/base/fpwebfile.pp svneol=native#text/plain
 packages/fcl-web/src/base/httpdefs.pp svneol=native#text/plain
 packages/fcl-web/src/base/iniwebsession.pp svneol=native#text/plain
 packages/fcl-web/src/base/webpage.pp svneol=native#text/plain

+ 329 - 71
packages/fcl-web/src/base/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/03/21]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/06/02]
 #
 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 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
@@ -107,24 +107,36 @@ FPC=$(PP)
 endif
 endif
 ifndef FPC
+DETERMINE_NATIVE_COMPILER=1
+else
+ifdef CROSSCOMPILE
+ifndef FPCFPMAKE
+DETERMINE_NATIVE_COMPILER=1
+endif
+endif
+endif
+ifdef DETERMINE_NATIVE_COMPILER
 FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
 ifneq ($(FPCPROG),)
 FPCPROG:=$(firstword $(FPCPROG))
 ifneq ($(CPU_TARGET),)
-FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+FPCNATIVE:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
 else
-FPC:=$(shell $(FPCPROG) -PB)
+FPCNATIVE:=$(shell $(FPCPROG) -PB)
 endif
-ifneq ($(findstring Error,$(FPC)),)
-override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+ifneq ($(findstring Error,$(FPCNATIVE)),)
+override FPCNATIVE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
 else
-ifeq ($(strip $(wildcard $(FPC))),)
-FPC:=$(firstword $(FPCPROG))
+ifeq ($(strip $(wildcard $(FPCNATIVE))),)
+FPCNATIVE:=$(firstword $(FPCPROG))
 endif
 endif
 else
-override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+override FPCNATIVE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
 endif
+ifndef FPC
+FPC=$(FPCNATIVE)
 endif
 override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
 override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
@@ -264,197 +276,214 @@ ifeq ($(UNITSDIR),)
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+ifndef FPCFPMAKE
+ifdef CROSSCOMPILE
+ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),)
+FPCFPMAKE:=$(FPCNATIVE)
+else
+FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR))))
+FPMAKE_SKIP_CONFIG=-n
+export FPCFPMAKE
+export FPMAKE_SKIP_CONFIG
+endif
+else
+FPCFPMAKE=$(FPC)
+FPMAKE_SKIP_CONFIG=-n
+export FPCFPMAKE
+export FPMAKE_SKIP_CONFIG
+endif
+endif
 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 iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-nativent)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 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 fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient  custfcgi fpfcgi
+override TARGET_UNITS+=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver fphttpclient custhttpapp fphttpapp fpwebfile  custfcgi fpfcgi
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient
@@ -2629,6 +2658,15 @@ UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
 else
 UNITDIR_RTL=$(PACKAGEDIR_RTL)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_RTL)/$(OS_TARGET) $(FPCMADE)
@@ -2646,6 +2684,9 @@ endif
 ifdef UNITDIR_RTL
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 endif
+ifdef UNITDIR_FPMAKE_RTL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_RTL)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FCL-BASE
 PACKAGEDIR_FCL-BASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2655,6 +2696,15 @@ UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-BASE)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-BASE)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-BASE=$(PACKAGEDIR_FCL-BASE)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FCL-BASE)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FCL-BASE) $(FPCMADE)
@@ -2672,6 +2722,9 @@ endif
 ifdef UNITDIR_FCL-BASE
 override COMPILER_UNITDIR+=$(UNITDIR_FCL-BASE)
 endif
+ifdef UNITDIR_FPMAKE_FCL-BASE
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-BASE)
+endif
 endif
 ifdef REQUIRE_PACKAGES_ICONVENC
 PACKAGEDIR_ICONVENC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /iconvenc/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2681,6 +2734,15 @@ UNITDIR_ICONVENC=$(PACKAGEDIR_ICONVENC)/units/$(TARGETSUFFIX)
 else
 UNITDIR_ICONVENC=$(PACKAGEDIR_ICONVENC)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_ICONVENC)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_ICONVENC=$(PACKAGEDIR_ICONVENC)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_ICONVENC)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_ICONVENC=$(PACKAGEDIR_ICONVENC)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_ICONVENC=$(PACKAGEDIR_ICONVENC)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_ICONVENC)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_ICONVENC) $(FPCMADE)
@@ -2698,6 +2760,9 @@ endif
 ifdef UNITDIR_ICONVENC
 override COMPILER_UNITDIR+=$(UNITDIR_ICONVENC)
 endif
+ifdef UNITDIR_FPMAKE_ICONVENC
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_ICONVENC)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FCL-XML
 PACKAGEDIR_FCL-XML:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-xml/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2707,6 +2772,15 @@ UNITDIR_FCL-XML=$(PACKAGEDIR_FCL-XML)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FCL-XML=$(PACKAGEDIR_FCL-XML)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-XML)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-XML=$(PACKAGEDIR_FCL-XML)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-XML)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-XML=$(PACKAGEDIR_FCL-XML)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-XML=$(PACKAGEDIR_FCL-XML)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FCL-XML)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FCL-XML) $(FPCMADE)
@@ -2724,6 +2798,9 @@ endif
 ifdef UNITDIR_FCL-XML
 override COMPILER_UNITDIR+=$(UNITDIR_FCL-XML)
 endif
+ifdef UNITDIR_FPMAKE_FCL-XML
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-XML)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FCL-DB
 PACKAGEDIR_FCL-DB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-db/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2733,6 +2810,15 @@ UNITDIR_FCL-DB=$(PACKAGEDIR_FCL-DB)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FCL-DB=$(PACKAGEDIR_FCL-DB)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-DB)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-DB=$(PACKAGEDIR_FCL-DB)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-DB)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-DB=$(PACKAGEDIR_FCL-DB)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-DB=$(PACKAGEDIR_FCL-DB)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FCL-DB)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FCL-DB) $(FPCMADE)
@@ -2750,6 +2836,9 @@ endif
 ifdef UNITDIR_FCL-DB
 override COMPILER_UNITDIR+=$(UNITDIR_FCL-DB)
 endif
+ifdef UNITDIR_FPMAKE_FCL-DB
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-DB)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FCL-PROCESS
 PACKAGEDIR_FCL-PROCESS:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-process/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2759,6 +2848,15 @@ UNITDIR_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-PROCESS)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-PROCESS)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-PROCESS=$(PACKAGEDIR_FCL-PROCESS)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FCL-PROCESS)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FCL-PROCESS) $(FPCMADE)
@@ -2776,6 +2874,9 @@ endif
 ifdef UNITDIR_FCL-PROCESS
 override COMPILER_UNITDIR+=$(UNITDIR_FCL-PROCESS)
 endif
+ifdef UNITDIR_FPMAKE_FCL-PROCESS
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-PROCESS)
+endif
 endif
 ifdef REQUIRE_PACKAGES_HTTPD22
 PACKAGEDIR_HTTPD22:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /httpd22/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2785,6 +2886,15 @@ UNITDIR_HTTPD22=$(PACKAGEDIR_HTTPD22)/units/$(TARGETSUFFIX)
 else
 UNITDIR_HTTPD22=$(PACKAGEDIR_HTTPD22)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_HTTPD22)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HTTPD22=$(PACKAGEDIR_HTTPD22)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_HTTPD22)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HTTPD22=$(PACKAGEDIR_HTTPD22)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_HTTPD22=$(PACKAGEDIR_HTTPD22)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_HTTPD22)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_HTTPD22) $(FPCMADE)
@@ -2802,6 +2912,9 @@ endif
 ifdef UNITDIR_HTTPD22
 override COMPILER_UNITDIR+=$(UNITDIR_HTTPD22)
 endif
+ifdef UNITDIR_FPMAKE_HTTPD22
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_HTTPD22)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FASTCGI
 PACKAGEDIR_FASTCGI:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fastcgi/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2811,6 +2924,15 @@ UNITDIR_FASTCGI=$(PACKAGEDIR_FASTCGI)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FASTCGI=$(PACKAGEDIR_FASTCGI)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FASTCGI)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FASTCGI=$(PACKAGEDIR_FASTCGI)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FASTCGI)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FASTCGI=$(PACKAGEDIR_FASTCGI)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FASTCGI=$(PACKAGEDIR_FASTCGI)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FASTCGI)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FASTCGI) $(FPCMADE)
@@ -2828,6 +2950,9 @@ endif
 ifdef UNITDIR_FASTCGI
 override COMPILER_UNITDIR+=$(UNITDIR_FASTCGI)
 endif
+ifdef UNITDIR_FPMAKE_FASTCGI
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FASTCGI)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FCL-PASSRC
 PACKAGEDIR_FCL-PASSRC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-passrc/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2837,6 +2962,15 @@ UNITDIR_FCL-PASSRC=$(PACKAGEDIR_FCL-PASSRC)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FCL-PASSRC=$(PACKAGEDIR_FCL-PASSRC)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-PASSRC)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-PASSRC=$(PACKAGEDIR_FCL-PASSRC)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-PASSRC)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-PASSRC=$(PACKAGEDIR_FCL-PASSRC)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-PASSRC=$(PACKAGEDIR_FCL-PASSRC)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FCL-PASSRC)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FCL-PASSRC) $(FPCMADE)
@@ -2854,6 +2988,9 @@ endif
 ifdef UNITDIR_FCL-PASSRC
 override COMPILER_UNITDIR+=$(UNITDIR_FCL-PASSRC)
 endif
+ifdef UNITDIR_FPMAKE_FCL-PASSRC
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-PASSRC)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FCL-ASYNC
 PACKAGEDIR_FCL-ASYNC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-async/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2863,6 +3000,15 @@ UNITDIR_FCL-ASYNC=$(PACKAGEDIR_FCL-ASYNC)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FCL-ASYNC=$(PACKAGEDIR_FCL-ASYNC)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-ASYNC)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-ASYNC=$(PACKAGEDIR_FCL-ASYNC)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-ASYNC)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-ASYNC=$(PACKAGEDIR_FCL-ASYNC)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-ASYNC=$(PACKAGEDIR_FCL-ASYNC)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FCL-ASYNC)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FCL-ASYNC) $(FPCMADE)
@@ -2880,6 +3026,9 @@ endif
 ifdef UNITDIR_FCL-ASYNC
 override COMPILER_UNITDIR+=$(UNITDIR_FCL-ASYNC)
 endif
+ifdef UNITDIR_FPMAKE_FCL-ASYNC
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-ASYNC)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FCL-NET
 PACKAGEDIR_FCL-NET:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-net/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2889,6 +3038,15 @@ UNITDIR_FCL-NET=$(PACKAGEDIR_FCL-NET)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FCL-NET=$(PACKAGEDIR_FCL-NET)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-NET)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-NET=$(PACKAGEDIR_FCL-NET)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-NET)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-NET=$(PACKAGEDIR_FCL-NET)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-NET=$(PACKAGEDIR_FCL-NET)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FCL-NET)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FCL-NET) $(FPCMADE)
@@ -2906,6 +3064,9 @@ endif
 ifdef UNITDIR_FCL-NET
 override COMPILER_UNITDIR+=$(UNITDIR_FCL-NET)
 endif
+ifdef UNITDIR_FPMAKE_FCL-NET
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-NET)
+endif
 endif
 ifdef REQUIRE_PACKAGES_IBASE
 PACKAGEDIR_IBASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2915,6 +3076,15 @@ UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/units/$(TARGETSUFFIX)
 else
 UNITDIR_IBASE=$(PACKAGEDIR_IBASE)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_IBASE)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_IBASE=$(PACKAGEDIR_IBASE)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_IBASE)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_IBASE=$(PACKAGEDIR_IBASE)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_IBASE=$(PACKAGEDIR_IBASE)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_IBASE)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_IBASE) $(FPCMADE)
@@ -2932,6 +3102,9 @@ endif
 ifdef UNITDIR_IBASE
 override COMPILER_UNITDIR+=$(UNITDIR_IBASE)
 endif
+ifdef UNITDIR_FPMAKE_IBASE
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_IBASE)
+endif
 endif
 ifdef REQUIRE_PACKAGES_POSTGRES
 PACKAGEDIR_POSTGRES:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /postgres/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2941,6 +3114,15 @@ UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES)/units/$(TARGETSUFFIX)
 else
 UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_POSTGRES)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_POSTGRES=$(PACKAGEDIR_POSTGRES)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_POSTGRES)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_POSTGRES=$(PACKAGEDIR_POSTGRES)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_POSTGRES=$(PACKAGEDIR_POSTGRES)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_POSTGRES)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_POSTGRES) $(FPCMADE)
@@ -2958,6 +3140,9 @@ endif
 ifdef UNITDIR_POSTGRES
 override COMPILER_UNITDIR+=$(UNITDIR_POSTGRES)
 endif
+ifdef UNITDIR_FPMAKE_POSTGRES
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_POSTGRES)
+endif
 endif
 ifdef REQUIRE_PACKAGES_MYSQL
 PACKAGEDIR_MYSQL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2967,6 +3152,15 @@ UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/units/$(TARGETSUFFIX)
 else
 UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_MYSQL=$(PACKAGEDIR_MYSQL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_MYSQL=$(PACKAGEDIR_MYSQL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_MYSQL=$(PACKAGEDIR_MYSQL)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_MYSQL)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_MYSQL) $(FPCMADE)
@@ -2984,6 +3178,9 @@ endif
 ifdef UNITDIR_MYSQL
 override COMPILER_UNITDIR+=$(UNITDIR_MYSQL)
 endif
+ifdef UNITDIR_FPMAKE_MYSQL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_MYSQL)
+endif
 endif
 ifdef REQUIRE_PACKAGES_ODBC
 PACKAGEDIR_ODBC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /odbc/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2993,6 +3190,15 @@ UNITDIR_ODBC=$(PACKAGEDIR_ODBC)/units/$(TARGETSUFFIX)
 else
 UNITDIR_ODBC=$(PACKAGEDIR_ODBC)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_ODBC)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_ODBC=$(PACKAGEDIR_ODBC)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_ODBC)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_ODBC=$(PACKAGEDIR_ODBC)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_ODBC=$(PACKAGEDIR_ODBC)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_ODBC)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_ODBC) $(FPCMADE)
@@ -3010,6 +3216,9 @@ endif
 ifdef UNITDIR_ODBC
 override COMPILER_UNITDIR+=$(UNITDIR_ODBC)
 endif
+ifdef UNITDIR_FPMAKE_ODBC
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_ODBC)
+endif
 endif
 ifdef REQUIRE_PACKAGES_ORACLE
 PACKAGEDIR_ORACLE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /oracle/Makefile.fpc,$(PACKAGESDIR))))))
@@ -3019,6 +3228,15 @@ UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE)/units/$(TARGETSUFFIX)
 else
 UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_ORACLE)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_ORACLE=$(PACKAGEDIR_ORACLE)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_ORACLE)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_ORACLE=$(PACKAGEDIR_ORACLE)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_ORACLE=$(PACKAGEDIR_ORACLE)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_ORACLE)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_ORACLE) $(FPCMADE)
@@ -3036,6 +3254,9 @@ endif
 ifdef UNITDIR_ORACLE
 override COMPILER_UNITDIR+=$(UNITDIR_ORACLE)
 endif
+ifdef UNITDIR_FPMAKE_ORACLE
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_ORACLE)
+endif
 endif
 ifdef REQUIRE_PACKAGES_SQLITE
 PACKAGEDIR_SQLITE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /sqlite/Makefile.fpc,$(PACKAGESDIR))))))
@@ -3045,6 +3266,15 @@ UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE)/units/$(TARGETSUFFIX)
 else
 UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_SQLITE)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_SQLITE=$(PACKAGEDIR_SQLITE)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_SQLITE)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_SQLITE=$(PACKAGEDIR_SQLITE)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_SQLITE=$(PACKAGEDIR_SQLITE)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_SQLITE)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_SQLITE) $(FPCMADE)
@@ -3062,6 +3292,9 @@ endif
 ifdef UNITDIR_SQLITE
 override COMPILER_UNITDIR+=$(UNITDIR_SQLITE)
 endif
+ifdef UNITDIR_FPMAKE_SQLITE
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_SQLITE)
+endif
 endif
 ifdef REQUIRE_PACKAGES_PXLIB
 PACKAGEDIR_PXLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pxlib/Makefile.fpc,$(PACKAGESDIR))))))
@@ -3071,6 +3304,15 @@ UNITDIR_PXLIB=$(PACKAGEDIR_PXLIB)/units/$(TARGETSUFFIX)
 else
 UNITDIR_PXLIB=$(PACKAGEDIR_PXLIB)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_PXLIB)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_PXLIB=$(PACKAGEDIR_PXLIB)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_PXLIB)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_PXLIB=$(PACKAGEDIR_PXLIB)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_PXLIB=$(PACKAGEDIR_PXLIB)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_PXLIB)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_PXLIB) $(FPCMADE)
@@ -3088,6 +3330,9 @@ endif
 ifdef UNITDIR_PXLIB
 override COMPILER_UNITDIR+=$(UNITDIR_PXLIB)
 endif
+ifdef UNITDIR_FPMAKE_PXLIB
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_PXLIB)
+endif
 endif
 ifdef REQUIRE_PACKAGES_UNIVINT
 PACKAGEDIR_UNIVINT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /univint/Makefile.fpc,$(PACKAGESDIR))))))
@@ -3097,6 +3342,15 @@ UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)
 else
 UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_UNIVINT)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_UNIVINT=$(PACKAGEDIR_UNIVINT)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_UNIVINT)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_UNIVINT=$(PACKAGEDIR_UNIVINT)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_UNIVINT=$(PACKAGEDIR_UNIVINT)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_UNIVINT)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_UNIVINT) $(FPCMADE)
@@ -3114,6 +3368,9 @@ endif
 ifdef UNITDIR_UNIVINT
 override COMPILER_UNITDIR+=$(UNITDIR_UNIVINT)
 endif
+ifdef UNITDIR_FPMAKE_UNIVINT
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_UNIVINT)
+endif
 endif
 ifndef NOCPUDEF
 override FPCOPTDEF=$(ARCH)
@@ -3523,6 +3780,7 @@ fpc_baseinfo:
 	@$(ECHO)  Full Target.. $(FULL_TARGET)
 	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
 	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)  FPC fpmake... $(FPCFPMAKE)
 	@$(ECHO)
 	@$(ECHO)  == Directory info ==
 	@$(ECHO)

+ 1 - 1
packages/fcl-web/src/base/Makefile.fpc

@@ -9,7 +9,7 @@ version=2.5.1
 [target]
 units=httpdefs fphttp custweb custcgi fpcgi fphtml iniwebsession websession fpweb \
       webutil fpdatasetform cgiapp ezcgi fpapache webpage fcgigate fphttpserver \
-      fphttpclient
+      fphttpclient custhttpapp fphttpapp fpwebfile
 rsts=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient
 
 # these units are listed separately because they don't work for

+ 61 - 0
packages/fcl-web/src/base/README.txt

@@ -155,3 +155,64 @@ TCustomApacheApplication:
   Uses fpweb to create TCustomHTTPModuleClass instances to 
   handle the request. 
 
+fphttpclient:
+-------------
+  HTTP Protocol client component
+
+TFPCustomHTTPClient:
+  A component which can be used to communicate with a HTTP Server. It can
+  execute HTTP GET and POST methods out of the box, but can be used to execute
+  other HTTP methods as well. It works using the ssockets unit of FPC, so no
+  third-party package to handle the socket communication is needed.
+
+A demo application for this class exists.
+
+fphttpserver:
+-------------
+
+TFPCustomHttpServer:
+  A Component which can be used to create a simple HTTP Server. All requests
+  are routed through a OnRequest handler. The request and responses are
+  modeled using the fpWeb TRequest and TResponse objects from httpdefs. The
+  class itself does not serve files. The OnRequest handler must be
+  implemented to actually serve files or respond to requests.
+  It can work threaded or non-threaded.
+  It works using the ssockets unit of FPC, so no third-party package to 
+  handle the socket communication is needed.
+
+A demo application for this class exists.
+
+custhttpapp:
+------------
+
+Integration of TFPCustomHttpServer in a TWebApplication.
+
+TFPHTTPServerHandler:
+  A TWebHandler descendant which implements a stand-alone HTTP server. It
+  uses the TFPCustomHttpServer  component to implement the server.
+
+TCustomHTTPApplication:
+  A descendent of TCustomWebApplication which serves as an application
+  object for stand-alone HTTP applications. It can be used as a parent
+  component for standalone HTTP application objects.
+
+fphttpApp:
+----------
+
+THTTPApplication: 
+  A descendent of TCustomHTTPApplication. It does nothing except expose
+  properties which exist in TCustomHTTPApplication. A global instance of
+  this class is defined in fphttpApp. Use this unit and class if you want a
+  simple standalone http server application for test purposes.
+
+A demo application for this class exists.
+
+fpwebfile:
+----------
+Used to implement file serving.
+
+TFPCustomFileModule:
+  TFPCustomHTTPModule descendant which will serve files. Can be used as-is,
+  but descendents can be made to implement e.g. logging, authorisation etc.
+  must not be registered directly, register locations using the RegisterFileLocation 
+  call.

+ 250 - 0
packages/fcl-web/src/base/custhttpapp.pp

@@ -0,0 +1,250 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2009 by the Free Pascal development team
+
+    THTTPApplication class.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{ $define CGIDEBUG}
+{$mode objfpc}
+{$H+}
+
+unit custhttpapp;
+
+Interface
+
+uses
+  Classes, SysUtils, httpdefs, custweb, ssockets,  fphttpserver;
+
+Type
+  TCustomHTTPApplication = Class;
+  TEmbeddedHttpServer = Class(TFPCustomHttpServer)
+  protected
+    Property Active;
+  end;
+
+  { TFCgiHandler }
+
+  { TFPHTTPServerHandler }
+
+  TFPHTTPServerHandler = class(TWebHandler)
+    procedure HTTPHandleRequest(Sender: TObject;
+      var ARequest: TFPHTTPConnectionRequest;
+      var AResponse: TFPHTTPConnectionResponse);
+  Private
+    FServer: TEmbeddedHTTPServer;
+    function GetAllowConnect: TConnectQuery;
+    function GetPort: Word;
+    function GetQueueSize: Word;
+    function GetThreaded: Boolean;
+    procedure SetOnAllowConnect(const AValue: TConnectQuery);
+    procedure SetPort(const AValue: Word);
+    procedure SetQueueSize(const AValue: Word);
+    procedure SetThreaded(const AValue: Boolean);
+  protected
+    function WaitForRequest(out ARequest : TRequest; out AResponse : TResponse) : boolean; override;
+    Function CreateServer : TEmbeddedHttpServer; virtual;
+    Property HTTPServer : TEmbeddedHttpServer Read FServer;
+  Public
+    Procedure Run; override;
+    constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
+    // Port to listen on.
+    Property Port : Word Read GetPort Write SetPort Default 80;
+    // Max connections on queue (for Listen call)
+    Property QueueSize : Word Read GetQueueSize Write SetQueueSize Default 5;
+    // Called when deciding whether to accept a connection.
+    Property OnAllowConnect : TConnectQuery Read GetAllowConnect Write SetOnAllowConnect;
+    // Use a thread to handle a connection ?
+    property Threaded : Boolean read GetThreaded Write SetThreaded;
+  end;
+
+  { TCustomHTTPApplication }
+
+  TCustomHTTPApplication = Class(TCustomWebApplication)
+  private
+    function GetAllowConnect: TConnectQuery;
+    function GetPort: Word;
+    function GetQueueSize: Word;
+    function GetThreaded: Boolean;
+    procedure SetOnAllowConnect(const AValue: TConnectQuery);
+    procedure SetPort(const AValue: Word);
+    procedure SetQueueSize(const AValue: Word);
+    procedure SetThreaded(const AValue: Boolean);
+  protected
+    function InitializeWebHandler: TWebHandler; override;
+    Function HTTPHandler : TFPHTTPServerHandler;
+  Public
+    Property Port : Word Read GetPort Write SetPort Default 80;
+    // Max connections on queue (for Listen call)
+    Property QueueSize : Word Read GetQueueSize Write SetQueueSize Default 5;
+    // Called when deciding whether to accept a connection.
+    Property OnAllowConnect : TConnectQuery Read GetAllowConnect Write SetOnAllowConnect;
+    // Use a thread to handle a connection ?
+    property Threaded : Boolean read GetThreaded Write SetThreaded;
+  end;
+
+ResourceString
+  SNoInputHandle    = 'Failed to open input-handle passed from server. Socket Error: %d';
+  SNoSocket         = 'Failed to open socket. Socket Error: %d';
+  SBindFailed       = 'Failed to bind to port %d. Socket Error: %d';
+  SListenFailed     = 'Failed to listen to port %d. Socket Error: %d';
+  SErrReadingSocket = 'Failed to read data from socket. Error: %d';
+  SErrReadingHeader = 'Failed to read FastCGI header. Read only %d bytes';
+  SErrWritingSocket = 'Failed to write data to socket. Error: %d';
+
+Implementation
+
+{$ifdef CGIDEBUG}
+uses
+  dbugintf;
+{$endif}
+
+{ TCustomHTTPApplication }
+
+function TCustomHTTPApplication.GetAllowConnect: TConnectQuery;
+begin
+  Result:=HTTPHandler.OnAllowConnect;
+end;
+
+function TCustomHTTPApplication.GetPort: Word;
+begin
+  Result:=HTTPHandler.Port;
+end;
+
+function TCustomHTTPApplication.GetQueueSize: Word;
+begin
+  Result:=HTTPHandler.QueueSize;
+end;
+
+function TCustomHTTPApplication.GetThreaded: Boolean;
+begin
+  Result:=HTTPHandler.Threaded;
+end;
+
+procedure TCustomHTTPApplication.SetOnAllowConnect(const AValue: TConnectQuery);
+begin
+  HTTPHandler.OnAllowConnect:=AValue;
+end;
+
+procedure TCustomHTTPApplication.SetPort(const AValue: Word);
+begin
+  HTTPHandler.Port:=Avalue;
+end;
+
+procedure TCustomHTTPApplication.SetQueueSize(const AValue: Word);
+begin
+  HTTPHandler.QueueSize:=Avalue;
+end;
+
+procedure TCustomHTTPApplication.SetThreaded(const AValue: Boolean);
+begin
+  HTTPHandler.Threaded:=Avalue;
+end;
+
+function TCustomHTTPApplication.InitializeWebHandler: TWebHandler;
+begin
+  Result:=TFPHTTPServerHandler.Create(Self);
+end;
+
+function TCustomHTTPApplication.HTTPHandler: TFPHTTPServerHandler;
+begin
+  Result:=Webhandler as TFPHTTPServerHandler;
+end;
+
+{ TFPHTTPServerHandler }
+
+procedure TFPHTTPServerHandler.HTTPHandleRequest(Sender: TObject;
+  var ARequest: TFPHTTPConnectionRequest;
+  var AResponse: TFPHTTPConnectionResponse);
+begin
+  // Exceptions are handled by (Do)HandleRequest. It also frees the response/request
+  DoHandleRequest(ARequest,AResponse);
+  ARequest:=Nil;
+  AResponse:=Nil;
+  If Terminated then
+    FServer.Active:=False;
+  if Assigned(OnIdle) then
+    OnIdle(Self);
+end;
+
+function TFPHTTPServerHandler.GetAllowConnect: TConnectQuery;
+begin
+  Result:=FServer.OnAllowConnect;
+end;
+
+function TFPHTTPServerHandler.GetPort: Word;
+begin
+  Result:=FServer.Port;
+end;
+
+function TFPHTTPServerHandler.GetQueueSize: Word;
+begin
+  Result:=FServer.QueueSize;
+end;
+
+function TFPHTTPServerHandler.GetThreaded: Boolean;
+begin
+  Result:=FServer.Threaded;
+end;
+
+procedure TFPHTTPServerHandler.SetOnAllowConnect(const AValue: TConnectQuery);
+begin
+  FServer.OnAllowConnect:=Avalue
+end;
+
+procedure TFPHTTPServerHandler.SetPort(const AValue: Word);
+begin
+  FServer.Port:=Avalue
+end;
+
+procedure TFPHTTPServerHandler.SetQueueSize(const AValue: Word);
+begin
+  FServer.QueueSize:=Avalue
+end;
+
+procedure TFPHTTPServerHandler.SetThreaded(const AValue: Boolean);
+begin
+  FServer.Threaded:=AValue;
+end;
+
+function TFPHTTPServerHandler.WaitForRequest(out ARequest: TRequest;
+  out AResponse: TResponse): boolean;
+begin
+  // Result:=inherited WaitForRequest(ARequest, AResponse);
+end;
+
+function TFPHTTPServerHandler.CreateServer: TEmbeddedHttpServer;
+begin
+  Result:=TEmbeddedHttpServer.Create(Self);
+end;
+
+procedure TFPHTTPServerHandler.Run;
+begin
+  Fserver.Active:=True;
+end;
+
+constructor TFPHTTPServerHandler.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  FServer:=CreateServer;
+  FServer.OnRequest:=@HTTPHandleRequest;
+end;
+
+destructor TFPHTTPServerHandler.Destroy;
+begin
+  FServer.Active:=False;
+  FreeAndNil(FServer);
+  inherited Destroy;
+
+end;
+
+
+end.

+ 64 - 0
packages/fcl-web/src/base/fphttpapp.pp

@@ -0,0 +1,64 @@
+{
+    $Id: header,v 1.1 2000/07/13 06:33:45 michael Exp $
+    This file is part of the Free Component Library (FCL)
+    Copyright (c) 1999-2000 by the Free Pascal development team
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$mode objfpc}
+{$H+}
+unit fphttpapp;
+
+interface
+
+uses SysUtils,Classes, custhttpapp;
+
+Type
+
+  { TCGIApplication }
+
+  THTTPApplication = Class(TCustomHTTPApplication)
+  end;
+
+Var
+  Application : THTTPApplication;
+  ShowCleanUpErrors : Boolean = False;
+  
+Implementation
+
+uses CustApp;
+
+Procedure InitHTTP;
+
+begin
+  Application:=THTTPApplication.Create(Nil);
+  if not assigned(CustomApplication) then
+    CustomApplication := Application;
+end;
+
+Procedure DoneHTTP;
+
+begin
+  if CustomApplication=Application then
+    CustomApplication := nil;
+  try  
+    FreeAndNil(Application);
+  except
+    if ShowCleanUpErrors then
+      Raise;
+  end;
+end;
+
+Initialization
+  InitHTTP;
+  
+Finalization
+  DoneHTTP;
+  
+end.

+ 0 - 1
packages/fcl-web/src/base/fphttpserver.pp

@@ -35,7 +35,6 @@ Type
   TFPHTTPConnectionRequest = Class(TRequest)
   private
     FConnection: TFPHTTPConnection;
-    
   protected
     procedure SetContent(AValue : String);
     Property Connection : TFPHTTPConnection Read FConnection;

+ 184 - 0
packages/fcl-web/src/base/fpwebfile.pp

@@ -0,0 +1,184 @@
+{$mode objfpc}
+{$h+}
+unit fpwebfile;
+
+interface
+
+uses SysUtils, Classes, httpdefs, fphttp;
+
+Type
+  TFPCustomFileModule = Class(TCustomHTTPModule)
+  Protected
+    // Determine filename frome request.
+    Function GetRequestFileName(Const ARequest : TRequest) : String; virtual;
+    // Map request filename to physical filename.
+    Function MapFileName(Const AFileName : String) : String; virtual;
+    // Override to implement security. Returns true by default.
+    Function AllowFile(Const AFileName : String) : Boolean; virtual;
+    // Actually Send file to client.
+    Procedure SendFile(Const AFileName : String; AResponse : TResponse); virtual;
+    // Overrides TCustomHTTPModule to implement file serving.
+    Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse); override;
+  end;
+  TFPCustomFileModuleClass = Class of TFPCustomFileModule;
+
+Var
+  // Set this if you want a descendent class to serve the files.
+  DefaultFileModuleClass : TFPCustomFileModuleClass = TFPCustomFileModule;
+  // Setting this will load mime types from that file.
+  MimeTypesFile : string;
+
+// use this to map locations (relative to BaseURL of the application) to physical directories.
+// More than one location can be registered. Directory must exist, location must not have / or \
+Procedure RegisterFileLocation(Const ALocation,ADirectory : String);
+
+implementation
+
+uses fpmimetypes;
+
+Resourcestring
+  SErrNoLocation = 'Cannot register an empty location.';
+  SErrInvalidLocation = 'Location contains invalid characters.';
+  SErrInvalidDirectory = 'Directory "%s" does not exist';
+
+Var
+  Locations : TStrings;
+  MimeLoaded : Boolean;
+  
+Procedure CheckMimeLoaded;
+begin
+  If (Not MimeLoaded) and (MimeTypesFile<>'') then
+    begin
+    MimeTypes.LoadFromFile(MimeTypesFile);
+    MimeLoaded:=true;
+    end;
+end;
+                  
+Procedure RegisterFileLocation(Const ALocation,ADirectory : String);
+
+begin
+  if (ALocation='') then
+    Raise HTTPError.Create(SErrNoLocation); 
+  if Pos('/',ALocation)<>0 then
+    Raise HTTPError.Create(SErrInvalidLocation);
+  if not DirectoryExists(ADirectory) then
+    Raise HTTPError.Create(SErrInvalidDirectory);
+  if (Locations=Nil) then
+    Locations:=TStringList.Create;
+  if DefaultFileModuleClass=Nil then
+    DefaultFileModuleClass:=TFPCustomFileModule;  
+  if (ADirectory='') then
+    Locations.Values[IncludeTrailingPathDelimiter(ALocation)]:=ExtractFilePath(ParamStr(0))
+  else  
+    Locations.Values[IncludeTrailingPathDelimiter(ALocation)]:=IncludeTrailingPathDelimiter(ADirectory);
+  RegisterHTTPModule(ALocation,DefaultFileModuleClass,true);
+end;
+
+Function TFPCustomFileModule.GetRequestFileName(Const ARequest : TRequest) : String;
+
+  procedure sb;
+
+  begin
+    If (Result<>'') and (Result[1]='/') then
+      Delete(Result,1,1);
+  end;
+begin
+  Result:=ARequest.PathInfo;
+  If (Result='') then
+    begin
+    Result:=ARequest.URI;
+    sb;
+    If (BaseURL<>'') and (Pos(BaseURL,Result)=1) then
+      Delete(Result,1,Length(BaseURL));
+    end;
+  sb;
+end;
+
+Function TFPCustomFileModule.MapFileName(Const AFileName : String) : String; 
+
+Var
+  D : String;
+
+begin
+  D:=Locations.Values[BaseURL];
+  If (D='') then
+    Result:=''
+  else
+    begin
+    Result:=D+AFileName;
+    DoDirSeparators(Result);
+    end;
+end;
+
+Function TFPCustomFileModule.AllowFile(Const AFileName : String) : Boolean;
+
+begin
+  Result:=True;
+end;
+
+procedure TFPCustomFileModule.SendFile(Const AFileName : String; AResponse : TResponse);
+
+Var
+  F : TFileStream;
+
+begin
+  CheckMimeLoaded;
+  AResponse.ContentType:=MimeTypes.GetMimeType(ExtractFileExt(AFileName));
+  If (AResponse.ContentType='') then
+    AResponse.ContentType:='Application/octet-stream';
+  F:=TFileStream.Create(AFileName,fmOpenRead);
+  try
+    AResponse.ContentLength:=F.Size;
+    AResponse.ContentStream:=F;
+    AResponse.SendContent;
+    AResponse.ContentStream:=Nil;
+  finally
+    F.Free;
+  end;
+end;
+
+
+Procedure TFPCustomFileModule.HandleRequest(ARequest : TRequest; AResponse : TResponse);
+
+Var
+  RFN,FN : String;
+
+begin
+  If CompareText(ARequest.Method,'GET')<>0 then
+    begin
+    AResponse.Code:=405;
+    AResponse.CodeText:='Method not allowed';
+    AResponse.SendContent;
+    Exit;
+    end;
+  RFN:=GetRequestFileName(ARequest);
+  if (RFN='') then
+    begin
+    AResponse.Code:=400;
+    AResponse.CodeText:='Bad request';
+    AResponse.SendContent;
+    exit;
+    end;
+  FN:=MapFileName(RFN);
+  if (FN='') or not FileExists(FN) then
+    begin
+    AResponse.Code:=404;
+    AResponse.CodeText:='Not found';
+    AResponse.SendContent;
+    exit;
+    end;
+  if not AllowFile(FN) then  
+    begin
+    AResponse.Code:=403;
+    AResponse.CodeText:='Forbidden';
+    AResponse.SendContent;
+    exit;
+    end;
+  SendFile(FN,AResponse);
+end;
+
+initialization
+
+finalization
+  FreeAndNil(Locations);
+end.

+ 20 - 9
packages/fcl-web/src/base/httpdefs.pp

@@ -175,7 +175,6 @@ type
     FHTTPXRequestedWith: String;
     FFields : THttpFields;
     FQueryFields: TStrings;
-    FURL : String;
     function GetSetField(AIndex: Integer): String;
     function GetSetFieldName(AIndex: Integer): String;
     procedure SetCookieFields(const AValue: TStrings);
@@ -278,6 +277,7 @@ type
     FContent : String;
     procedure ReadContent; virtual;
     Function GetFieldValue(AIndex : Integer) : String; override;
+    Procedure SetFieldValue(Index : Integer; Value : String); override;
     Procedure ProcessMultiPart(Stream : TStream; Const Boundary : String;SL:TStrings); virtual;
     Procedure ProcessQueryString(Const FQueryString : String; SL:TStrings); virtual;
     procedure ProcessURLEncoded(Stream : TStream;SL:TStrings); virtual;
@@ -625,7 +625,6 @@ begin
   else
     case Index of
       0  : Result:=FHTTPVersion;
-      32 : Result:=FURL;
       36 : Result:=FHTTPXRequestedWith;
     else
       Result := '';
@@ -656,7 +655,6 @@ begin
       28 : ; // Property RemoteHost : String Index 28 read  GetFieldValue Write SetFieldValue;
       29 : ; // Property ScriptName : String Index 29 read  GetFieldValue Write SetFieldValue;
       30 : ; // Property ServerPort : Word Read GetServerPort; // Index 30
-      32 : FURL:=Value;
       36 : FHTTPXRequestedWith:=Value;
     end;
 end;
@@ -1006,14 +1004,27 @@ end;
 
 function TRequest.GetFieldValue(AIndex: integer): String;
 begin
-  if AIndex = 35 then // Content
-    begin
-    If Not FContentRead then
-      ReadContent;
-    Result:=FContent;
-    end
+  Case AIndex of
+    31 : Result:=FCommand;
+    32 : Result:=FURI;
+    35 : begin
+         If Not FContentRead then
+           ReadContent;
+         Result:=FContent;
+         end
   else
     Result:=inherited GetFieldValue(AIndex);
+  end;
+end;
+
+procedure TRequest.SetFieldValue(Index: Integer; Value: String);
+begin
+  Case Index of
+    31 : FCommand:=Value;
+    32 : FURI:=Value;
+  else
+    inherited SetFieldValue(Index, Value);
+  end
 end;
 
 function TRequest.GetFirstHeaderLine: String;