diff options
author | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-07-11 19:32:07 +0000 |
---|---|---|
committer | marco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-07-11 19:32:07 +0000 |
commit | 98a2843390b87e8f18e9d3f7aaad19f04d0b2f1a (patch) | |
tree | 4dc3ea79fab0b9d4da67075f7833c1bf06878e41 | |
parent | 7ad65b6d094efe30daa8ebda4036e6138c380468 (diff) | |
download | fpc-98a2843390b87e8f18e9d3f7aaad19f04d0b2f1a.tar.gz |
--- Merging r17632 into '.':
A packages/fcl-web/src/base/fpwebfile.pp
A packages/fcl-web/src/base/fphttpapp.pp
U packages/fcl-web/src/base/Makefile.fpc
A packages/fcl-web/src/base/custhttpapp.pp
U packages/fcl-web/src/base/httpdefs.pp
U packages/fcl-web/src/base/fphttpserver.pp
U packages/fcl-web/src/base/README.txt
C packages/fcl-web/src/base/Makefile
--- Merging r17633 into '.':
A packages/fcl-web/examples/httpapp
A packages/fcl-web/examples/httpapp/testhttp.lpi
A packages/fcl-web/examples/httpapp/testhttp.pp
--- Merging r17645 into '.':
G packages/fcl-web/src/base/httpdefs.pp
--- Merging r17646 into '.':
G packages/fcl-web/src/base/fphttpserver.pp
--- Merging r17647 into '.':
U packages/fcl-web/src/base/fpwebfile.pp
--- Merging r17653 into '.':
U packages/fcl-web/src/base/fphttp.pp
G packages/fcl-web/src/base/httpdefs.pp
U packages/fcl-web/src/base/iniwebsession.pp
--- Merging r17656 into '.':
U packages/fcl-web/src/base/fpapache.pp
--- Merging r17707 into '.':
G packages/fcl-web/src/base/iniwebsession.pp
--- Merging r17718 into '.':
U packages/fcl-xml/src/htmlelements.pp
--- Merging r17740 into '.':
U packages/fcl-web/examples/combined/wmusers.pp
U packages/fcl-web/examples/combined/wmlogin.pp
D packages/fcl-web/examples/combined/wmusers.lrs
U packages/fcl-web/examples/webdata/demo/createusers.lpr
U packages/fcl-web/examples/webdata/demo/wmusers.pp
U packages/fcl-web/examples/webdata/demo/createusers.lpi
D packages/fcl-web/examples/webdata/demo/wmusers.lrs
U packages/fcl-web/examples/webdata/demo2/wmusers.pp
D packages/fcl-web/examples/webdata/demo2/wmusers.lrs
U packages/fcl-web/examples/webdata/demo3/extgrid.lpr
U packages/fcl-web/examples/webdata/demo3/wmusers.pp
U packages/fcl-web/examples/webdata/demo3/extgrid.lpi
D packages/fcl-web/examples/webdata/demo3/tralala.lrs
D packages/fcl-web/examples/webdata/demo3/wmusers.lrs
U packages/fcl-web/examples/webdata/demo4/dmusers.pp
U packages/fcl-web/examples/webdata/demo4/extgrid.lpr
U packages/fcl-web/examples/webdata/demo4/wmxmlusers.pp
U packages/fcl-web/examples/webdata/demo4/extgrid.lpi
U packages/fcl-web/examples/webdata/demo4/wmjsonusers.pp
D packages/fcl-web/examples/webdata/demo4/wmxmlusers.lrs
D packages/fcl-web/examples/webdata/demo4/wmjsonusers.lrs
D packages/fcl-web/examples/webdata/demo4/dmusers.lrs
U packages/fcl-web/examples/webdata/demo5/wmusers.pp
D packages/fcl-web/examples/webdata/demo5/wmusers.lrs
U packages/fcl-web/examples/webdata/demo6/extgrid.lpr
U packages/fcl-web/examples/webdata/demo6/wmusers.pp
U packages/fcl-web/examples/webdata/demo6/extgrid.lpi
D packages/fcl-web/examples/webdata/demo6/wmusers.lrs
U packages/fcl-web/examples/jsonrpc/demo1/demo.lpr
U packages/fcl-web/examples/jsonrpc/demo1/wmdemo.pp
U packages/fcl-web/examples/jsonrpc/demo1/demo.lpi
D packages/fcl-web/examples/jsonrpc/demo1/wmdemo.lrs
U packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp
U packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi
D packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs
--- Merging r17741 into '.':
U packages/fcl-web/examples/httpapp/testhttp.lpi
--- Merging r17742 into '.':
A packages/fcl-web/examples/fptemplate
A packages/fcl-web/examples/fptemplate/fileupload
A packages/fcl-web/examples/fptemplate/fileupload/apache
A packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpr
A packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpi
A packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.res
A packages/fcl-web/examples/fptemplate/fileupload/cgi
A packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpr
A packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpi
A packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.res
A packages/fcl-web/examples/fptemplate/fileupload/webmodule
A packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.lfm
A packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.pas
A packages/fcl-web/examples/fptemplate/fileupload/fcgi
A packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpr
A packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpi
A packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.res
A packages/fcl-web/examples/fptemplate/fileupload/README.txt
A packages/fcl-web/examples/fptemplate/fileupload/templates
A packages/fcl-web/examples/fptemplate/fileupload/templates/uploadform.html
A packages/fcl-web/examples/fptemplate/simpletemplate
A packages/fcl-web/examples/fptemplate/simpletemplate/apache
A packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpr
A packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpi
A packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.res
A packages/fcl-web/examples/fptemplate/simpletemplate/cgi
A packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpr
A packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpi
A packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.res
A packages/fcl-web/examples/fptemplate/simpletemplate/webmodule
A packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.lfm
A packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.pas
A packages/fcl-web/examples/fptemplate/simpletemplate/fcgi
A packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpr
A packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpi
A packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.res
A packages/fcl-web/examples/fptemplate/simpletemplate/README.txt
A packages/fcl-web/examples/fptemplate/simpletemplate/templates
A packages/fcl-web/examples/fptemplate/simpletemplate/templates/mytemplate1.html
A packages/fcl-web/examples/fptemplate/sessions
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpr
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpi
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.res
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpr
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpi
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.res
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.lfm
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.pas
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpr
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpi
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.res
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/README.txt
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogout.html
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlwelcome.html
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/userdb.txt
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlsomepage.html
A packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogin.html
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.res
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpr
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.res
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpr
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.lfm
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.pas
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.res
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpr
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/README.txt
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/templates
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/templates/autosession-template.html
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.res
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpr
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.res
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpr
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.lfm
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.pas
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpi
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.res
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpr
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/README.txt
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/userdb.txt
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testsomepage.html
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogin.html
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogout.html
A packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testwelcome.html
A packages/fcl-web/examples/fptemplate/README.txt
A packages/fcl-web/examples/fptemplate/embedtemplates
A packages/fcl-web/examples/fptemplate/embedtemplates/apache
A packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.res
A packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpr
A packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpi
A packages/fcl-web/examples/fptemplate/embedtemplates/cgi
A packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.res
A packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpr
A packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpi
A packages/fcl-web/examples/fptemplate/embedtemplates/webmodule
A packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.lfm
A packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.pas
A packages/fcl-web/examples/fptemplate/embedtemplates/fcgi
A packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.res
A packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpr
A packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpi
A packages/fcl-web/examples/fptemplate/embedtemplates/README.txt
A packages/fcl-web/examples/fptemplate/embedtemplates/templates
A packages/fcl-web/examples/fptemplate/embedtemplates/templates/body.html
A packages/fcl-web/examples/fptemplate/embedtemplates/templates/maintemplate.html
A packages/fcl-web/examples/fptemplate/embedtemplates/templates/top.html
A packages/fcl-web/examples/fptemplate/embedtemplates/templates/bottom.html
A packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_left.html
A packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_right.html
A packages/fcl-web/examples/fptemplate/tagparam
A packages/fcl-web/examples/fptemplate/tagparam/apache
A packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpi
A packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.res
A packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpr
A packages/fcl-web/examples/fptemplate/tagparam/cgi
A packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpi
A packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.res
A packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpr
A packages/fcl-web/examples/fptemplate/tagparam/webmodule
A packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.lfm
A packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.pas
A packages/fcl-web/examples/fptemplate/tagparam/fcgi
A packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpi
A packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.res
A packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpr
A packages/fcl-web/examples/fptemplate/tagparam/README.txt
A packages/fcl-web/examples/fptemplate/tagparam/templates
A packages/fcl-web/examples/fptemplate/tagparam/templates/mytemplate2.html
A packages/fcl-web/examples/fptemplate/listrecords
A packages/fcl-web/examples/fptemplate/listrecords/apache
A packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpi
A packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.res
A packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpr
A packages/fcl-web/examples/fptemplate/listrecords/cgi
A packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpi
A packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.res
A packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpr
A packages/fcl-web/examples/fptemplate/listrecords/webmodule
A packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.lfm
A packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.pas
A packages/fcl-web/examples/fptemplate/listrecords/fcgi
A packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpi
A packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.res
A packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpr
A packages/fcl-web/examples/fptemplate/listrecords/README.txt
A packages/fcl-web/examples/fptemplate/listrecords/templates
A packages/fcl-web/examples/fptemplate/listrecords/templates/mytemplate3.html
A packages/fcl-web/examples/session
A packages/fcl-web/examples/session/sessiondemo.lpr
A packages/fcl-web/examples/session/wmsession.lfm
A packages/fcl-web/examples/session/wmsession.pp
A packages/fcl-web/examples/session/sessiondemo.lpi
A packages/fcl-web/examples/helloworld
A packages/fcl-web/examples/helloworld/apache
A packages/fcl-web/examples/helloworld/apache/helloworld.res
A packages/fcl-web/examples/helloworld/apache/helloworld.lpr
A packages/fcl-web/examples/helloworld/apache/helloworld.lpi
A packages/fcl-web/examples/helloworld/cgi
A packages/fcl-web/examples/helloworld/cgi/helloworld.res
A packages/fcl-web/examples/helloworld/cgi/helloworld.lpr
A packages/fcl-web/examples/helloworld/cgi/helloworld.lpi
A packages/fcl-web/examples/helloworld/webmodule
A packages/fcl-web/examples/helloworld/webmodule/webmodule.lfm
A packages/fcl-web/examples/helloworld/webmodule/webmodule.pas
A packages/fcl-web/examples/helloworld/fcgi
A packages/fcl-web/examples/helloworld/fcgi/helloworld.res
A packages/fcl-web/examples/helloworld/fcgi/helloworld.lpr
A packages/fcl-web/examples/helloworld/fcgi/helloworld.lpi
A packages/fcl-web/examples/helloworld/README.txt
A packages/fcl-web/examples/echo
A packages/fcl-web/examples/echo/apache
A packages/fcl-web/examples/echo/apache/echo.lpi
A packages/fcl-web/examples/echo/apache/echo.res
A packages/fcl-web/examples/echo/apache/echo.lpr
A packages/fcl-web/examples/echo/cgi
A packages/fcl-web/examples/echo/cgi/echo.lpi
A packages/fcl-web/examples/echo/cgi/echo.res
A packages/fcl-web/examples/echo/cgi/echo.lpr
A packages/fcl-web/examples/echo/webmodule
A packages/fcl-web/examples/echo/webmodule/wmecho.lfm
A packages/fcl-web/examples/echo/webmodule/wmecho.pas
A packages/fcl-web/examples/echo/fcgi
A packages/fcl-web/examples/echo/fcgi/echo.lpi
A packages/fcl-web/examples/echo/fcgi/echo.res
A packages/fcl-web/examples/echo/fcgi/echo.lpr
A packages/fcl-web/examples/echo/README.txt
--- Merging r17743 into '.':
A packages/fcl-web/src/base/FCGI-README.txt
--- Merging r17763 into '.':
U packages/fcl-web/src/base/fphttpclient.pp
--- Merging r17912 into '.':
U packages/fcl-web/src/webdata/extjsjson.pp
--- Merging r17913 into '.':
U packages/fcl-web/src/webdata/sqldbwebdata.pp
--- Merging r17916 into '.':
U packages/fcl-web/src/base/custfcgi.pp
--- Merging r17917 into '.':
U packages/httpd22/src/aprutil/apr_uri.inc
U packages/httpd22/src/http_core.inc
--- Merging r17918 into '.':
G packages/fcl-web/src/base/fpapache.pp
Summary of conflicts:
Text conflicts: 1
# revisions: 17632,17633,17645,17646,17647,17653,17656,17707,17718,17740,17741,17742,17743,17763,17912,17913,17916,17917,17918
------------------------------------------------------------------------
r17632 | michael | 2011-06-02 17:26:04 +0200 (Thu, 02 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/Makefile
M /trunk/packages/fcl-web/src/base/Makefile.fpc
M /trunk/packages/fcl-web/src/base/README.txt
A /trunk/packages/fcl-web/src/base/custhttpapp.pp
A /trunk/packages/fcl-web/src/base/fphttpapp.pp
M /trunk/packages/fcl-web/src/base/fphttpserver.pp
A /trunk/packages/fcl-web/src/base/fpwebfile.pp
M /trunk/packages/fcl-web/src/base/httpdefs.pp
+ Added HTTPApp for standalone webserver and webfilemodule for standalone serving of files
------------------------------------------------------------------------
------------------------------------------------------------------------
r17633 | michael | 2011-06-02 17:27:31 +0200 (Thu, 02 Jun 2011) | 1 line
Changed paths:
A /trunk/packages/fcl-web/examples/httpapp
A /trunk/packages/fcl-web/examples/httpapp/testhttp.lpi
A /trunk/packages/fcl-web/examples/httpapp/testhttp.pp
+ Sample application for HTTPApplication and file server
------------------------------------------------------------------------
------------------------------------------------------------------------
r17645 | michael | 2011-06-03 09:35:21 +0200 (Fri, 03 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/httpdefs.pp
* Storage for pathinfo
------------------------------------------------------------------------
------------------------------------------------------------------------
r17646 | michael | 2011-06-03 09:36:07 +0200 (Fri, 03 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/fphttpserver.pp
* Pass PATHINFO to request, full URL
------------------------------------------------------------------------
------------------------------------------------------------------------
r17647 | michael | 2011-06-03 09:36:36 +0200 (Fri, 03 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/fpwebfile.pp
* Fix in case PATHINFO is used instead of full URL
------------------------------------------------------------------------
------------------------------------------------------------------------
r17653 | michael | 2011-06-04 15:20:25 +0200 (Sat, 04 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/fphttp.pp
M /trunk/packages/fcl-web/src/base/httpdefs.pp
M /trunk/packages/fcl-web/src/base/iniwebsession.pp
* Moved session cookie up in the class hierarchie, so it can be configured at the session factory level
------------------------------------------------------------------------
------------------------------------------------------------------------
r17656 | michael | 2011-06-04 18:47:29 +0200 (Sat, 04 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/fpapache.pp
* Fixed crash when getting remotehost. Bug 19397
------------------------------------------------------------------------
------------------------------------------------------------------------
r17707 | michael | 2011-06-09 17:24:04 +0200 (Thu, 09 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/iniwebsession.pp
* Transfer global sessioncookie and sessioncookiepath to IniWebSession
------------------------------------------------------------------------
------------------------------------------------------------------------
r17718 | michael | 2011-06-11 13:54:01 +0200 (Sat, 11 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-xml/src/htmlelements.pp
* Patch from Ido Kanner to add HTMLEncode and HTMLDecode
------------------------------------------------------------------------
------------------------------------------------------------------------
r17740 | michael | 2011-06-13 14:57:32 +0200 (Mon, 13 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/examples/combined/wmlogin.pp
D /trunk/packages/fcl-web/examples/combined/wmusers.lrs
M /trunk/packages/fcl-web/examples/combined/wmusers.pp
M /trunk/packages/fcl-web/examples/jsonrpc/demo1/demo.lpi
M /trunk/packages/fcl-web/examples/jsonrpc/demo1/demo.lpr
D /trunk/packages/fcl-web/examples/jsonrpc/demo1/wmdemo.lrs
M /trunk/packages/fcl-web/examples/jsonrpc/demo1/wmdemo.pp
M /trunk/packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi
D /trunk/packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs
M /trunk/packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp
M /trunk/packages/fcl-web/examples/webdata/demo/createusers.lpi
M /trunk/packages/fcl-web/examples/webdata/demo/createusers.lpr
D /trunk/packages/fcl-web/examples/webdata/demo/wmusers.lrs
M /trunk/packages/fcl-web/examples/webdata/demo/wmusers.pp
D /trunk/packages/fcl-web/examples/webdata/demo2/wmusers.lrs
M /trunk/packages/fcl-web/examples/webdata/demo2/wmusers.pp
M /trunk/packages/fcl-web/examples/webdata/demo3/extgrid.lpi
M /trunk/packages/fcl-web/examples/webdata/demo3/extgrid.lpr
D /trunk/packages/fcl-web/examples/webdata/demo3/tralala.lrs
D /trunk/packages/fcl-web/examples/webdata/demo3/wmusers.lrs
M /trunk/packages/fcl-web/examples/webdata/demo3/wmusers.pp
D /trunk/packages/fcl-web/examples/webdata/demo4/dmusers.lrs
M /trunk/packages/fcl-web/examples/webdata/demo4/dmusers.pp
M /trunk/packages/fcl-web/examples/webdata/demo4/extgrid.lpi
M /trunk/packages/fcl-web/examples/webdata/demo4/extgrid.lpr
D /trunk/packages/fcl-web/examples/webdata/demo4/wmjsonusers.lrs
M /trunk/packages/fcl-web/examples/webdata/demo4/wmjsonusers.pp
D /trunk/packages/fcl-web/examples/webdata/demo4/wmxmlusers.lrs
M /trunk/packages/fcl-web/examples/webdata/demo4/wmxmlusers.pp
D /trunk/packages/fcl-web/examples/webdata/demo5/wmusers.lrs
M /trunk/packages/fcl-web/examples/webdata/demo5/wmusers.pp
M /trunk/packages/fcl-web/examples/webdata/demo6/extgrid.lpi
M /trunk/packages/fcl-web/examples/webdata/demo6/extgrid.lpr
D /trunk/packages/fcl-web/examples/webdata/demo6/wmusers.lrs
M /trunk/packages/fcl-web/examples/webdata/demo6/wmusers.pp
* Lazarus is no longer needed for the examples
------------------------------------------------------------------------
------------------------------------------------------------------------
r17741 | michael | 2011-06-13 14:58:01 +0200 (Mon, 13 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/examples/httpapp/testhttp.lpi
* Save session info in separate file
------------------------------------------------------------------------
------------------------------------------------------------------------
r17742 | michael | 2011-06-13 15:06:00 +0200 (Mon, 13 Jun 2011) | 1 line
Changed paths:
A /trunk/packages/fcl-web/examples/echo
A /trunk/packages/fcl-web/examples/echo/README.txt
A /trunk/packages/fcl-web/examples/echo/apache
A /trunk/packages/fcl-web/examples/echo/apache/echo.lpi
A /trunk/packages/fcl-web/examples/echo/apache/echo.lpr
A /trunk/packages/fcl-web/examples/echo/apache/echo.res
A /trunk/packages/fcl-web/examples/echo/cgi
A /trunk/packages/fcl-web/examples/echo/cgi/echo.lpi
A /trunk/packages/fcl-web/examples/echo/cgi/echo.lpr
A /trunk/packages/fcl-web/examples/echo/cgi/echo.res
A /trunk/packages/fcl-web/examples/echo/fcgi
A /trunk/packages/fcl-web/examples/echo/fcgi/echo.lpi
A /trunk/packages/fcl-web/examples/echo/fcgi/echo.lpr
A /trunk/packages/fcl-web/examples/echo/fcgi/echo.res
A /trunk/packages/fcl-web/examples/echo/webmodule
A /trunk/packages/fcl-web/examples/echo/webmodule/wmecho.lfm
A /trunk/packages/fcl-web/examples/echo/webmodule/wmecho.pas
A /trunk/packages/fcl-web/examples/fptemplate
A /trunk/packages/fcl-web/examples/fptemplate/README.txt
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/README.txt
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/apache
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpi
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpr
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.res
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/cgi
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpi
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpr
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.res
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpi
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpr
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.res
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/templates
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body.html
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_left.html
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_right.html
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/templates/bottom.html
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/templates/maintemplate.html
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/templates/top.html
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/webmodule
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.lfm
A /trunk/packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.pas
A /trunk/packages/fcl-web/examples/fptemplate/fileupload
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/README.txt
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/apache
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpi
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpr
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.res
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/cgi
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpi
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpr
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.res
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/fcgi
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpi
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpr
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.res
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/templates
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/templates/uploadform.html
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/webmodule
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.lfm
A /trunk/packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.pas
A /trunk/packages/fcl-web/examples/fptemplate/listrecords
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/README.txt
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/apache
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpi
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpr
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.res
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/cgi
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpi
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpr
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.res
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/fcgi
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpi
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpr
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.res
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/templates
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/templates/mytemplate3.html
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/webmodule
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.lfm
A /trunk/packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.pas
A /trunk/packages/fcl-web/examples/fptemplate/sessions
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/README.txt
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpr
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.res
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpr
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.res
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpr
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.res
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/templates
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/templates/autosession-template.html
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.lfm
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.pas
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/README.txt
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpr
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.res
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpr
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.res
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpr
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.res
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogin.html
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogout.html
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testsomepage.html
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testwelcome.html
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/userdb.txt
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.lfm
A /trunk/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.pas
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/README.txt
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpr
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.res
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpr
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.res
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpi
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpr
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.res
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogin.html
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogout.html
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlsomepage.html
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlwelcome.html
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/userdb.txt
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.lfm
A /trunk/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.pas
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/README.txt
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/apache
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpi
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpr
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.res
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/cgi
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpi
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpr
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.res
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpi
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpr
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.res
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/templates
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/templates/mytemplate1.html
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/webmodule
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.lfm
A /trunk/packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.pas
A /trunk/packages/fcl-web/examples/fptemplate/tagparam
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/README.txt
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/apache
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpi
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpr
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.res
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/cgi
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpi
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpr
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.res
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/fcgi
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpi
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpr
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.res
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/templates
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/templates/mytemplate2.html
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/webmodule
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.lfm
A /trunk/packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.pas
A /trunk/packages/fcl-web/examples/helloworld
A /trunk/packages/fcl-web/examples/helloworld/README.txt
A /trunk/packages/fcl-web/examples/helloworld/apache
A /trunk/packages/fcl-web/examples/helloworld/apache/helloworld.lpi
A /trunk/packages/fcl-web/examples/helloworld/apache/helloworld.lpr
A /trunk/packages/fcl-web/examples/helloworld/apache/helloworld.res
A /trunk/packages/fcl-web/examples/helloworld/cgi
A /trunk/packages/fcl-web/examples/helloworld/cgi/helloworld.lpi
A /trunk/packages/fcl-web/examples/helloworld/cgi/helloworld.lpr
A /trunk/packages/fcl-web/examples/helloworld/cgi/helloworld.res
A /trunk/packages/fcl-web/examples/helloworld/fcgi
A /trunk/packages/fcl-web/examples/helloworld/fcgi/helloworld.lpi
A /trunk/packages/fcl-web/examples/helloworld/fcgi/helloworld.lpr
A /trunk/packages/fcl-web/examples/helloworld/fcgi/helloworld.res
A /trunk/packages/fcl-web/examples/helloworld/webmodule
A /trunk/packages/fcl-web/examples/helloworld/webmodule/webmodule.lfm
A /trunk/packages/fcl-web/examples/helloworld/webmodule/webmodule.pas
A /trunk/packages/fcl-web/examples/session
A /trunk/packages/fcl-web/examples/session/sessiondemo.lpi
A /trunk/packages/fcl-web/examples/session/sessiondemo.lpr
A /trunk/packages/fcl-web/examples/session/wmsession.lfm
A /trunk/packages/fcl-web/examples/session/wmsession.pp
* Attila Borka adapted examples from Lazarus so they do not rely on the LCL. Moving them to FPC
------------------------------------------------------------------------
------------------------------------------------------------------------
r17743 | michael | 2011-06-13 15:07:53 +0200 (Mon, 13 Jun 2011) | 1 line
Changed paths:
A /trunk/packages/fcl-web/src/base/FCGI-README.txt
* Readme explaining use of FastCGI (by Attila Borka)
------------------------------------------------------------------------
------------------------------------------------------------------------
r17763 | michael | 2011-06-16 21:11:16 +0200 (Thu, 16 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/fphttpclient.pp
* Fixed bug where multiple methods were run one after the other
------------------------------------------------------------------------
------------------------------------------------------------------------
r17912 | michael | 2011-07-02 15:00:50 +0200 (Sat, 02 Jul 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/webdata/extjsjson.pp
* Proper fix for ExtJS Delete operation which sometimes sends only an ID
------------------------------------------------------------------------
------------------------------------------------------------------------
r17913 | michael | 2011-07-02 15:03:51 +0200 (Sat, 02 Jul 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/webdata/sqldbwebdata.pp
* Proper fix for ID field not always being named properly in ExtJS delete operation.
------------------------------------------------------------------------
------------------------------------------------------------------------
r17916 | michael | 2011-07-03 10:45:55 +0200 (Sun, 03 Jul 2011) | 1 line
Changed paths:
M /trunk/packages/fcl-web/src/base/custfcgi.pp
* Handle ESysEINTR more carefully under linux. Do not raise exception in case of termination
------------------------------------------------------------------------
------------------------------------------------------------------------
r17917 | michael | 2011-07-03 11:34:59 +0200 (Sun, 03 Jul 2011) | 1 line
Changed paths:
M /trunk/packages/httpd22/src/aprutil/apr_uri.inc
M /trunk/packages/httpd22/src/http_core.inc
* Corrected alignment for some fields (missing bitfields)
------------------------------------------------------------------------
------------------------------------------------------------------------
r17918 | michael | 2011-07-03 11:35:57 +0200 (Sun, 03 Jul 2011) | 2 lines
Changed paths:
M /trunk/packages/fcl-web/src/base/fpapache.pp
* Re-enabled per-dir config when getting remote host.
(fields are now correctly aligned in apache header structs)
------------------------------------------------------------------------
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/fixes_2_4@17977 3ad0048d-3df7-0310-abae-a5850022a9f2
202 files changed, 8998 insertions, 1127 deletions
diff --git a/packages/fcl-web/examples/combined/wmlogin.pp b/packages/fcl-web/examples/combined/wmlogin.pp index 671dedcd27..79ef90824f 100644 --- a/packages/fcl-web/examples/combined/wmlogin.pp +++ b/packages/fcl-web/examples/combined/wmlogin.pp @@ -5,7 +5,7 @@ unit wmlogin; interface uses - Classes, SysUtils, FileUtil, HTTPDefs, websession, fpHTTP, fpWeb, fpjsonrpc, + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb, fpjsonrpc, fpjson, IBConnection, sqldb, webjsonrpc, fpextdirect, sqldbwebdata; type diff --git a/packages/fcl-web/examples/combined/wmusers.lrs b/packages/fcl-web/examples/combined/wmusers.lrs deleted file mode 100644 index 7d7cb7082d..0000000000 --- a/packages/fcl-web/examples/combined/wmusers.lrs +++ /dev/null @@ -1,35 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TCombinedModule','FORMDATA',[ - 'TPF0'#15'TCombinedModule'#14'CombinedModule'#8'OnCreate'#7#16'DataModuleCrea' - +'te'#14'OldCreateOrder'#8#12'InputAdaptor'#7#20'ProviderInputAdaptor'#15'Con' - +'tentProducer'#7#17'ProviderFormatter'#20'OnGetContentProducer'#7#28'DataMod' - +'uleGetContentProducer'#17'OnGetInputAdaptor'#7#25'DataModuleGetInputAdaptor' - +#12'OnNewSession'#7#20'DataModuleNewSession'#6'Height'#3','#1#16'HorizontalO' - +'ffset'#3'{'#2#14'VerticalOffset'#3#230#0#5'Width'#3#144#1#0#23'TExtJSJSONDa' - +'taFormatter'#17'ProviderFormatter'#13'AllowPageSize'#8#16'BeforeDataToJSON' - +#7'!ProviderFormatterBeforeDataToJSON'#12'BeforeUpdate'#7#29'ProviderFormatt' - +'erBeforeUpdate'#12'BeforeInsert'#7#29'ProviderFormatterBeforeInsert'#12'Bef' - +'oreDelete'#7#29'ProviderFormatterBeforeDelete'#4'left'#3#16#1#3'top'#2'H'#0 - +#0#21'TSQLDBWebDataProvider'#5'Users'#17'SelectSQL.Strings'#1#6'USELECT FIRS' - +'T :limit SKIP :start U_ID, U_NAME, U_LOGIN, U_PASSWORD, U_EMAIL FROM USERS' - +#0#17'UpdateSQL.Strings'#1#6#16'UPDATE USERS SET'#6#17' U_NAME=:U_NAME,'#6 - +#19' U_LOGIN=:U_LOGIN,'#6#19' U_EMAIL=:U_EMAIL,'#6#24' U_PASSWORD=:U_PASS' - +'WORD'#6#5'WHERE'#6#14' (U_ID=:U_ID)'#0#17'DeleteSQL.Strings'#1#6'"DELETE F' - +'ROM USERS WHERE (U_ID=:ID)'#0#17'InsertSQL.Strings'#1#6#17'INSERT INTO USER' - +'S'#6',(U_ID, U_LOGIN, U_NAME, U_EMAIL, U_PASSWORD)'#6#6'VALUES'#6'1(:U_ID, ' - +':U_LOGIN, :U_NAME, :U_EMAIL, :U_PASSWORD)'#0#10'Connection'#7#13'IBConnecti' - +'on1'#11'IDFieldName'#6#4'U_ID'#10'OnGetNewID'#7#13'UsersGetNewID'#7'Options' - +#11#0#6'Params'#14#1#8'DataType'#7#9'ftUnknown'#4'Name'#6#5'limit'#9'ParamTy' - +'pe'#7#9'ptUnknown'#0#1#8'DataType'#7#9'ftUnknown'#4'Name'#6#5'start'#9'Para' - +'mType'#7#9'ptUnknown'#0#0#4'left'#2' '#3'top'#2'H'#0#0#13'TIBConnection'#13 - +'IBConnection1'#9'Connected'#8#11'LoginPrompt'#8#14'KeepConnection'#8#11'Tra' - +'nsaction'#7#15'SQLTransaction1'#9'LogEvents'#11#0#4'left'#2' '#3'top'#2#16#0 - +#0#9'TSQLQuery'#6'QGetID'#14'AutoCalcFields'#8#8'Database'#7#13'IBConnection' - +'1'#11'Transaction'#7#15'SQLTransaction1'#8'ReadOnly'#8#11'SQL.Strings'#1#6 - +'6SELECT GEN_ID(GEN_USERS,1) AS THEID FROM RDB$DATABASE'#0#6'Params'#14#0#4 - +'left'#2' '#3'top'#3#128#0#0#0#15'TSQLTransaction'#15'SQLTransaction1'#6'Act' - +'ive'#8#6'Action'#7#6'caNone'#8'Database'#7#13'IBConnection1'#4'left'#3#144#0 - +#3'top'#2#16#0#0#29'TExtJSJSonWebdataInputAdaptor'#20'ProviderInputAdaptor'#4 - +'left'#3#16#1#3'top'#2#16#0#0#0 -]); diff --git a/packages/fcl-web/examples/combined/wmusers.pp b/packages/fcl-web/examples/combined/wmusers.pp index 752b03af52..73c74483bd 100644 --- a/packages/fcl-web/examples/combined/wmusers.pp +++ b/packages/fcl-web/examples/combined/wmusers.pp @@ -5,7 +5,7 @@ unit wmusers; interface uses - Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb, + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb, IBConnection, sqldb, fpwebdata, fpjson, extjsjson, extjsxml, sqldbwebdata; type @@ -43,6 +43,8 @@ var implementation +{$R *.lfm} + uses inifiles; { TCombinedModule } @@ -138,8 +140,6 @@ begin end; initialization - {$I wmusers.lrs} - RegisterHTTPModule('Provider', TCombinedModule); end. diff --git a/packages/fcl-web/examples/echo/README.txt b/packages/fcl-web/examples/echo/README.txt new file mode 100644 index 0000000000..7bb00c2cec --- /dev/null +++ b/packages/fcl-web/examples/echo/README.txt @@ -0,0 +1,117 @@ +Responds with the calling and system parameters, example +================================================ +Demonstrates how to create a basic fpweb application. It responds to a request +with a list of received/sent parameters, server settings and variables. + +Note, that other than the main project file (echo.lpr) there is not much that +needs to change with using fpweb, no matter if we create CGI/FCGI applications +or Apache modules. The web server config is different for each, of course. + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule echo.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the choosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- + +2.a; as CGI +----------- +http://<WebServer>/cgi-bin/<CGIExecutableName>/ should start the example if +everything is set up properly. +ex: http://127.0.0.1:8080/cgi-bin/echo.exe/ + +Note: You need to change the CGI application name if needed (for example, on +Linux it is not echo.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL. + + +2.b; as Apache module +--------------------- +http://<WebServer>/<ApacheLocationName>/ should start the example if +everything is set up properly. +ex: http://127.0.0.1:8080/myapache/ + +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule mod_echo "<path_to_mod>/echo.dll" +<Location /myapache> + SetHandler mod_echo + Order allow,deny + Allow from all +</Location> + +Note: You need to change the module name if needed. For example on Linux, +the module can be libecho.so or just simply libecho and not echo.dll . + +Note: If you recompile an Apache module while the module itself is loaded into +the Apache server, the compilation will fail, because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +Apache server before you recompile or before you copy over the new version of +the created module. + + +2.c; as FCGI +------------ +http://<WebServer>/<ApacheScriptAliasName>/ should start the example if +everything is set up properly. +ex: http://127.0.0.1:8080/myfcgi/ +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#External FCGI app, has to start manually, Apache will not do it + FastCgiExternalServer "<path_to_fcgi_app>/echo.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush +#optionally, to shorten the calling URL and to not display the executable file name (if used, no +ExecCGI is needed above) + ScriptAlias /myfcgi "<path_to_fcgi_app>/echo.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (echo.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way. diff --git a/packages/fcl-web/examples/echo/apache/echo.lpi b/packages/fcl-web/examples/echo/apache/echo.lpi new file mode 100644 index 0000000000..8835274c51 --- /dev/null +++ b/packages/fcl-web/examples/echo/apache/echo.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="echo.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="echo"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\wmecho.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="EchoModule"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="wmecho"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/echo/apache/echo.lpr b/packages/fcl-web/examples/echo/apache/echo.lpr new file mode 100644 index 0000000000..3d8379b339 --- /dev/null +++ b/packages/fcl-web/examples/echo/apache/echo.lpr @@ -0,0 +1,37 @@ +Library echo; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, wmecho; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_echo'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. + diff --git a/packages/fcl-web/examples/echo/apache/echo.res b/packages/fcl-web/examples/echo/apache/echo.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/echo/apache/echo.res diff --git a/packages/fcl-web/examples/echo/cgi/echo.lpi b/packages/fcl-web/examples/echo/cgi/echo.lpi new file mode 100644 index 0000000000..cd8d0db04f --- /dev/null +++ b/packages/fcl-web/examples/echo/cgi/echo.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="echo.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="echo"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\wmecho.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="EchoModule"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="wmecho"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/echo/cgi/echo.lpr b/packages/fcl-web/examples/echo/cgi/echo.lpr new file mode 100644 index 0000000000..64539c4597 --- /dev/null +++ b/packages/fcl-web/examples/echo/cgi/echo.lpr @@ -0,0 +1,14 @@ +program echo; + +{$mode objfpc}{$H+} + +uses + fpCGI, wmecho; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end. + diff --git a/packages/fcl-web/examples/echo/cgi/echo.res b/packages/fcl-web/examples/echo/cgi/echo.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/echo/cgi/echo.res diff --git a/packages/fcl-web/examples/echo/fcgi/echo.lpi b/packages/fcl-web/examples/echo/fcgi/echo.lpi new file mode 100644 index 0000000000..cd8d0db04f --- /dev/null +++ b/packages/fcl-web/examples/echo/fcgi/echo.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="echo.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="echo"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\wmecho.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="EchoModule"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="wmecho"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/echo/fcgi/echo.lpr b/packages/fcl-web/examples/echo/fcgi/echo.lpr new file mode 100644 index 0000000000..c21ea7122c --- /dev/null +++ b/packages/fcl-web/examples/echo/fcgi/echo.lpr @@ -0,0 +1,15 @@ +program echo; + +{$mode objfpc}{$H+} + +uses + fpFCGI, wmecho; + +{$R *.res} + +begin + Application.Port:=2015;//Port the FCGI application is listening on + Application.Initialize; + Application.Run; +end. + diff --git a/packages/fcl-web/examples/echo/fcgi/echo.res b/packages/fcl-web/examples/echo/fcgi/echo.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/echo/fcgi/echo.res diff --git a/packages/fcl-web/examples/echo/webmodule/wmecho.lfm b/packages/fcl-web/examples/echo/webmodule/wmecho.lfm new file mode 100644 index 0000000000..aadaa34a9f --- /dev/null +++ b/packages/fcl-web/examples/echo/webmodule/wmecho.lfm @@ -0,0 +1,9 @@ +object EchoModule: TEchoModule + OldCreateOrder = False + OnRequest = EchoModuleRequest + CreateSession = False + Height = 282 + HorizontalOffset = 153 + VerticalOffset = 411 + Width = 316 +end diff --git a/packages/fcl-web/examples/echo/webmodule/wmecho.pas b/packages/fcl-web/examples/echo/webmodule/wmecho.pas new file mode 100644 index 0000000000..28ba2ad522 --- /dev/null +++ b/packages/fcl-web/examples/echo/webmodule/wmecho.pas @@ -0,0 +1,53 @@ +unit wmecho; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, httpdefs, fpHTTP, fpWeb, webutil; + +type + + { TEchoModule } + + TEchoModule = class(TFPWebModule) + procedure EchoModuleRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + private + { private declarations } + public + { public declarations } + end; + +var + EchoModule: TEchoModule; + +implementation + +{$R *.lfm} + +{ TEchoModule } + +procedure TEchoModule.EchoModuleRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +Var + S : TStrings; + +begin + S:=TStringList.Create; + try + // Analyze request. + DumpRequest(ARequest,S); + + AResponse.Contents:=S; + Handled:=True; + finally + S.Free; + end; +end; + +initialization + RegisterHTTPModule('TEchoModule', TEchoModule); +end. + diff --git a/packages/fcl-web/examples/fptemplate/README.txt b/packages/fcl-web/examples/fptemplate/README.txt new file mode 100644 index 0000000000..5d2695c35b --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/README.txt @@ -0,0 +1,63 @@ +FPTemplate examples +=================== +These examples are demonstrating some uses of templates (with FPTemplate) when +generating HTML pages by CGI/FCGI programs or Apache modules. + +The main idea is to leave the web page designing and look&feel to the web page +designers. Separating the web page design from the back-end CGI/FCGI/Apache +application makes it possible to design, change or redesign a whole website +without modifying a single line of code in the CGI/FCGI/Apache application. +Back-end programmers and web page designers can work parallel easily, and +neither side needs extensive knowledge of the other (does not hurt, just not +necessary most of the time). + +With all this said, none of the examples are focusing on nice look and feel in +their template designs, merely on demonstrating the functionality and use of +templates, template-tags and template-tag-parameters with live applications. + + +Examples list: + +1. /simpletemplate/*.* +The simplest template with one template tag in it to be replaced by the +CGI/FCGI/Apache application when generating the response page -> {TagName1} +See README.txt + +2. /tagparam/*.* +Demonstrating the set up and use of template tag parameter(s) +-> {+DATETIME [-FORMAT=MM/DD hh:mm:ss-]+} + +3. /listrecords/*.* +Demonstrates the use of a template tag with multiple template tag parameters +to list multiple records, tables, lists, etc. +See README.txt + +4. /fileupload/*.* +Demonstrates uploading file(s) to a web server with the help of a CGI/FCGI +program or Apache module by using so called "multipart" html forms. +See README.txt + +5. /sessions/*.* +These examples demonstrate three different ways to maintain and use sessions +when building web sites that need to carry over or store information to +following web pages, differentiate between visitors, etc. + +5.a. /sessions/cookiesessions-auto/*.* +See README.txt + +5.b. /sessions/cookiesessions-login/*.* +See README.txt + +5.c. /sessions/urlsessions-login/*.* +See README.txt + +6. /embedtemplates/*.* +An example to show how to implement recursively embedded templates with fpweb. +See README.txt + +Note: All of the examples have CGI, FCGI and Apache variations. The web +modules (webmodule.pas, webmodule.lfm) and template html files for the paired +CGI/FCGI/Apache applications are exactly the same, showing that from a +developer standpoint there is not too much difference between writing CGI/FCGI +programs or Apache modules with fcl-web (fpweb). The main differences are in +the main project files (.lpr) and in the web server configurations. diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/README.txt b/packages/fcl-web/examples/fptemplate/embedtemplates/README.txt new file mode 100644 index 0000000000..fba32503b9 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/README.txt @@ -0,0 +1,144 @@ +Recursively embedded templates, example +=============================== +Demonstrates how to recursively embed templates using template tags. +Note, that the only difference between CGI/FCGI and Apache module is in the +main project .lpr file and the web server (Apache) configuration. + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule embedtemplates.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the chosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- +The application needs read access to the template file(s). +It is best to use full paths with the file names in the web module +(webmodule.pas), because Apache will probably look relative to the / (main +root) directory or main Apache directory and not relative to the application +file location. +ex: TMPTemplate.FileName := '/full/path/to/templates/'+TemplateFile+'.html'; + + +2.a; as CGI +----------- +Usually it works if you put the templates next to the CGI executable file +under a /templates subdirectory. +(ex: ...cgi-bin/templates/maintemplate.html , etc.) +Adjust the file path in the web module (webmodule.pas) accordingly. + +http://<WebServer>/cgi-bin/<CGIExecutableName>/func1call should start the +example if everything is set up properly, and the executable is copied into +the Apache cgi-bin directory with the template files under ./templates . +ex: http://127.0.0.1:8080/cgi-bin/embedtemplates.exe/func1call + +If the calling URL looks too long, or you want to hide it a little bit more, +you can use a ScriptAlias in the Apache configuration file to make it shorter. +ex: ScriptAlias /mycgi "<path_to_cgi_app>/embedtemplates.exe" in your conf +file will make http://127.0.0.1:8080/mycgi/func1call work the same way. + +Note: You need to change the URLs if "cgi-bin" or "embedtemplates.exe" +changes (for example on Linux it is not embedtemplates.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL. + + +2.b; as Apache module +--------------------- +Usually it works if you put the templates into the Apache main directory (not +the DocumentRoot, but the main Apache directory). +(.../templates/maintemplate.html , etc.) +Adjust the file path in the web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheLocationName>/func1call should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/myapache/func1call +or http://127.0.0.1/myapache/func1call +if in httpd.conf it was set up as: +LoadModule mod_embedtemplates "<path_to_mod>/embedtemplates.dll" +<Location /myapache> + SetHandler mod_embedtemplates + Order allow,deny + Allow from all +</Location> + +Note: You need to change the URLs in the templates if "myapache" or the +module name changes. For example on Linux the module can be +libembedtemplates.so and not embedtemplates.dll + +Note: If you recompile an apache module while the module itself is loaded into +the Apache server, the compilation might fail because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +server before you recompile or before you copy over the new version of the +newly created module. +On Linux, it is enough to simply reload Apache after recompile. + + +2.c; as FCGI +------------ +Usually it works if you put the templates next to the FCGI executable file +under a /templates subdirectory. +(..../templates/maintemplate.html , etc.) +Adjust the file path in the web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/func1call should start the example +if everything is set up properly. +ex: http://127.0.0.1:8080/myfcgi/func1call +or http://127.0.0.1/myfcgi/func1call +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#External FCGI app, has to start manually, Apache will not do it + FastCgiExternalServer "<path_to_fcgi_app>/embedtemplates.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush +#optionally, to shorten the calling URL and to not display the executable file name (if used, no +ExecCGI is needed above) + ScriptAlias /myfcgi "<path_to_fcgi_app>/embedtemplates.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (embedtemplates.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpi b/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpi new file mode 100644 index 0000000000..a6c03c7a87 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="embedtemplates.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="embedtemplates"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpr b/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpr new file mode 100644 index 0000000000..382e2993a8 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.lpr @@ -0,0 +1,36 @@ +Library embedtemplates; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, webmodule; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_embedtemplates'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.res b/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/apache/embedtemplates.res diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpi b/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpi new file mode 100644 index 0000000000..fc47b1abad --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="embedtemplates.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="embedtemplates"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpr b/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpr new file mode 100644 index 0000000000..2758cbb624 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.lpr @@ -0,0 +1,13 @@ +program embedtemplates; + +{$mode objfpc}{$H+} + +uses + fpCGI, webmodule; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.res b/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/cgi/embedtemplates.res diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpi b/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpi new file mode 100644 index 0000000000..fc47b1abad --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="embedtemplates.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="embedtemplates"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpr b/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpr new file mode 100644 index 0000000000..66f2d74189 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.lpr @@ -0,0 +1,14 @@ +program embedtemplates; + +{$mode objfpc}{$H+} + +uses + fpFCGI, webmodule; + +{$R *.res} + +begin + Application.Port:=2015;//Port the FCGI application is listening on + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.res b/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/fcgi/embedtemplates.res diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body.html b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body.html new file mode 100644 index 0000000000..03f2aa1640 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body.html @@ -0,0 +1,14 @@ +<!-- body.html start --> +<br> +Something here for the body + +<table border=1> + <tr> + <td valign="center" width=200 height=200> +{+INCLUDETEMPLATE [-TEMPLATEFILE=body_left.html-]+} + </td><td valign="center" width=200 height=200> +{+INCLUDETEMPLATE [-TEMPLATEFILE=body_right.html-]+} + </td> + </tr> +</table> +<!-- body.html end -->
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_left.html b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_left.html new file mode 100644 index 0000000000..97177b9921 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_left.html @@ -0,0 +1,9 @@ +<!-- body_left.html start --> +Body left +<ul> +<li>a +<li>b +<li>c +<li>d +</ul> +<!-- body_left.html end -->
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_right.html b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_right.html new file mode 100644 index 0000000000..ef08b5bcf9 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/body_right.html @@ -0,0 +1,9 @@ +<!-- body_right.html start --> +Body right +<ul> +<li>1 +<li>2 +<li>3 +<li>4 +</ul> +<!-- body_right.html end -->
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/templates/bottom.html b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/bottom.html new file mode 100644 index 0000000000..6c4e41c764 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/bottom.html @@ -0,0 +1,11 @@ +<!-- bottom.html start --> +<br> +<table border=1> + <tr> + <td> +<b>Bottom part</b> +Powered by FPC/Lazarus (c){+DATETIME [-FORMAT=YYYY-]+} + </td> + </tr> +</table> +<!-- bottom.html end -->
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/templates/maintemplate.html b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/maintemplate.html new file mode 100644 index 0000000000..2592d0fb75 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/maintemplate.html @@ -0,0 +1,13 @@ +<html> +<body> +<!-- maintemplate.html start --> + +{+INCLUDETEMPLATE [-TEMPLATEFILE=top.html-]+} + +{+INCLUDETEMPLATE [-TEMPLATEFILE=body.html-]+} + +{+INCLUDETEMPLATE [-TEMPLATEFILE=bottom.html-]+} + +<!-- maintemplate.html end --> +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/templates/top.html b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/top.html new file mode 100644 index 0000000000..7950a4b040 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/templates/top.html @@ -0,0 +1,11 @@ +<!-- top.html start --> +<table border=1> + <tr> + <td> +Embedding templates example:<br> +<b>TOP template</b><br> +DateTime in format "MM/DD hh:mm:ss": <b>{+DATETIME [-FORMAT=MM/DD hh:mm:ss-]+}</b> + </td> + </tr> +</table> +<!-- top.html end -->
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.lfm b/packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.lfm new file mode 100644 index 0000000000..d985759d31 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.lfm @@ -0,0 +1,15 @@ +object FPWebModule1: TFPWebModule1 + OldCreateOrder = False + Actions = < + item + Name = 'func1call' + Default = True + OnRequest = func1callRequest + Template.AllowTagParams = False + end> + CreateSession = False + Height = 300 + HorizontalOffset = 210 + VerticalOffset = 204 + Width = 400 +end diff --git a/packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.pas b/packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.pas new file mode 100644 index 0000000000..61e7a85ff3 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/embedtemplates/webmodule/webmodule.pas @@ -0,0 +1,77 @@ +unit webmodule; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, httpdefs, fpHTTP, fpWeb, fpTemplate; + +type + + { TFPWebModule1 } + + TFPWebModule1 = class(TFPWebModule) + procedure func1callRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + private + { private declarations } + procedure func1callReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + function UseTemplate(TemplateFile:String; TagHandler:TReplaceTagEvent):String; + public + { public declarations } + end; + +var + FPWebModule1: TFPWebModule1; + +implementation + +{$R *.lfm} + +{ TFPWebModule1 } + +procedure TFPWebModule1.func1callRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +begin + //func1callReplaceTag is recursively processing the template tags for all + //embedded templates (INCLUDETEMPLATE tag defines a new template to embed) + AResponse.Content := UseTemplate('maintemplate', @func1callReplaceTag); + Handled := true; +end; + +function TFPWebModule1.UseTemplate(TemplateFile:String; TagHandler:TReplaceTagEvent):String; +var TMPTemplate:TFPTemplate; +begin + TMPTemplate := TFPTemplate.Create; + TMPTemplate.FileName := '/path/to/templates/' + TemplateFile + '.html'; + TMPTemplate.AllowTagParams := true; + TMPTemplate.StartDelimiter := '{+'; + TMPTemplate.EndDelimiter := '+}'; + TMPTemplate.OnReplaceTag := TagHandler; + Result := TMPTemplate.GetContent; + TMPTemplate.Free; +end; + +procedure TFPWebModule1.func1callReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +begin//HTML template tag handling for an html template file + if AnsiCompareText(TagString, 'DATETIME') = 0 then + begin + ReplaceText := FormatDateTime(TagParams.Values['FORMAT'], Now); + end else + + if AnsiCompareText(TagString, 'INCLUDETEMPLATE') = 0 then + begin + ReplaceText := UseTemplate(TagParams.Values['TEMPLATEFILE'], @func1callReplaceTag); + end else begin + +//Not found value for tag -> TagString + ReplaceText := 'Template tag {+' + TagString + '+} is not implemented yet.'; + end; +end; + +initialization + RegisterHTTPModule('TFPWebModule1', TFPWebModule1); +end. diff --git a/packages/fcl-web/examples/fptemplate/fileupload/README.txt b/packages/fcl-web/examples/fptemplate/fileupload/README.txt new file mode 100644 index 0000000000..9a4b7107cf --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/README.txt @@ -0,0 +1,149 @@ +File upload from html form, example +========================== +Demonstrates how to handle the file upload (multipart) html forms with +templates. + +Note, that the only difference between CGI/FCGI and Apache module is in the +main project .lpr file and the web server (Apache) configuration. + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule fileupload.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the chosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- +The application needs read access to the template file(s). +It is best to use full paths with the file names in the web module +(webmodule.pas), because Apache will probably look relative to the / (main +root) directory or main Apache directory and not relative to the application +file location. +ex: ModuleTemplate.FileName := '/full/path/to/templates/uploadform.html'; + +It needs read/write access to create the file database filelist.txt +ex: FileDB := '/full/path/to/templates/filelist.txt'; + +Also, it needs an "/upfiles" directory with read/write access where the files +will be uploaded to. +ex: UploadDir := '/full/path/to/upfiles/'; + + +2.a; as CGI +----------- +Usually it works if you put the template (uploadform.html) next to the CGI +executable file in the Apache cgi-bin directory. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/listfiles should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/fileuploader/listfiles +if in the Apache configuration file (ex: httpd.conf) it was set up as +ScriptAlias /fileuploader "<path_to_app>/<app_name>" +ex: +ScriptAlias /fileuploader "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/fileupload.exe" +(uploadform.html is copied next to fileupload.exe into cgi-bin, and cgi-bin +has a subdirectory called "upfiles") + +Note: You need to change the URLs or the Apache configuration if "fileuploader" + or "fileupload.exe" changes (for example on Linux it is not fileupload.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL: +http://127.0.0.1/fileuploader/listfiles + + +2.b; as Apache module +--------------------- +Usually it works if you put the template (uploadform.html) into the Apache +main directory (not the DocumentRoot, but the main Apache directory), under +sub-directory "templates" or something similar. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheLocationName>/listfiles should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/fileuploader/listfiles +or http://127.0.0.1/fileuploader/listfiles +if in httpd.conf it was set up as: +LoadModule mod_fileupload "<path_to_mod>/fileupload.dll" +<Location /fileuploader> + SetHandler mod_fileupload + Order allow,deny + Allow from all +</Location> + +Note: You need to change the URLs in the templates if "fileuploader" changes. +Also, for example on Linux the module can be libfileupload.so and not +fileupload.dll + +Note: If you recompile an apache module while the module itself is loaded into +the Apache server, the compilation might fail because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +server before you recompile or before you copy over the new version of the +newly created module. +On Linux, it is enough to simply reload Apache after recompile. + + +2.c; as FCGI +------------ +Usually it works if you put the template (uploadform.html) next to the FCGI +executable file. Adjust the file path in the web module (webmodule.pas) +accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/listfiles should start the example +if everything is set up properly. +ex: http://127.0.0.1:8080/fileuploader/func1call +or http://127.0.0.1/fileuploader/func1call +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> + Order allow,deny + Allow from all + </Directory> + FastCgiExternalServer "<path_to_fcgi_app>/fileupload.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush + ScriptAlias /fileuploader "<path_to_fcgi_app>/fileupload.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (fileupload.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpi b/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpi new file mode 100644 index 0000000000..e6c43b7eea --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="fileupload.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="fileupload"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpr b/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpr new file mode 100644 index 0000000000..ca4dab5357 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.lpr @@ -0,0 +1,37 @@ +Library fileupload; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, webmodule; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_fileupload'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. + diff --git a/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.res b/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/apache/fileupload.res diff --git a/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpi b/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpi new file mode 100644 index 0000000000..a4c99d62c1 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="fileupload.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="fileupload"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpr b/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpr new file mode 100644 index 0000000000..86c6823c5d --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.lpr @@ -0,0 +1,13 @@ +program fileupload; + +{$mode objfpc}{$H+} + +uses + fpCGI, webmodule; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.res b/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/cgi/fileupload.res diff --git a/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpi b/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpi new file mode 100644 index 0000000000..a4c99d62c1 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="fileupload.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="fileupload"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpr b/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpr new file mode 100644 index 0000000000..8ae499c85b --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.lpr @@ -0,0 +1,14 @@ +program fileupload; + +{$mode objfpc}{$H+} + +uses + fpFCGI, webmodule; + +{$R *.res} + +begin + Application.Port:=2015;//Port the FCGI application is listening on + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.res b/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/fcgi/fileupload.res diff --git a/packages/fcl-web/examples/fptemplate/fileupload/templates/uploadform.html b/packages/fcl-web/examples/fptemplate/fileupload/templates/uploadform.html new file mode 100644 index 0000000000..def98eebd4 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/templates/uploadform.html @@ -0,0 +1,67 @@ +<html> +<head> +<script type="text/javascript" language="JavaScript1.2"> + +function chkFields(){ + + var Error = false; + + if ( document.DataForm.uploaderperson.value == '') + { alert('Please enter an uploader person.'); } + else if ( (document.DataForm.file1.value == '') && (document.DataForm.file2.value == '') ) + { alert('Please select a file to upload.'); } + else + Error = true; + + return Error; +} + +</script> +</head> +<body> +File upload screen<br> +<small>Last refresh: {+DATETIME [-FORMAT=MM/DD/YYYY hh:mm:ss.zzz-]+}</small><br><br> + +{+MESSAGES [-TOOBIG=<font color="red">You have tried to upload a file that exceeds the size limit.</font>-] + [-NOTFOUND=<font color="red">File not found for delete.</font>-] ++} + +<br><br>Maximum allowed file size to be stored: {+MAX_SIZE+}MB<br> + + <form action="/fileuploader/listfiles" method="post" enctype="multipart/form-data" name="DataForm" onsubmit="return chkFields();"> + + <table> + <tr> + <td>Uploader:</td> + <td><input type="text" name="uploaderperson" value=""></td> + </tr> + <tr> + <td>File1:</td> + <td><input name="file1" type="file" size="60"></td> + </tr> + <tr> + <td>File2:</td> + <td><input name="file2" type="file" size="60"></td> + </tr> + <tr> + <td colspan=2 align="center"><input type="submit" value="Upload"></td> + </tr> + </table> + + </form><br><br> + +Uploaded File List (.../{+UPLOAD_DIR+}): + <table border=1> + <tr><th>File Name</th><th>Uploader</th></tr> +{+FILELIST + [-ONE_ROW= + <tr><td><pre>~FILENAME</pre></td><td>~UPLOADER</td><td><a href="/fileuploader/listfiles?delete=~DFILENAME">Delete</a></td></tr> + -] + [-NOTHINGTOLIST= + <tr><td colspan=3>No files to list</td></tr> + -] ++} + </table> + +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.lfm b/packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.lfm new file mode 100644 index 0000000000..c710382566 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.lfm @@ -0,0 +1,17 @@ +object FPWebModule1: TFPWebModule1 + OnCreate = DataModuleCreate + OldCreateOrder = False + Actions = < + item + Name = 'listfiles' + Default = True + OnRequest = listfilesRequest + Template.AllowTagParams = False + end> + AfterResponse = DataModuleAfterResponse + CreateSession = False + Height = 300 + HorizontalOffset = 290 + VerticalOffset = 149 + Width = 400 +end diff --git a/packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.pas b/packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.pas new file mode 100644 index 0000000000..1a24763e63 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/fileupload/webmodule/webmodule.pas @@ -0,0 +1,233 @@ +unit webmodule; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, httpdefs, fpHTTP, fpWeb; + +type + + { TFPWebModule1 } + + TFPWebModule1 = class(TFPWebModule) + procedure DataModuleAfterResponse(Sender: TObject; AResponse: TResponse); + procedure DataModuleCreate(Sender: TObject); + procedure listfilesRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + private + { private declarations } + UploadDir:String; + FileDB:String; + MaxSize:Integer; + procedure DeleteTheFile(const FN:String); + procedure HandleUploadedFiles; + procedure listfilesReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + public + { public declarations } + end; + +var + FPWebModule1: TFPWebModule1; + +implementation + +{$R *.lfm} + +{ TFPWebModule1 } + +//In real applications, CopyFile should be used from unit FileUtil of the LCL +function CopyTheFile(const SrcFilename, DestFilename: String): Boolean; +var SrcFS, DestFS: TFileStream; +begin + Result := False; + SrcFS := TFileStream.Create(SrcFilename, fmOpenRead or fmShareDenyWrite); + try + DestFS := TFileStream.Create(DestFilename, fmCreate); + try + DestFS.CopyFrom(SrcFS, SrcFS.Size); + finally + DestFS.Free; + end; + finally + SrcFS.Free; + end; + Result := True; +end; + +procedure TFPWebModule1.DataModuleAfterResponse(Sender: TObject; + AResponse: TResponse); +begin + //reset global variables for apache modules for the next incoming request + + // +end; + +procedure TFPWebModule1.DataModuleCreate(Sender: TObject); +begin + UploadDir := 'upfiles/'; + FileDB := 'filelist.txt'; + MaxSize := 2;//MB +end; + +procedure TFPWebModule1.DeleteTheFile(const FN:String); +var + FDB: TStringList; + s:String; +begin + FDB := TStringList.Create; + if FileExists(FileDB) then + FDB.LoadFromFile(FileDB); + + s := FDB.Values[FN]; + if s <> '' then + begin + FDB.Delete(FDB.IndexOfName(FN)); + FDB.SaveToFile(FileDB); + FDB.Free; + end else begin + FDB.Free; + Request.QueryFields.Add('_MSG=NOTFOUND');//NOTFOUND message will be displayed on the response page + Exit; + end; + + //delete the file + s := UploadDir + FN; + if FileExists(s) then + DeleteFile(s); +end; + +procedure TFPWebModule1.HandleUploadedFiles; +var + i:Integer; + all_ok:Boolean; + FDB: TStringList; + Uploader, FN:String; +begin + if Request.Files.Count <= 0 then Exit; + + //process the uploaded files if there was any + all_ok := true; + for i := 0 to Request.Files.Count - 1 do + begin//check sizes + if Request.Files[i].Size > (MaxSize * 1024 * 1024) then + begin//exceeds size limit + all_ok := false; + Request.QueryFields.Add('_MSG=TOOBIG');//TOOBIG message will be displayed on the response page + break; + end; + end; + + if all_ok then //copy the file(s) to the upload directory (the temporary files will be deleted automatically after the request is handled) + begin + Uploader := Request.ContentFields.Values['UPLOADERPERSON']; + if Uploader = '' then + Uploader := '-'; + FDB := TStringList.Create; + if FileExists(FileDB) then + FDB.LoadFromFile(FileDB); + for i := 0 to Request.Files.Count - 1 do + begin + FN := Request.Files[i].FileName; + if (FN <> '')and(Request.Files[i].Size > 0) then + begin + CopyTheFile(Request.Files[i].LocalFileName, UploadDir + FN);//copy (or overwrite) the file to the upload dir + if FDB.Values[FN] <> '' then + FDB.Values[FN] := Uploader //overwrite the previous uploader + else + FDB.Add(FN + '=' + Uploader); //store the file and the uploader into the file database + end; + end; + FDB.SaveToFile(FileDB); + FDB.Free; + end; +end; + +procedure TFPWebModule1.listfilesRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +var + FN:String; +begin + //ModuleTemplate is a web module global property + //To use the Template propery of the current web action (which is visible in + //the object inspector for every Action), use + //(Sender as TFPWebAction).Template.FileName := 'mytemplate1.html'; and so on. + ModuleTemplate.FileName := 'uploadform.html'; + ModuleTemplate.AllowTagParams := true; + ModuleTemplate.StartDelimiter := '{+'; + ModuleTemplate.EndDelimiter := '+}'; + ModuleTemplate.OnReplaceTag := @listfilesReplaceTag; + + FN := ARequest.QueryFields.Values['DELETE']; + if FN <> '' then + DeleteTheFile(FN) + else + HandleUploadedFiles; + + AResponse.Content := ModuleTemplate.GetContent;//Generate the response page using the template + + Handled := true; +end; + +procedure TFPWebModule1.listfilesReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +var + SL:TStringList; + i:Integer; + FileName, Uploader, One_Row:String; +begin + if AnsiCompareText(TagString, 'DATETIME') = 0 then + begin + ReplaceText := FormatDateTime(TagParams.Values['FORMAT'], Now); + end else + + if AnsiCompareText(TagString, 'MAX_SIZE') = 0 then + begin + ReplaceText := IntToStr(MaxSize); + end else + + if AnsiCompareText(TagString, 'UPLOAD_DIR') = 0 then + begin + ReplaceText := UploadDir; + end else + + if AnsiCompareText(TagString, 'MESSAGES') = 0 then + begin + ReplaceText := TagParams.Values[Request.QueryFields.Values['_MSG']]; + end else + + if AnsiCompareText(TagString, 'FILELIST') = 0 then + begin + SL := TStringList.Create; + if FileExists(FileDB) then + SL.LoadFromFile(FileDB); + if SL.Count > 0 then + begin + One_Row := TagParams.Values['ONE_ROW']; + for i := 0 to SL.Count - 1 do + begin + FileName := SL.Names[i]; + Uploader := SL.Values[FileName]; + if (FileName <> '')and(Uploader <> '') then + ReplaceText := ReplaceText + StringReplace(StringReplace(StringReplace(One_Row + ,'~FILENAME', FileName, []) + ,'~UPLOADER', Uploader, []) + ,'~DFILENAME', HTTPEncode(FileName), []) + #13#10; + end; + end else begin + ReplaceText := TagParams.Values['NOTHINGTOLIST']; + end; + SL.Free; + end else + + {Message for tags not handled} + begin + ReplaceText := '[Template tag {+' + TagString + '+} is not implemented yet.]'; + end; +end; + +initialization + RegisterHTTPModule('TFPWebModule1', TFPWebModule1); +end. diff --git a/packages/fcl-web/examples/fptemplate/listrecords/README.txt b/packages/fcl-web/examples/fptemplate/listrecords/README.txt new file mode 100644 index 0000000000..f63d411aa4 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/README.txt @@ -0,0 +1,141 @@ +List records using template tags, example +================================ +Demonstrates how to list multiple records using templates and template tags. +Note, that the only difference between CGI/FCGI and Apache module is in the +main project .lpr file and the web server (Apache) configuration. + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule listrecords.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the chosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- +The application needs read access to the template file(s). +It is best to use full paths with the file names in the web module +(webmodule.pas), because Apache will probably look relative to the / (main +root) directory or main Apache directory and not relative to the application +file location. +ex: ModuleTemplate.FileName := '/full/path/to/template/mytemplate3.html'; + +2.a; as CGI +----------- +Usually it works if you put the template (mytemplate3.html) next to the CGI +executable file in the Apache cgi-bin directory. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/cgi-bin/<CGIExecutableName>/func1call should start the +example if everything is set up properly, and the executable is copied into +the Apache cgi-bin directory with the template file. +ex: http://127.0.0.1:8080/cgi-bin/listrecords.exe/func1call + +If the calling URL looks too long, or you want to hide it a little bit more, +you can use a ScriptAlias in the Apache configuration file to make it shorter. +ex: ScriptAlias /mycgi "<path_to_cgi_app>/listrecords.exe" in your conf +file will make http://127.0.0.1:8080/mycgi/func1call work the same way. + +Note: You need to change the URLs if "cgi-bin" or "listrecords.exe" +changes (for example on Linux it is not listrecords.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL. + + +2.b; as Apache module +--------------------- +Usually it works if you put the template (mytemplate3.html) into the Apache +main directory (not the DocumentRoot, but the main Apache directory), under +sub-directory "templates" or something similar. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheLocationName>/func1call should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/myapache/func1call +or http://127.0.0.1/myapache/func1call +if in httpd.conf it was set up as: +LoadModule mod_listrecords "<path_to_mod>/listrecords.dll" +<Location /myapache> + SetHandler mod_listrecords + Order allow,deny + Allow from all +</Location> + +Note: You need to change the URLs in the templates if "myapache" changes. +Also, for example on Linux the module can be liblistrecords.so and not +listrecords.dll + +Note: If you recompile an apache module while the module itself is loaded into +the Apache server, the compilation might fail because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +server before you recompile or before you copy over the new version of the +newly created module. +On Linux, it is enough to simply reload Apache after recompile. + + +2.c; as FCGI +------------ +Usually it works if you put the template (mytemplate3.html) next to the FCGI +executable file. Adjust the file path in the web module (webmodule.pas) +accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/func1call should start the example +if everything is set up properly. +ex: http://127.0.0.1:8080/myfcgi/func1call +or http://127.0.0.1/myfcgi/func1call +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#External FCGI app, has to start manually, Apache will not do it + FastCgiExternalServer "<path_to_fcgi_app>/listrecords.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush +#optionally, to shorten the calling URL and to not display the executable file name (if used, no +ExecCGI is needed above) + ScriptAlias /myfcgi "<path_to_fcgi_app>/listrecords.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (listrecords.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpi b/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpi new file mode 100644 index 0000000000..46198968f1 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="listrecords.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="listrecords"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpr b/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpr new file mode 100644 index 0000000000..76bc2ab489 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.lpr @@ -0,0 +1,37 @@ +Library mod_listrecords; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, webmodule; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_listrecords'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. + diff --git a/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.res b/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/apache/listrecords.res diff --git a/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpi b/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpi new file mode 100644 index 0000000000..57fc96f970 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="listrecords.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="listrecords"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpr b/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpr new file mode 100644 index 0000000000..b0209598c7 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.lpr @@ -0,0 +1,13 @@ +program listrecords; + +{$mode objfpc}{$H+} + +uses + fpCGI, webmodule; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.res b/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/cgi/listrecords.res diff --git a/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpi b/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpi new file mode 100644 index 0000000000..57fc96f970 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="listrecords.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="listrecords"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpr b/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpr new file mode 100644 index 0000000000..c38d1c2f46 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.lpr @@ -0,0 +1,14 @@ +program listrecords; + +{$mode objfpc}{$H+} + +uses + fpFCGI, webmodule; + +{$R *.res} + +begin + Application.Port:=2015;//Port the FCGI application is listening on + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.res b/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/fcgi/listrecords.res diff --git a/packages/fcl-web/examples/fptemplate/listrecords/templates/mytemplate3.html b/packages/fcl-web/examples/fptemplate/listrecords/templates/mytemplate3.html new file mode 100644 index 0000000000..fb6800abbc --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/templates/mytemplate3.html @@ -0,0 +1,38 @@ +<html> +<body> +DateTime in format "MM/DD hh:mm:ss": <b>{+DATETIME [-FORMAT=MM/DD hh:mm:ss-]+}</b> + +<br> + +List of records: +<table class="beautify1"> + <tr class="beautify2"> + <td class="beautify3"> + + {+REPORTRESULT + [-HEADER= + <table bordercolorlight="#6699CC" bordercolordark="#E1E1E1" class="Label"> + <tr class="Label" align=center bgcolor="#6699CC"> + <th><font color="white">~Column1</font></th> + <th><font color="white">~Column2</font></th> + </tr> + -] + [- ONEROW = + <tr bgcolor="#F2F2F2" class="Label3" align="center"> + <td>~Column1Value</td><td>~Column2value</td> + </tr> + -] +. +.snip, and so on more parameters if needed +. + [- NOTFOUND= + <tr class="Error"><td>There are no entries found.</td></tr> + -] + [-FOOTER= </table>-] + +} + + </td> + </tr> +</table> +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.lfm b/packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.lfm new file mode 100644 index 0000000000..f8588e362b --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.lfm @@ -0,0 +1,15 @@ +object FPWebModule1: TFPWebModule1 + OldCreateOrder = False + Actions = < + item + Name = 'func1call' + Default = True + OnRequest = func1callRequest + Template.AllowTagParams = False + end> + CreateSession = False + Height = 300 + HorizontalOffset = 290 + VerticalOffset = 149 + Width = 400 +end diff --git a/packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.pas b/packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.pas new file mode 100644 index 0000000000..a8dc8b06f1 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/listrecords/webmodule/webmodule.pas @@ -0,0 +1,125 @@ +unit webmodule; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, httpdefs, fpHTTP, fpWeb; + +type + + { TFPWebModule1 } + + TFPWebModule1 = class(TFPWebModule) + procedure func1callRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + private + { private declarations } + procedure func1callReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + public + { public declarations } + end; + +var + FPWebModule1: TFPWebModule1; + +implementation + +{$R *.lfm} + +{ TFPWebModule1 } + +procedure TFPWebModule1.func1callRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +begin + //ModuleTemplate is a web module global property + //To use the Template propery of the current web action (which is visible in + //the object inspector for every Action), use + //(Sender as TFPWebAction).Template.FileName := 'mytemplate1.html'; and so on. + ModuleTemplate.FileName := 'mytemplate3.html';{template file with the template tag -> REPORTRESULT} + ModuleTemplate.AllowTagParams := true; + ModuleTemplate.StartDelimiter := '{+'; + ModuleTemplate.EndDelimiter := '+}'; + ModuleTemplate.OnReplaceTag := @func1callReplaceTag; + + AResponse.Content := ModuleTemplate.GetContent; + + Handled := true; +end; + +procedure TFPWebModule1.func1callReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +var + header, footer, onerow:String; + NoRecordsToShow:Boolean; + ColumnHeaders:array[1..2] of String; + ColumnValues:array[1..3,1..2]of String; + I:Integer; +begin//HTML template tag handling for an html template file + + if AnsiCompareText(TagString, 'DATETIME') = 0 then + begin + ReplaceText := FormatDateTime(TagParams.Values['FORMAT'], Now); + end else + + //Replace the REPORTRESULT html tag using it's tag parameters + if AnsiCompareText(TagString, 'REPORTRESULT') = 0 then + begin + //fill up some arrays with data (could come from a SQL query) + NoRecordsToShow := false; + + ColumnHeaders[1] := 'Amount'; + ColumnHeaders[2] := 'Percentage'; + + ColumnValues[1,1] := '10.00'; + ColumnValues[1,2] := '5'; + + ColumnValues[2,1] := '15.00'; + ColumnValues[2,2] := '4'; + + ColumnValues[3,1] := '20.00'; + ColumnValues[3,2] := '3'; + + //NoRecordsToShow could be something like SQL1.IsEmpty , etc. + if NoRecordsToShow then + begin //if there's nothing to list, just replace the whole tag with the + //"Not Found" message that the template contains + ReplaceText := TagParams.Values['NOTFOUND']; + Exit; + end; + + header := TagParams.Values['HEADER']; + //insert header parameters + header := StringReplace(header, '~Column1', ColumnHeaders[1], []); + header := StringReplace(header, '~Column2', ColumnHeaders[2], []); + + ReplaceText := header;//done with the header (could have been looping + //through table field names also) + //insert the rows + onerow := TagParams.Values['ONEROW'];//template for 1 row + //loop through the rows, it could be someting like "while not SQL1.EOF do" + for I := 1 to 3 do + begin + ReplaceText := ReplaceText + StringReplace(StringReplace(onerow + ,'~Column1Value', '$' + ColumnValues[I, 1], []) + ,'~Column2value', ColumnValues[I, 2] + '%', []) + #13#10; + end; + + //insert the footer + footer := TagParams.Values['FOOTER']; + //replace footer parameters if needed + //... + + ReplaceText := ReplaceText + footer; + end else begin + +//Not found value for tag -> TagString + ReplaceText := 'Template tag {+' + TagString + '+} is not implemented yet.'; + end; +end; + +initialization + RegisterHTTPModule('TFPWebModule1', TFPWebModule1); +end. diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/README.txt b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/README.txt new file mode 100644 index 0000000000..22eb9b8d0b --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/README.txt @@ -0,0 +1,145 @@ +Sessions stored in cookies, Autosession example +========================== + +Every visitor automatically gets a session ID (no login required) passed in a +cookie to the web visitor's browser and stored on the web server until it +expires. +This way, for example the previously entered data can be carried forward to +the following pages. + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule autosession.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the chosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- +The application needs read access to the template (autosession-template.html) +file. It is best to use full paths with the file names in the web module +(webmodule.pas), because Apache will probably look relative to the / (main +root) directory or main Apache directory and not relative to the application +file location. +ex: ModuleTemplate.FileName := '/full/path/to/autosession-template.html'; + +The fpweb generated cookie session files usually need to be deleted after +expiration manually or by a periodic cleaning program, because they are piling +up in the default temporary directory if the session is not terminated with a +Session.Terminate; somewhere within the web module after the sessions is no +longer used (ex: after the last submit of a multi-page data entry form, etc.). + + +2.a; as CGI +----------- +Usually it works if you put the template (autosession-template.html) next to +the CGI executable file in the Apache cgi-bin directory. Adjust the file path +in the web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/gotonextpage should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/autosession/gotonextpage +if in the Apache configuration file (ex: httpd.conf) it was set up as +ScriptAlias /autosession "<path_to_app>/<app_name>" +ex: +ScriptAlias /autosession "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/autosession.exe" + +Note: You need to change the URLs if "cgi-bin" or "autosession.exe" changes +(for example on Linux it is not autosession.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL. + + +2.b; as Apache module +--------------------- +Usually it works if you put the template (autosession-template.html) into the +Apache main directory (not the DocumentRoot, but the main Apache directory), +under sub-directory "templates" or something similar. Adjust the file path in +the web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheLocationName>/gotonextpage should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/autosession/gotonextpage +if in httpd.conf it was set up as: +LoadModule mod_autosession "<path_to_mod>/autosession.dll" +<Location /autosession> + SetHandler mod_autosession + Order allow,deny + Allow from all +</Location> + +Note: You need to change the URLs in the templates if "/autosession" +changes. Also, for example on Linux the module can be libautosession.so and +not autosession.dll + +Note: If you recompile an apache module while the module itself is loaded into +the Apache server, the compilation might fail because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +server before you recompile or before you copy over the new version of the +newly created module. +On Linux, it is enough to simply reload Apache after recompile. + + +2.c; as FCGI +------------ +Usually it works if you put the template (autosession-template.html) next to +the FCGI executable file. Adjust the file path in the web module +(webmodule.pas) accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/gotonextpage should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/autosession/gotonextpage +or http://127.0.0.1/autosession/gotonextpage +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> + Order allow,deny + Allow from all + </Directory> + FastCgiExternalServer "<path_to_fcgi_app>/autosession.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush + ScriptAlias /autosession "<path_to_fcgi_app>/autosession.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (autosession.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpi b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpi new file mode 100644 index 0000000000..6f8d5e91fd --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="autosession.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="autosession"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpr b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpr new file mode 100644 index 0000000000..04faa86d66 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.lpr @@ -0,0 +1,37 @@ +Library autosession; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, webmodule; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_autosession'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. + diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.res b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/apache/autosession.res diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpi b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpi new file mode 100644 index 0000000000..4c866def8d --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="autosession.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="autosession"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpr b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpr new file mode 100644 index 0000000000..3490215501 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.lpr @@ -0,0 +1,14 @@ +program autosession; + +{$mode objfpc}{$H+} + +uses + fpCGI, webmodule; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end. + diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.res b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/cgi/autosession.res diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpi b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpi new file mode 100644 index 0000000000..4c866def8d --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="autosession.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="autosession"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpr b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpr new file mode 100644 index 0000000000..a5c2f3b62d --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.lpr @@ -0,0 +1,14 @@ +program autosession; + +{$mode objfpc}{$H+} + +uses + fpFCGI, webmodule; + +{$R *.res} + +begin + Application.Port:=2015;//Port the FCGI application is listening on + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.res b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/fcgi/autosession.res diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/templates/autosession-template.html b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/templates/autosession-template.html new file mode 100644 index 0000000000..f29df16a11 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/templates/autosession-template.html @@ -0,0 +1,25 @@ +<html> +<body> +You can test automatic session handling by opening multiple browsers +(not multiple tabs or multiple windows of the same browser! Ex: Firefox and +Internet Explorer), or by using two separate computers.<br> +By submitting data from the different browsers you can see the session information.<br> +Note: Cookies must be enabled for this website for it to work. + +<br><br>Last submit: <b>{+DATETIME [-FORMAT=MM/DD/YYYY hh:mm:ss.zzz-]+}</b><br><br> + +<form action="/autosession/gotonextpage" method="Post"> + <input type="submit" class="button" value="Submit"> +</form> + +{+EXPIREDMESSAGE [-MESSAGE=Your session has expired.-]+}<br> +{+NEWSESSIONMESSAGE [-MESSAGE=A new session started.-]+}<br> + +<br>Your session ID is: <b>{+SESSIONID+}</b><br> + +Expires in <b>{+TIMEOUTMINUTES+}</b> minutes unless it is updated.<br> + +The file "<b>{+SESSIONFILE+}</b>" stores this session information on the web server.<br> + +</body> +</html> diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.lfm b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.lfm new file mode 100644 index 0000000000..0265a437e5 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.lfm @@ -0,0 +1,19 @@ +object FPWebModule1: TFPWebModule1 + OnCreate = DataModuleCreate + OldCreateOrder = False + Actions = < + item + Name = 'gotonextpage' + Default = True + OnRequest = gotonextpageRequest + Template.AllowTagParams = False + end> + AfterResponse = DataModuleAfterResponse + CreateSession = False + OnNewSession = DataModuleNewSession + OnSessionExpired = DataModuleSessionExpired + Height = 300 + HorizontalOffset = 290 + VerticalOffset = 149 + Width = 400 +end diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.pas b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.pas new file mode 100644 index 0000000000..0db433661a --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-auto/webmodule/webmodule.pas @@ -0,0 +1,148 @@ +unit webmodule; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, Sysutils, HTTPDefs, fpHTTP, fpWeb, iniwebsession; + +type + + { TFPWebModule1 } + + TFPWebModule1 = class(TFPWebModule) + procedure DataModuleCreate(Sender: TObject); + procedure DataModuleNewSession(Sender: TObject); + procedure DataModuleSessionExpired(Sender: TObject); + procedure gotonextpageRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + procedure DataModuleAfterResponse(Sender: TObject; AResponse: TResponse); + private + { private declarations } + NewSessionCreated : Boolean; + ASessionExpired : Boolean; + MySessionDir : String; +// procedure GetSessionEvent(Var ASession : TCustomSession); + procedure AutoSessionTemplateReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + public + { public declarations } + end; + +var + FPWebModule1: TFPWebModule1; + +implementation + +{$R *.lfm} + +{ TFPWebModule1 } + +procedure TFPWebModule1.DataModuleCreate(Sender: TObject); +begin + NewSessionCreated := false; + ASessionExpired := false; + ModuleTemplate.AllowTagParams := true; + ModuleTemplate.StartDelimiter := '{+';//The default is { and } which is usually not good if we use Javascript in our templates + ModuleTemplate.EndDelimiter := '+}'; + + CreateSession := true; //Turn on automatic session handling for this web module + MySessionDir := '';//'/Path/To/A/Directory/';{Use this if you don't want the automatic Temp dir to store the sessionID files under "fpwebsessions" sub-directory} + with (SessionFactory as TIniSessionFactory) do + begin + DefaultTimeoutMinutes := 2; //Session timeout in minutes + SessionDir := MySessionDir; +// SessionCookie:='ACustomCookieName'; {Use this to set the cookie name that will be used for the session management. Default is 'FPWebSession'} + end; +end; + +procedure TFPWebModule1.DataModuleNewSession(Sender: TObject); +begin {Sender as TIniWebSession} + NewSessionCreated := true; +end; + +procedure TFPWebModule1.DataModuleSessionExpired(Sender: TObject); +begin {Sender as TIniWebSession} + ASessionExpired := true; +end; + +procedure TFPWebModule1.gotonextpageRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +begin //ModuleTemplate:TFPTemplate is a property of the web module + ModuleTemplate.FileName := 'autosession-template.html'; + ModuleTemplate.OnReplaceTag := @AutoSessionTemplateReplaceTag; + + AResponse.Content := ModuleTemplate.GetContent; + + Handled := true; +end; + +procedure TFPWebModule1.AutoSessionTemplateReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +begin + if AnsiCompareText(TagString, 'DATETIME') = 0 then + begin + ReplaceText := FormatDateTime(TagParams.Values['FORMAT'], Now); + end else + + if AnsiCompareText(TagString, 'SESSIONID') = 0 then + begin + if Assigned(Session) then + ReplaceText := Session.SessionID; + end else + + if AnsiCompareText(TagString, 'TIMEOUTMINUTES') = 0 then + begin + if Assigned(Session) then + ReplaceText := IntToStr(Session.TimeOutMinutes); + end else + + if AnsiCompareText(TagString, 'SESSIONFILE') = 0 then + begin + if Assigned(Session) then + if MySessionDir = '' then + ReplaceText := IncludeTrailingPathDelimiter(GetTempDir(True)) + IncludeTrailingPathDelimiter('fpwebsessions') + Session.SessionID + else + ReplaceText := IncludeTrailingPathDelimiter(MySessionDir) + Session.SessionID; +{NOTE: GetTempDir +used by the session manager returns the OS temporary directory if possible, or from the +environment variable TEMP . For CGI programs you need to pass global environment +variables, it is not automatic. For example in the Apache httpd.conf with a +"PassEnv TEMP" or "SetEnv TEMP /pathtotmpdir" line so the web server passes this +global environment variable to the CGI programs' local environment variables. +} + end else + + if AnsiCompareText(TagString, 'EXPIREDMESSAGE') = 0 then + begin + if Assigned(Session) and ASessionExpired then + ReplaceText := TagParams.Values['MESSAGE']; + end else + + if AnsiCompareText(TagString, 'NEWSESSIONMESSAGE') = 0 then + begin + if Assigned(Session) and NewSessionCreated then + ReplaceText := TagParams.Values['MESSAGE']; + end else + + + begin + //Not found value for tag -> TagString + ReplaceText := '[Template tag {+' + TagString + '+} is not implemented yet.]'; + end; +end; + +procedure TFPWebModule1.DataModuleAfterResponse(Sender: TObject; + AResponse: TResponse); +begin + //reset global variables for apache modules and FCGI applications for the next incoming request + NewSessionCreated := false; + ASessionExpired := false; + ModuleTemplate.FileName := ''; + // +end; + +initialization + RegisterHTTPModule('TFPWebModule1', TFPWebModule1); +end. diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/README.txt b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/README.txt new file mode 100644 index 0000000000..be51985ef4 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/README.txt @@ -0,0 +1,164 @@ +Sessions stored in cookies with Login, example +====================================== + +Note: Cookies must be enabled for the website in the visitor's browser for it +to work. + +Every visitor needs to log in (using userdb.txt for the user names and +passwords in the example) to get a session ID that is passed in a cookie to +the web visitor's browser and stored on the web server until it expires. +This way fully functional web sites can be built without mixing the different +visitor's screens. + +Note: This example can not distinguish between sessions on the same computer, same +browser but different tabs. If for example someone opens three tabs and logs in +with all of them, all three browser tabs will be the same session. +In order to handle sessions differently by browser tabs the best way to go is +to store session IDs in the URLs, Links, etc. for all pages the web application + generates (this way cookies are not needed to maintain the session). +The sample user logins are stored in userdb.txt . + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule cookiesession.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the chosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- +The application needs read access to the template (test*.html) files. +It is best to use full paths with the file names in the web module +(webmodule.pas), because Apache will probably look relative to the / (main +root) directory or main Apache directory and not relative to the application +file location. +ex: ModuleTemplate.FileName := '/full/path/to/templates/testlogin.html'; +and so on for all the other templates. + +The web server application needs read/write access to the file where the session + information will be stored with the login names (sessiondb.txt by default). +ex: sessiondbfile := '/full/path/to/sessiondb.txt'; +The sessiondb.txt can be created empty, and needs read/write access. + +It also needs read access to the user database (userdb.txt) +ex: userdbfile := '/full/path/to/userdb.txt'; + +The fpweb generated cookie session files usually need to be deleted after +expiration manually or by a periodic cleaning program, because they are piling +up in the default temporary directory if the sessions are not terminated (ie. +if people are not logging out). + + +2.a; as CGI +----------- +Usually it works if you put the templates (test*.html) next to the CGI +executable file in the Apache cgi-bin directory. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/login should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/cookiesession/login +if in the Apache configuration file (ex: httpd.conf) it was set up as +ScriptAlias /cookiesession "<path_to_app>/<app_name>" +ex: +ScriptAlias /cookiesession "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/cookiesession.exe" + +Note: You need to change the URLs if "cgi-bin" or "cookiesession.exe" changes +(for example on Linux it is not cookiesession.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL. + + +2.b; as Apache module +--------------------- +Usually it works if you put the templates (test*.html) into the Apache +main directory (not the DocumentRoot, but the main Apache directory), under +sub-directory "templates" or something similar. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheLocationName>/login should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/cookiesession/login +if in httpd.conf it was set up as: +LoadModule mod_cookiesession "<path_to_mod>/cookiesession.dll" +<Location /cookiesession> + SetHandler mod_cookiesession + Order allow,deny + Allow from all +</Location> + +Note: You need to change the URLs in the templates if "/cookiesession" changes. +Also, for example on Linux the module can be libcookiesession.so and not +cookiesession.dll + +Note: If you recompile an apache module while the module itself is loaded into +the Apache server, the compilation might fail because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +server before you recompile or before you copy over the new version of the +newly created module. +On Linux, it is enough to simply reload Apache after recompile. + + +2.c; as FCGI +------------ +Usually it works if you put the templates (test*.html) next to the FCGI +executable file. Adjust the file path in the web module (webmodule.pas) +accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/gotonextpage should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/cookiesession/login +or http://127.0.0.1/cookiesession/login +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> + Order allow,deny + Allow from all + </Directory> + FastCgiExternalServer "<path_to_fcgi_app>/cookiesession.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush + ScriptAlias /cookiesession "<path_to_fcgi_app>/cookiesession.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (cookiesession.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpi b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpi new file mode 100644 index 0000000000..c882c922ee --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="cookiesession.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="cookiesession"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpr b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpr new file mode 100644 index 0000000000..07eeb6fe3e --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.lpr @@ -0,0 +1,37 @@ +Library cookiesession; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, webmodule; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_cookiesession'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. + diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.res b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/apache/cookiesession.res diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpi b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpi new file mode 100644 index 0000000000..629cffc10d --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="cookiesession.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="cookiesession"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpr b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpr new file mode 100644 index 0000000000..cad024c8b5 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.lpr @@ -0,0 +1,14 @@ +program cookiesession; + +{$mode objfpc}{$H+} + +uses + fpCGI, webmodule; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end. + diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.res b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/cgi/cookiesession.res diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpi b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpi new file mode 100644 index 0000000000..629cffc10d --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="cookiesession.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="cookiesession"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpr b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpr new file mode 100644 index 0000000000..0ff8d826ce --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.lpr @@ -0,0 +1,14 @@ +program cookiesession; + +{$mode objfpc}{$H+} + +uses + fpFCGI, webmodule; + +{$R *.res} + +begin + Application.Port:=2015;//Port the FCGI application is listening on + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.res b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/fcgi/cookiesession.res diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogin.html b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogin.html new file mode 100644 index 0000000000..a0d1c7d948 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogin.html @@ -0,0 +1,22 @@ +<html> +<body> + + {+MESSAGE + [-NORMAL =Welcome to the cookiesession test login screen-] + [-MISSING =<font color="red"><small>Please enter both a login name and a password.</small></font>-] + [-INVLOGIN=<font color="red"><small>Invalid login name or password. Please try again.</small></font>-] + [-SESSIONEXPIRED=<font color="orange"><small>Your session has expired. Please log in again</small></font>-] + +} + <br> + <form action="/cookiesession/login" method="Post"> + + Login Name:<input type="text" name="LoginName" value="{+LOGINNAME+}"> + + Password:<input type="password" name="Password"> + + <input type="submit" class="button" value="Login"> + + </form> + +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogout.html b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogout.html new file mode 100644 index 0000000000..21c0a16cdc --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testlogout.html @@ -0,0 +1,10 @@ +<html> +<body> +Logout screen<br><br> + +You have successfully logged out <b>{+LOGINNAME+}</b> .<br><br> + +You can log in again <a href="/cookiesession/login">here</a><br><br> + +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testsomepage.html b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testsomepage.html new file mode 100644 index 0000000000..481dcdc80b --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testsomepage.html @@ -0,0 +1,15 @@ +<html> +<body> +Somepage screen +<br><br>Entered this screen at <b>{+DATETIME [-FORMAT=MM/DD/YYYY hh:mm:ss.zzz-]+}</b><br><br> + +<b>{+LOGINNAME+}</b>, you can log out <a href="/cookiesession/logout">here</a><br><br> + +Your session will expire in <b>{+MINUTESLEFT+}</b> minutes unless it is refreshed by<br> +clicking <a href="/cookiesession/someaction">here</a> before then<br><br> + +Your session ID is: <b>{+SESSIONID+}</b><br> + +The file "<b>{+SESSIONFILE+}</b>" stores this session information on the web server.<br> +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testwelcome.html b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testwelcome.html new file mode 100644 index 0000000000..a6afafd7d0 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/testwelcome.html @@ -0,0 +1,17 @@ +<html> +<body> +Welcome screen +<br><br>Entered this screen at <b>{+DATETIME [-FORMAT=MM/DD/YYYY hh:mm:ss.zzz-]+}</b><br><br> + +You have successfully logged in <b>{+LOGINNAME+}</b> .<br><br> + +You can log out <a href="/cookiesession/logout">here</a><br><br> + +Your session will expire in <b>{+MINUTESLEFT+}</b> minutes unless it is refreshed by<br> +clicking <a href="/cookiesession/someaction">here</a> before then<br><br> + +Your session ID is: <b>{+SESSIONID+}</b><br> + +The file "<b>{+SESSIONFILE+}</b>" stores this session information on the web server.<br> +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/userdb.txt b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/userdb.txt new file mode 100644 index 0000000000..5e21473d29 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/templates/userdb.txt @@ -0,0 +1,2 @@ +joe=joepassword +jane=janepassword diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.lfm b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.lfm new file mode 100644 index 0000000000..a0f540812f --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.lfm @@ -0,0 +1,29 @@ +object FPWebModule1: TFPWebModule1 + OnCreate = DataModuleCreate + OldCreateOrder = False + Actions = < + item + Name = 'login' + Default = True + OnRequest = loginRequest + Template.AllowTagParams = False + end + item + Name = 'logout' + Default = False + OnRequest = logoutRequest + Template.AllowTagParams = False + end + item + Name = 'someaction' + Default = False + OnRequest = someactionRequest + Template.AllowTagParams = False + end> + AfterResponse = DataModuleAfterResponse + CreateSession = True + Height = 202 + HorizontalOffset = 207 + VerticalOffset = 166 + Width = 173 +end diff --git a/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.pas b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.pas new file mode 100644 index 0000000000..3f1e7a42d1 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/cookiesessions-login/webmodule/webmodule.pas @@ -0,0 +1,381 @@ +unit webmodule; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, httpdefs, fpHTTP, fpWeb, iniwebsession; + +type + + { TFPWebModule1 } + + TFPWebModule1 = class(TFPWebModule) + procedure DataModuleAfterResponse(Sender: TObject; AResponse: TResponse); + procedure DataModuleCreate(Sender: TObject); + //web action handlers + procedure loginRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); + procedure logoutRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); + procedure someactionRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); + private + { private declarations } + MySessionDir : String; + LoggedInLoginName : String; + SessionDBFile : String; + UserDBFile : String; + function NotLoggedIn:Boolean; + function CommonTemplateTagReplaces(const TagString:String; TagParams: TStringList; out ReplaceText: String):Boolean; + //template tag handlers + procedure loginReplaceTag(Sender: TObject; const TagString: String; TagParams: TStringList; Out ReplaceText: String); + procedure welcomeReplaceTag(Sender: TObject; const TagString:String; TagParams: TStringList; Out ReplaceText: String); + procedure logoutReplaceTag(Sender: TObject; const TagString:String; TagParams: TStringList; Out ReplaceText: String); + procedure someactionReplaceTag(Sender: TObject; const TagString:String; TagParams: TStringList; Out ReplaceText: String); + public + { public declarations } + end; + +var + FPWebModule1: TFPWebModule1; + +implementation + +{$R *.lfm} + +{ TFPWebModule1 } + +function FindNameInList(const SL:TStrings; const N:String):String; +var + i : Integer; +begin + Result := ''; + for i := 0 to SL.Count - 1 do + if SL.Names[i] = N then + begin + Result := SL.Values[SL.Names[i]];//return with the sessionID + break; + end; +end; + +procedure RemoveValueIfExists(SL:TStrings; const S_ID:String); +var + s : String; + i : Integer; +begin + if SL.Count <= 0 then Exit; + s := '=' + S_ID; + i := 0; + repeat + if pos(s, SL[i]) > 0 then + SL.Delete(i) + else + inc(i); + until i >= SL.Count; +end; + +function FindValueInList(const SL:TStrings; const Sess:String):String; +var + s : String; + i : Integer; +begin + Result := ''; + if SL.Count <= 0 then Exit; + s := '=' + Sess; + i := 0; + repeat + if pos(s, SL[i]) > 0 then + begin + Result := SL.Names[i]; + break; + end; + inc(i); + until i >= SL.Count; +end; + +procedure RemoveNameIfExists(SL:TStrings; const N:String); +var + i: Integer; +begin + if SL.Count <= 0 then Exit; + i := 0; + repeat + if SL.Names[i] = N then + SL.Delete(i) + else + inc(i); + until i >= SL.Count; +end; + +procedure TFPWebModule1.DataModuleAfterResponse(Sender: TObject; + AResponse: TResponse); +begin + //reset global variables for apache modules and fcgi applications for the next incoming request + LoggedInLoginName := ''; + // +end; + +procedure TFPWebModule1.DataModuleCreate(Sender: TObject); +begin + ModuleTemplate.AllowTagParams := true; + ModuleTemplate.StartDelimiter := '{+'; //The default is { and } which is usually not good if we use Javascript in our templates + ModuleTemplate.EndDelimiter := '+}'; + + CreateSession := true; //Turn on automatic session handling for this web module + MySessionDir := '';//'/Path/To/A/Directory/';{Use this if you don't want the automatic Temp dir to store the sessionID files under "fpwebsessions" sub-directory} + with (SessionFactory as TIniSessionFactory) do + begin + DefaultTimeoutMinutes := 2; //Session timeout in minutes + SessionDir := MySessionDir; +// SessionCookie:='ACustomCookieName'; {Use this to set the cookie name that will be used for the session management. Default is 'FPWebSession'} + end; + + sessiondbfile := 'sessiondb.txt'; //This will contain the name=sessionID pairs to simulate the session database + userdbfile := 'userdb.txt'; //This simulates a user database with passwords +end; + +procedure TFPWebModule1.loginRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +var + loginname, pwd, pwd1 : String; + userdatabase, sessiondatabase : TStringlist; +begin + Handled := true; + ModuleTemplate.FileName := 'testlogin.html'; + ModuleTemplate.OnReplaceTag := @loginReplaceTag; + AResponse.CustomHeaders.Add('Pragma=no-cache');//do not cache the response in the web browser so the Back key can not be used to see the pages without reloads. + + if FindNameInList(ARequest.ContentFields, 'LoginName') = '' then + begin//called the login action without parameters -> display the login page + ARequest.QueryFields.Add('MSG=NORMAL'); + AResponse.Content := ModuleTemplate.GetContent; + Exit; + end; + + loginname := Trim(ARequest.ContentFields.Values['LoginName']); + pwd := Trim(ARequest.ContentFields.Values['Password']); + if (pwd = '') or (loginname = '') then + begin//empty login name or password -> return to the login screen + ARequest.QueryFields.Add('MSG=MISSING'); + AResponse.Content := ModuleTemplate.GetContent; + Exit; + end; + + //simulate a user database loaded into a stringlist + userdatabase := TStringlist.Create; + userdatabase.LoadFromFile(userdbfile); + pwd1 := userdatabase.Values[LoginName];//get the correct password for the LoginName if it is there + userdatabase.free; + // + + if pwd <> pwd1 then + begin//either the password or the login name was invalid + ARequest.QueryFields.Add('MSG=INVLOGIN'); + AResponse.Content := ModuleTemplate.GetContent; + Exit; + end; + + //successful login + LoggedInLoginName := loginname; + + //session starting, need to store it somewhere next to the name of the logged in person + sessiondatabase := TStringList.Create; + if FileExists(sessiondbfile) then + sessiondatabase.LoadFromFile(sessiondbfile); //simulating the session database access + if sessiondatabase.Count > 0 then + RemoveValueIfExists(sessiondatabase, Session.SessionID); //New login, kill all sessions with this session ID (same computer, same browser, multiple persons) + if FindNameInList(sessiondatabase, LoginName) <> '' then + sessiondatabase.Values[LoginName] := Session.SessionID //overwrite with the new session ID + else + sessiondatabase.Add(LoginName + '=' + Session.SessionID); //create a new entry for this person + sessiondatabase.SaveToFile(sessiondbfile); //simulating the session database update + sessiondatabase.Free; + + //generate the Welcome page content + ModuleTemplate.FileName := 'testwelcome.html'; + ModuleTemplate.OnReplaceTag := @welcomeReplaceTag; + AResponse.Content := ModuleTemplate.GetContent; +end; + +procedure TFPWebModule1.loginReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +begin + {Handle tags used in multiple templates} + if CommonTemplateTagReplaces(TagString, TagParams, ReplaceText) then + Exit; + + {Handle tags specific to this template if there are any} + if AnsiCompareText(TagString, 'MESSAGE') = 0 then + begin + ReplaceText := TagParams.Values[Request.QueryFields.Values['MSG']]; + end else + + {Message for tags not handled} + begin + ReplaceText := '[Template tag "' + TagString + '" is not implemented yet.]'; + end; +end; + +procedure TFPWebModule1.welcomeReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); +begin + {Handle tags used in multiple templates} + if CommonTemplateTagReplaces(TagString, TagParams, ReplaceText) then + Exit; + + {Handle tags specific to this template if there are any} + + {Message for tags not handled} + begin + ReplaceText := '[Template tag "' + TagString + '" is not implemented yet.]'; + end; +end; + +function TFPWebModule1.CommonTemplateTagReplaces(const TagString:String; + TagParams: TStringList; out ReplaceText: String):Boolean; +begin + Result := true; + + if AnsiCompareText(TagString, 'DATETIME') = 0 then + begin + ReplaceText := FormatDateTime(TagParams.Values['FORMAT'], Now); + end else + + if AnsiCompareText(TagString, 'SESSIONID') = 0 then + begin + if Assigned(Session) then + ReplaceText := Session.SessionID; + end else + + if AnsiCompareText(TagString, 'MINUTESLEFT') = 0 then + begin + if Assigned(Session) then + ReplaceText := IntToStr(Session.TimeOutMinutes); + end else + + if AnsiCompareText(TagString, 'SESSIONFILE') = 0 then + begin + if Assigned(Session) then + if MySessionDir = '' then + ReplaceText := IncludeTrailingPathDelimiter(GetTempDir(True)) + IncludeTrailingPathDelimiter('fpwebsessions') + Session.SessionID + else + ReplaceText := IncludeTrailingPathDelimiter(MySessionDir) + Session.SessionID; +{NOTE: GetTempDir +used by the session manager. Returns the OS temporary directory if possible, or from the +environment variable TEMP . For CGI programs you need to pass global environment +variables, it is not automatic. For example in the Apache httpd.conf with a +"PassEnv TEMP" or "SetEnv TEMP /pathtotmpdir" line so the web server passes this +global environment variable to the CGI programs' local environment variables. +} + end else + + if AnsiCompareText(TagString, 'LOGINNAME') = 0 then + begin + ReplaceText := LoggedInLoginName; + end else + + Result := false; +end; + +function TFPWebModule1.NotLoggedIn:Boolean; +var + sessiondatabase : TStringlist; +begin + Result := false; + + //check if the current sessionID is in the sessionDB + sessiondatabase := TStringList.Create; + if FileExists(sessiondbfile) then + sessiondatabase.LoadFromFile(sessiondbfile); + LoggedInLoginName := FindValueInList(sessiondatabase, Session.sessionID); + sessiondatabase.Free; + // + + if LoggedInLoginName = '' then + begin + Result := true; //not found -> not logged in or previous session has expired + + //show the login screen again with the expired session message + ModuleTemplate.FileName := 'testlogin.html'; + ModuleTemplate.OnReplaceTag := @loginReplaceTag; + Request.QueryFields.Add('MSG=SESSIONEXPIRED'); + Response.Content := ModuleTemplate.GetContent; + end; +end; + +procedure TFPWebModule1.logoutRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +var + sessiondatabase : TStringList; +begin + Handled := true; + + if NotLoggedIn then Exit; + + //delete the sessionID and all occurences of the login name assigned to it from the sessiondb + sessiondatabase := TStringList.Create; + if FileExists(sessiondbfile) then + sessiondatabase.LoadFromFile(sessiondbfile); + if sessiondatabase.Count > 0 then + begin + RemoveValueIfExists(sessiondatabase, Session.SessionID); + RemoveNameIfExists(sessiondatabase, LoggedInLoginName); + sessiondatabase.SaveToFile(sessiondbfile); + end; + sessiondatabase.Free; + // + + //terminate the session + Session.Terminate; + + //Generate the response page + ModuleTemplate.FileName := 'testlogout.html'; + ModuleTemplate.OnReplaceTag := @logoutReplaceTag; + AResponse.Content := ModuleTemplate.GetContent;//generate the Logout page content. +end; + +procedure TFPWebModule1.logoutReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); +begin + {Handle tags used in multiple templates} + if CommonTemplateTagReplaces(TagString, TagParams, ReplaceText) then + Exit; + + {Handle tags specific to this template if there are any} + + {Message for tags not handled} + begin + ReplaceText := '[Template tag "' + TagString + '" is not implemented yet.]'; + end; +end; + +procedure TFPWebModule1.someactionRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +begin + Handled := true; + + if NotLoggedIn then Exit; + + ModuleTemplate.FileName := 'testsomepage.html'; + ModuleTemplate.OnReplaceTag := @someactionReplaceTag; + AResponse.Content := ModuleTemplate.GetContent;//generate the testpage content +end; + +procedure TFPWebModule1.someactionReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +begin + {Handle tags used in multiple templates} + if CommonTemplateTagReplaces(TagString, TagParams, ReplaceText) then + Exit; + + {Handle tags specific to this template if there are any} + + {Message for tags not handled} + begin + ReplaceText := '[Template tag {+' + TagString + '+} is not implemented yet.]'; + end; +end; + +initialization + RegisterHTTPModule('TFPWebModule1', TFPWebModule1); +end. + diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/README.txt b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/README.txt new file mode 100644 index 0000000000..eaededd5fb --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/README.txt @@ -0,0 +1,153 @@ +Sessions stored in the URLs with Login (no cookies needed), example +========================================================== + +Every visitor needs to log in (using userdb.txt for the user names and +passwords in the example) to get a session ID that is always passed in the +URLs of the response pages as a query parameter and stored on the web server +until it expires. +This way fully functional web sites can be built without mixing the different +visitor's screens and without using cookies to keep the session separated. + +Note: Because the session ID is stored dynamically in the generated pages, all +web browser tabs will have separate sessions after logging in with them. +The sample user logins are stored in userdb.txt for the example. + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule urlsession.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the chosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- +The application needs read access to the template (testurl*.html) files. +It is best to use full paths with the file names in the web module +(webmodule.pas), because Apache will probably look relative to the / (main +root) directory or main Apache directory and not relative to the application +file location. +ex: ModuleTemplate.FileName := '/full/path/to/templates/testurllogin.html'; +and so on for all the other templates. + +It needs read/write access to the file where the session informations will be +stored with the login names (session-db.txt). +ex: sessiondbfile := '/full/path/to/session-db.txt'; +The session-db.txt can be created empty, and needs read/write access. + +It also needs read access to the user database (userdb.txt) +ex: userdbfile := '/full/path/to/userdb.txt'; + + +2.a; as CGI +----------- +Usually it works if you put the templates (testurl*.html) next to the CGI +executable file in the Apache cgi-bin directory. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/login should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/urlsession/login +if in the Apache configuration file (ex: httpd.conf) it was set up as +ScriptAlias /urlsession "<path_to_app>/<app_name>" +ex: +ScriptAlias /urlsession "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/urlsession.exe" + +Note: You need to change the URLs if "cgi-bin" or "urlsession.exe" changes +(for example on Linux it is not urlsession.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL. + + +2.b; as Apache module +--------------------- +Usually it works if you put the templates (testurl*.html) into the Apache +main directory (not the DocumentRoot, but the main Apache directory), under +sub-directory "templates" or something similar. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheLocationName>/login should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/urlsession/login +if in httpd.conf it was set up as: +LoadModule mod_urlsession "<path_to_mod>/urlsession.dll" +<Location /urlsession> + SetHandler mod_urlsession + Order allow,deny + Allow from all +</Location> + +Note: You need to change the URLs in the templates if "urlsession" changes. +Also, for example on Linux the module can be liburlsession.so and not +urlsession.dll + +Note: If you recompile an apache module while the module itself is loaded into +the Apache server, the compilation might fail because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +server before you recompile or before you copy over the new version of the +newly created module. +On Linux, it is enough to simply reload Apache after recompile. + + +2.c; as FCGI +------------ +Usually it works if you put the templates (testurl*.html) next to the FCGI +executable file. Adjust the file path in the web module (webmodule.pas) +accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/login should start the example +if everything is set up properly. +ex: http://127.0.0.1:8080/urlsession/login +or http://127.0.0.1/urlsession/login +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> + Order allow,deny + Allow from all + </Directory> + FastCgiExternalServer "<path_to_fcgi_app>/urlsession.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush + ScriptAlias /urlsession "<path_to_fcgi_app>/urlsession.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (urlsession.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way. diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpi b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpi new file mode 100644 index 0000000000..b6992c7f7a --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="urlsession.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="urlsession"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpr b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpr new file mode 100644 index 0000000000..c04266fce5 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.lpr @@ -0,0 +1,36 @@ +Library urlsession; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, webmodule; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_urlsession'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.res b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/apache/urlsession.res diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpi b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpi new file mode 100644 index 0000000000..8846572dfc --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="urlsession.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="urlsession"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpr b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpr new file mode 100644 index 0000000000..e77de6142c --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.lpr @@ -0,0 +1,13 @@ +program urlsession; + +{$mode objfpc}{$H+} + +uses + fpCGI, webmodule; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.res b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/cgi/urlsession.res diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpi b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpi new file mode 100644 index 0000000000..8846572dfc --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="urlsession.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="urlsession"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpr b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpr new file mode 100644 index 0000000000..2a41c8e146 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.lpr @@ -0,0 +1,14 @@ +program urlsession; + +{$mode objfpc}{$H+} + +uses + fpFCGI, webmodule; + +{$R *.res} + +begin + Application.Port:=2015;//Port the FCGI application is listening on + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.res b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/fcgi/urlsession.res diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogin.html b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogin.html new file mode 100644 index 0000000000..97d50b8a20 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogin.html @@ -0,0 +1,23 @@ +<html> +<body> + + {+MESSAGE + [-NORMAL =Welcome to the URL-session test login screen-] + [-MISSING =<font color="red"><small>Please enter both a login name and a password.</small></font>-] + [-INVLOGIN=<font color="red"><small>Invalid login name or password. Please try again.</small></font>-] + [-NODB=<font color="red"><small>Cannot find the user DB or it is empty.</small></font>-] + [-SESSIONEXPIRED=<font color="orange"><small>Your session has expired. Please log in again</small></font>-] + +} + <br> + <form action="/urlsession/login" method="Post"> + + Login Name:<input type="text" name="LoginName" value="{+LOGINNAME+}"> + + Password:<input type="password" name="Password"> + + <input type="submit" class="button" value="Login"> + + </form> + +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogout.html b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogout.html new file mode 100644 index 0000000000..df61b22c92 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurllogout.html @@ -0,0 +1,10 @@ +<html> +<body> +Logout screen<br><br> + +You have successfully logged out <b>{+LOGINNAME+}</b> .<br><br> + +You can log in again <a href="/urlsession/login">here</a><br><br> + +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlsomepage.html b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlsomepage.html new file mode 100644 index 0000000000..9dd5477f45 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlsomepage.html @@ -0,0 +1,14 @@ +<html> +<body> +Somepage screen +<br><br>Entered this screen at <b>{+DATETIME [-FORMAT=MM/DD/YYYY hh:mm:ss.zzz-]+}</b><br><br> + +<b>{+LOGINNAME+}</b>, you can log out <a href="/urlsession/logout?{+SESSION-VARIABLE+}">here</a><br><br> + +Your session will expire in <b>{+MINUTESLEFT+}</b> minutes unless it is refreshed by<br> +clicking <a href="/urlsession/someaction?{+SESSION-VARIABLE+}">here</a> before then<br><br> + +Your session ID is: <b>{+SESSIONID+}</b><br> + +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlwelcome.html b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlwelcome.html new file mode 100644 index 0000000000..abfc4e512b --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/testurlwelcome.html @@ -0,0 +1,16 @@ +<html> +<body> +Welcome screen +<br><br>Entered this screen at <b>{+DATETIME [-FORMAT=MM/DD/YYYY hh:mm:ss.zzz-]+}</b><br><br> + +You have successfuly logged in <b>{+LOGINNAME+}</b> .<br><br> + +You can log out <a href="/urlsession/logout?{+SESSION-VARIABLE+}">here</a><br><br> + +Your session will expire in <b>{+MINUTESLEFT+}</b> minutes unless it is refreshed by<br> +clicking <a href="/urlsession/someaction?{+SESSION-VARIABLE+}">here</a> before then<br><br> + +Your session ID is: <b>{+SESSIONID+}</b><br> + +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/userdb.txt b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/userdb.txt new file mode 100644 index 0000000000..5e21473d29 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/templates/userdb.txt @@ -0,0 +1,2 @@ +joe=joepassword +jane=janepassword diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.lfm b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.lfm new file mode 100644 index 0000000000..456657dfc2 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.lfm @@ -0,0 +1,29 @@ +object FPWebModule1: TFPWebModule1 + OnCreate = DataModuleCreate + OldCreateOrder = False + Actions = < + item + Name = 'login' + Default = True + OnRequest = loginRequest + Template.AllowTagParams = False + end + item + Name = 'logout' + Default = False + OnRequest = logoutRequest + Template.AllowTagParams = False + end + item + Name = 'someaction' + Default = False + OnRequest = someactionRequest + Template.AllowTagParams = False + end> + AfterResponse = DataModuleAfterResponse + CreateSession = False + Height = 300 + HorizontalOffset = 290 + VerticalOffset = 149 + Width = 400 +end diff --git a/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.pas b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.pas new file mode 100644 index 0000000000..715dd869c6 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/sessions/urlsessions-login/webmodule/webmodule.pas @@ -0,0 +1,378 @@ +unit webmodule; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, HTTPDefs, fpHTTP, fpWeb; + +type + + { TFPWebModule1 } + + TFPWebModule1 = class(TFPWebModule) + procedure DataModuleAfterResponse(Sender: TObject; AResponse: TResponse); + procedure DataModuleCreate(Sender: TObject); + procedure loginRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + procedure logoutRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + procedure someactionRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + private + { private declarations } + LoggedInLoginName : String; + SessionID: String; + SessionDBFile : String; + UserDBFile : String; + SessionVariable: String; + TimeoutMinutes: Integer; + function RemoveExpiredSessions(SL:TStringList; const SIDToDelete:String):Boolean; + function NotLoggedIn:Boolean; + function CommonTemplateTagReplaces(const TagString:String; + TagParams: TStringList; Out ReplaceText: String):Boolean; + + procedure loginReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + procedure logoutReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + procedure welcomeReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + procedure someactionReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + public + { public declarations } + end; + +var + FPWebModule1: TFPWebModule1; + +implementation + +{$R *.lfm} + +{ TFPWebModule1 } + +procedure TFPWebModule1.DataModuleAfterResponse(Sender: TObject; + AResponse: TResponse); +var + sessiondatabase:TStringList; + SIDLastRefresh:String; +begin + //update the session DB for the current session + if (SessionID <> '')and(LoggedinLoginName <> '') then + begin//for many concurrent request websites this part needs to be modified to have some kind of locking while writing into the file/relational database + SIDLastRefresh := ''; + sessiondatabase := TStringList.Create; + if FileExists(sessiondbfile) then + sessiondatabase.LoadFromFile(sessiondbfile); + SIDLastRefresh := sessiondatabase.Values[SessionID]; + if SIDLastRefresh <> '' then + begin + sessiondatabase.Values[SessionID] := DateTimeToStr(Now) + LoggedinLoginName;//update the Last refresh time + sessiondatabase.SaveToFile(sessiondbfile); + end; + sessiondatabase.Free; + end; + + //reset global variables for apache modules for the next incoming request + LoggedInLoginName := ''; + SessionID := ''; + // +end; + +procedure TFPWebModule1.DataModuleCreate(Sender: TObject); +begin + ModuleTemplate.AllowTagParams := true; + ModuleTemplate.StartDelimiter := '{+'; //The default is { and } which is usually not good if we use Javascript in our templates + ModuleTemplate.EndDelimiter := '+}'; + sessiondbfile := 'session-db.txt';//This will contain the sessionID=expiration pairs + userdbfile := 'userdb.txt'; //This simulates a user database with passwords + TimeOutMinutes := 2; //With a session timeout of 2 minutes + SessionVariable := 'sid'; //Query parameter name for the session ID, for all links in the templates + LongTimeFormat := 'hh:mm:ss'; //to save on date time conversion code + ShortDateFormat := 'YYYY/MM/DD'; //to save on date time conversion code +end; + +function FindNameInList(const SL:TStrings; const N:String):String; +var + i : Integer; +begin + Result := ''; + for i := 0 to SL.Count - 1 do + if SL.Names[i] = N then + begin + Result := SL.Values[SL.Names[i]]; + break; + end; +end; + +function TFPWebModule1.RemoveExpiredSessions(SL:TStringList; const SIDToDelete:String):Boolean; +var + DT:TDateTime; + i, j: Integer; + s, SIDLastRefresh: String; +begin + Result := false; + + if SL.Count <= 0 then Exit; + i := 0; + repeat + s := SL[i]; + j := pos('=', s); + if j > 0 then + begin + if copy(s, 1, j - 1) = SIDToDelete then + begin + SL.Delete(i); + dec(i); + end else begin + SIDLastRefresh := copy(s, j + 1, 19);{YYYY/MM/DD hh:mm:ss} + DT := StrToDateTime(SIDLastRefresh); + if ((Now - DT) > (TimeOutMinutes/1440)) then + begin + Result := true; + SL.Delete(i); + dec(i); + end; + end; + end; + inc(i); + until i >= SL.Count; +end; + +function TFPWebModule1.NotLoggedIn:Boolean; +var + sessiondatabase:TStringlist; + SIDLastRefresh:String; +begin + Result := false; + + //check if the current sessionID is valid + SessionID := UpperCase(Request.QueryFields.Values[SessionVariable]); + if SessionID <> '' then + begin + sessiondatabase := TStringList.Create; + if FileExists(sessiondbfile) then + sessiondatabase.LoadFromFile(sessiondbfile); +// if RemoveExpiredSessions(sessiondatabase, '') then //Remove all expired sessions +// sessiondatabase.SaveToFile(sessiondbfile); {enough to purge only at logout events} + RemoveExpiredSessions(sessiondatabase, ''); { } + SIDLastRefresh := sessiondatabase.Values[SessionID]; + sessiondatabase.Free; + + if SIDLastRefresh <> '' then + begin + LoggedinLoginName := copy(SIDLastRefresh, 20, 1024); + Exit;//OK + end; + end; + + //show the login screen again with the expired session message + ModuleTemplate.FileName := 'testurllogin.html'; + ModuleTemplate.OnReplaceTag := @loginReplaceTag; + Request.QueryFields.Add('MSG=SESSIONEXPIRED'); + Response.Content := ModuleTemplate.GetContent; + Result := true; +end; + +procedure TFPWebModule1.loginRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +var + loginname, pwd, pwd1 : String; + userdatabase, sessiondatabase : TStringlist; + G : TGUID; +begin + Handled := true; + ModuleTemplate.FileName := 'testurllogin.html'; + ModuleTemplate.OnReplaceTag := @loginReplaceTag; + AResponse.CustomHeaders.Add('Pragma=no-cache');//do not cache the response in the web browser + + if FindNameInList(ARequest.ContentFields, 'LoginName') = '' then + begin//called the login action without parameters -> display the login page + ARequest.QueryFields.Add('MSG=NORMAL'); + AResponse.Content := ModuleTemplate.GetContent; + Exit; + end; + + loginname := Trim(ARequest.ContentFields.Values['LoginName']); + pwd := Trim(ARequest.ContentFields.Values['Password']); + if (pwd = '') or (loginname = '') then + begin//empty login name or password -> return to the login screen + ARequest.QueryFields.Add('MSG=MISSING'); + AResponse.Content := ModuleTemplate.GetContent; + Exit; + end; + + //simulate a user database loaded into a stringlist + userdatabase := TStringlist.Create; + userdatabase.LoadFromFile(userdbfile); + pwd1 := userdatabase.values[LoginName];//get the correct password for the LoginName if it is there + userdatabase.free; + // + + if pwd <> pwd1 then + begin//either the password or the login name was invalid + ARequest.QueryFields.Add('MSG=INVLOGIN'); + AResponse.Content := ModuleTemplate.GetContent; + Exit; + end; + + //succesful login + LoggedInLoginName := loginname; + + //session starting, need to store it somewhere next to the name of the logged in person + sessiondatabase := TStringList.Create; + if FileExists(sessiondbfile) then + sessiondatabase.LoadFromFile(sessiondbfile); + CreateGUID(G); + SessionID:=UpperCase(GuiDToString(G)); + sessiondatabase.Add(SessionID + '=' + DateTimeToStr(Now) + LoggedinLoginName);//create a new entry for this session + sessiondatabase.SaveToFile(sessiondbfile);//for many concurrent request websites this part needs to be modified to have some kind of locking while writing into the file/relational database + sessiondatabase.Free; + + //generate the Welcome page content + ModuleTemplate.FileName := 'testurlwelcome.html'; + ModuleTemplate.OnReplaceTag := @welcomeReplaceTag; + AResponse.Content := ModuleTemplate.GetContent; +end; + +procedure TFPWebModule1.loginReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +begin + {Handle tags used in multiple templates} + if CommonTemplateTagReplaces(TagString, TagParams, ReplaceText) then + Exit; + + {Handle tags specific to this template if there are any} + if AnsiCompareText(TagString, 'MESSAGE') = 0 then + begin + ReplaceText := TagParams.Values[Request.QueryFields.Values['MSG']]; + end else + + {Message for tags not handled} + begin + ReplaceText := '[Template tag {+' + TagString + '+} is not implemented yet.]'; + end; +end; + +procedure TFPWebModule1.welcomeReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); +begin + {Handle tags used in multiple templates} + if CommonTemplateTagReplaces(TagString, TagParams, ReplaceText) then + Exit; + + {Handle tags specific to this template if there are any} + + + {Message for tags not handled} + begin + ReplaceText := '[Template tag {+' + TagString + '+} is not implemented yet.]'; + end; +end; + +procedure TFPWebModule1.logoutRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +var + sessiondatabase : TStringList; +begin + Handled := true; + + if NotLoggedIn then Exit; + + //delete the sessionID from the sessiondb with all expired sessions + sessiondatabase := TStringList.Create; + if FileExists(sessiondbfile) then + sessiondatabase.LoadFromFile(sessiondbfile); + RemoveExpiredSessions(sessiondatabase, SessionID); + sessiondatabase.SaveToFile(sessiondbfile);//for many concurrent request websites this part needs to be modified to have some kind of locking while writing into the file/relational database + sessiondatabase.Free; + // + + ModuleTemplate.FileName := 'testurllogout.html'; + ModuleTemplate.OnReplaceTag := @logoutReplaceTag; + AResponse.Content := ModuleTemplate.GetContent;//generate the Logout page content. +end; + +procedure TFPWebModule1.logoutReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); +begin + {Handle tags used in multiple templates} + if CommonTemplateTagReplaces(TagString, TagParams, ReplaceText) then + Exit; + + {Handle tags specific to this template if there are any} + + + {Message for tags not handled} + begin + ReplaceText := '[Template tag {+' + TagString + '+} is not implemented yet.]'; + end; +end; + +procedure TFPWebModule1.someactionRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +begin + Handled := true; + + if NotLoggedIn then Exit; + + ModuleTemplate.FileName := 'testurlsomepage.html'; + ModuleTemplate.OnReplaceTag := @someactionReplaceTag; + AResponse.Content := ModuleTemplate.GetContent; +end; + +procedure TFPWebModule1.someactionReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +begin + {Handle tags used in multiple templates} + if CommonTemplateTagReplaces(TagString, TagParams, ReplaceText) then + Exit; + + {Handle tags specific to this template if there are any} + + + {Message for tags not handled} + begin + ReplaceText := '[Template tag {+' + TagString + '+} is not implemented yet.]'; + end; +end; + +function TFPWebModule1.CommonTemplateTagReplaces(const TagString:String; + TagParams: TStringList; out ReplaceText: String):Boolean; +begin + Result := true; + + if AnsiCompareText(TagString, 'SESSION-VARIABLE') = 0 then + begin + ReplaceText := SessionVariable + '=' + SessionID; + end else + + if AnsiCompareText(TagString, 'DATETIME') = 0 then + begin + ReplaceText := FormatDateTime(TagParams.Values['FORMAT'], Now); + end else + + if AnsiCompareText(TagString, 'SESSIONID') = 0 then + begin + ReplaceText := SessionID; + end else + + if AnsiCompareText(TagString, 'MINUTESLEFT') = 0 then + begin + ReplaceText := IntToStr(TimeOutMinutes); + end else + + if AnsiCompareText(TagString, 'LOGINNAME') = 0 then + begin + ReplaceText := LoggedInLoginName; + end else + + Result := false; +end; + +initialization + RegisterHTTPModule('TFPWebModule1', TFPWebModule1); +end. diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/README.txt b/packages/fcl-web/examples/fptemplate/simpletemplate/README.txt new file mode 100644 index 0000000000..f6f9d73963 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/README.txt @@ -0,0 +1,143 @@ +Simple template, example +================ +The simplest template with one template tag in it to be replaced by the +CGI/FCGI/Apache module application when generating the response page +-> ex: {TagName1} + +Note, that the only difference between CGI/FCGI and Apache module is in the +main project .lpr file. + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule simpletemplate.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the chosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- +The application needs read access to the template file(s). +It is best to use full paths with the file names in the web module +(webmodule.pas), because Apache will probably look relative to the / (main +root) directory or main Apache directory and not relative to the application +file location. +ex: ModuleTemplate.FileName := '/full/path/to/template/mytemplate1.html'; + + +2.a; as CGI +----------- +Usually it works if you put the template (mytemplate1.html) next to the CGI +executable file in the Apache cgi-bin directory. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/cgi-bin/<CGIExecutableName>/func1call should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/cgi-bin/simpletemplate.exe/func1call + +If the calling URL looks too long, or you want to hide it a little bit more, +you can use a ScriptAlias in the Apache configuration file to make it shorter. +ex: ScriptAlias /mycgi "<path_to_cgi_app>/simpletemplate.exe" in your conf +file will make http://127.0.0.1:8080/mycgi/func1call work the same way. + +Note: You need to change the URLs if "cgi-bin" or "simpletemplate.exe" +changes (for example on Linux it is not simpletemplate.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL. + + +2.b; as Apache module +--------------------- +Usually it works if you put the template (mytemplate1.html) into the Apache +main directory (not the DocumentRoot, but the main Apache directory), under +sub-directory "templates" or something similar. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheLocationName>/func1call should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/myapache/func1call + +if in httpd.conf it was set up as: +LoadModule mod_simpletemplate "<path_to_mod>/simpletemplate.dll" +<Location /myapache> + SetHandler mod_simpletemplate + Order allow,deny + Allow from all +</Location> + +Note: You need to change the URLs "myapache" or "simpletemplate.dll" +changes. For example on Linux the module can be libsimpletemplate.so and not +simpletemplate.dll + +Note: If you recompile an apache module while the module itself is loaded into +the Apache server, the compilation might fail because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +server before you recompile or before you copy over the new version of the +newly created module. +On Linux, it is enough to simply reload Apache after recompile. + + +2.c; as FCGI +------------ +Usually it works if you put the template (mytemplate1.html) next to the FCGI +executable file. Adjust the file path in the web module (webmodule.pas) +accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/func1call should start the example +if everything is set up properly. +ex: http://127.0.0.1:8080/myfcgi/func1call +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#External FCGI app, has to start manually, Apache will not do it + FastCgiExternalServer "<path_to_fcgi_app>/simpletemplate.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush +#optionally, to shorten the calling URL and to not display the executable file name (if used, no +ExecCGI is needed above) + ScriptAlias /myfcgi "<path_to_fcgi_app>/simpletemplate.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (simpletemplate.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way. diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpi b/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpi new file mode 100644 index 0000000000..c41002fa11 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="simpletemplate.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="simpletemplate"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpr b/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpr new file mode 100644 index 0000000000..0139b81cc6 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.lpr @@ -0,0 +1,37 @@ +Library simpletemplate; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, webmodule; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_simpletemplate'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. + diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.res b/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/apache/simpletemplate.res diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpi b/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpi new file mode 100644 index 0000000000..8bf367e31f --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="simpletemplate.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="simpletemplate"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpr b/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpr new file mode 100644 index 0000000000..abbb162737 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.lpr @@ -0,0 +1,14 @@ +program simpletemplate; + +{$mode objfpc}{$H+} + +uses + fpCGI, webmodule; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end. + diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.res b/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/cgi/simpletemplate.res diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpi b/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpi new file mode 100644 index 0000000000..8bf367e31f --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="simpletemplate.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="simpletemplate"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpr b/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpr new file mode 100644 index 0000000000..bf1058d611 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.lpr @@ -0,0 +1,15 @@ +program simpletemplate; + +{$mode objfpc}{$H+} + +uses + fpFCGI, webmodule; + +{$R *.res} + +begin + Application.Port:=2015;//Port the FCGI application is listening on + Application.Initialize; + Application.Run; +end. + diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.res b/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/fcgi/simpletemplate.res diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/templates/mytemplate1.html b/packages/fcl-web/examples/fptemplate/simpletemplate/templates/mytemplate1.html new file mode 100644 index 0000000000..68347d8cc2 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/templates/mytemplate1.html @@ -0,0 +1,5 @@ +<html> +<body> +This is a replaced template tag: {TagName1} +</body> +</html>
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.lfm b/packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.lfm new file mode 100644 index 0000000000..8b074b714b --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.lfm @@ -0,0 +1,15 @@ +object FPWebModule1: TFPWebModule1 + OldCreateOrder = False + Actions = < + item + Name = 'func1call' + Default = False + OnRequest = func1callRequest + Template.AllowTagParams = False + end> + CreateSession = False + Height = 300 + HorizontalOffset = 290 + VerticalOffset = 149 + Width = 400 +end diff --git a/packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.pas b/packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.pas new file mode 100644 index 0000000000..0ff882ba0e --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/simpletemplate/webmodule/webmodule.pas @@ -0,0 +1,65 @@ +unit webmodule; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, httpdefs, fpHTTP, fpWeb; + +type + + { TFPWebModule1 } + + TFPWebModule1 = class(TFPWebModule) + procedure func1callRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + private + { private declarations } + procedure func1callReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + public + { public declarations } + end; + +var + FPWebModule1: TFPWebModule1; + +implementation + +{$R *.lfm} + +{ TFPWebModule1 } + +procedure TFPWebModule1.func1callRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +begin + //ModuleTemplate is a web module global property + //To use the Template propery of the current web action (which is visible in + //the object inspector for every Action), use + //(Sender as TFPWebAction).Template.FileName := 'mytemplate1.html'; and so on. + ModuleTemplate.FileName := 'mytemplate1.html';//best to use full path here + ModuleTemplate.AllowTagParams := true; + ModuleTemplate.OnReplaceTag := @func1callReplaceTag; + + AResponse.Content := ModuleTemplate.GetContent; + + Handled := true; +end; + +procedure TFPWebModule1.func1callReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +begin + if AnsiCompareText(TagString, 'TagName1') = 0 then + begin + ReplaceText := 'Here I am from the web module!'; + end else begin + +//Not found value for tag -> TagString + ReplaceText := 'Template tag {' + TagString + '} is not implemented yet.'; + end; +end; + +initialization + RegisterHTTPModule('TFPWebModule1', TFPWebModule1); +end. diff --git a/packages/fcl-web/examples/fptemplate/tagparam/README.txt b/packages/fcl-web/examples/fptemplate/tagparam/README.txt new file mode 100644 index 0000000000..a58e81b2ec --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/README.txt @@ -0,0 +1,142 @@ +Tag parameter, example +============== +Demonstrating the set up and use of template tag parameter(s) via FPTemplate +->ex: {+DATETIME [-FORMAT=MM/DD hh:mm:ss-]+} +where DATETIME is the template-tag, and FORMAT is the template-tag-parameter. + +Note, that the only difference between CGI/FCGI and Apache module is in the +main project .lpr file. + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule tagparam.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the chosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- +The application needs read access to the template file(s). +It is best to use full paths with the file names in the web module +(webmodule.pas), because Apache will probably look relative to the / (main +root) directory or main Apache directory and not relative to the application +file location. +ex: ModuleTemplate.FileName := '/full/path/to/template/mytemplate2.html'; + +2.a; as CGI +----------- +Usually it works if you put the template (mytemplate2.html) next to the CGI +executable file in the Apache cgi-bin directory. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/cgi-bin/<CGIExecutableName>/func1call should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/cgi-bin/tagparam.exe/func1call + +If the calling URL looks too long, or you want to hide it a little bit more, +you can use a ScriptAlias in the Apache configuration file to make it shorter. +ex: ScriptAlias /mycgi "<path_to_cgi_app>/tagparam.exe" in your conf +file will make http://127.0.0.1:8080/mycgi/func1call work the same way. + +Note: You need to change the URLs if "cgi-bin" or "tagparam.exe" +changes (for example on Linux it is not tagparam.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL. + + +2.b; as Apache module +--------------------- +Usually it works if you put the template (mytemplate2.html) into the Apache +main directory (not the DocumentRoot, but the main Apache directory), under +sub-directory "templates" or something similar. Adjust the file path in the +web module (webmodule.pas) accordingly. + +http://<WebServer>/<ApacheLocationName>/func1call should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/myapache/func1call + +if in httpd.conf it was set up as: +LoadModule mod_tagparam "<path_to_mod>/tagparam.dll" +<Location /myapache> + SetHandler mod_tagparam + Order allow,deny + Allow from all +</Location> + +Note: You need to change the URLs "myapache" or "tagparam.dll" +changes. For example on Linux the module can be libtagparam.so and not +tagparam.dll + +Note: If you recompile an apache module while the module itself is loaded into +the Apache server, the compilation might fail because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +server before you recompile or before you copy over the new version of the +newly created module. +On Linux, it is enough to simply reload Apache after recompile. + + +2.c; as FCGI +------------ +Usually it works if you put the template (mytemplate2.html) next to the FCGI +executable file. Adjust the file path in the web module (webmodule.pas) +accordingly. + +http://<WebServer>/<ApacheScriptAliasName>/func1call should start the example +if everything is set up properly. +ex: http://127.0.0.1:8080/myfcgi/func1call +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#External FCGI app, has to start manually, Apache will not do it + FastCgiExternalServer "<path_to_fcgi_app>/tagparam.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush +#optionally, to shorten the calling URL and to not display the executable file name (if used, no +ExecCGI is needed above) + ScriptAlias /myfcgi "<path_to_fcgi_app>/tagparam.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (tagparam.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpi b/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpi new file mode 100644 index 0000000000..1dfeac4031 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="tagparam.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="tagparam"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpr b/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpr new file mode 100644 index 0000000000..38104f276c --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.lpr @@ -0,0 +1,37 @@ +Library tagparam; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, webmodule; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_tagparam'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. + diff --git a/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.res b/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/apache/tagparam.res diff --git a/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpi b/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpi new file mode 100644 index 0000000000..b0f9194103 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="tagparam.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="tagparam"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpr b/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpr new file mode 100644 index 0000000000..89760625b5 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.lpr @@ -0,0 +1,13 @@ +program tagparam; + +{$mode objfpc}{$H+} + +uses + fpCGI, webmodule; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.res b/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/cgi/tagparam.res diff --git a/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpi b/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpi new file mode 100644 index 0000000000..b0f9194103 --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="tagparam.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="tagparam"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpr b/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpr new file mode 100644 index 0000000000..587016579a --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.lpr @@ -0,0 +1,14 @@ +program tagparam; + +{$mode objfpc}{$H+} + +uses + fpFCGI, webmodule; + +{$R *.res} + +begin + Application.Port:=2015;//Port the FCGI application is listening on + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.res b/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/fcgi/tagparam.res diff --git a/packages/fcl-web/examples/fptemplate/tagparam/templates/mytemplate2.html b/packages/fcl-web/examples/fptemplate/tagparam/templates/mytemplate2.html new file mode 100644 index 0000000000..4980393c5d --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/templates/mytemplate2.html @@ -0,0 +1,14 @@ +<html> +<body> + +DateTime in format "MM/DD hh:mm:ss": {+DATETIME [-FORMAT=MM/DD hh:mm:ss-]+} + +<br> + +DateTime in format "MM/DD/YYYY hh:mm": {+DATETIME [-FORMAT=MM/DD/YYYY hh:mm-]+} + +<br> + +Time in format "hh:mm:ss.zzz": {+DATETIME [-FORMAT=hh:mm:ss.zzz-]+} +</body> +</html> diff --git a/packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.lfm b/packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.lfm new file mode 100644 index 0000000000..8b074b714b --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.lfm @@ -0,0 +1,15 @@ +object FPWebModule1: TFPWebModule1 + OldCreateOrder = False + Actions = < + item + Name = 'func1call' + Default = False + OnRequest = func1callRequest + Template.AllowTagParams = False + end> + CreateSession = False + Height = 300 + HorizontalOffset = 290 + VerticalOffset = 149 + Width = 400 +end diff --git a/packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.pas b/packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.pas new file mode 100644 index 0000000000..9454e42f7d --- /dev/null +++ b/packages/fcl-web/examples/fptemplate/tagparam/webmodule/webmodule.pas @@ -0,0 +1,68 @@ +unit webmodule; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, httpdefs, fpHTTP, fpWeb; + +type + + { TFPWebModule1 } + + TFPWebModule1 = class(TFPWebModule) + procedure func1callRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + private + { private declarations } + procedure func1callReplaceTag(Sender: TObject; const TagString:String; + TagParams: TStringList; Out ReplaceText: String); + public + { public declarations } + end; + +var + FPWebModule1: TFPWebModule1; + +implementation + +{$R *.lfm} + +{ TFPWebModule1 } + +procedure TFPWebModule1.func1callRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +begin + //ModuleTemplate is a web module global property + //To use the Template propery of the current web action (which is visible in + //the object inspector for every Action), use + //(Sender as TFPWebAction).Template.FileName := 'mytemplate1.html'; and so on. + ModuleTemplate.FileName := 'mytemplate2.html'; + ModuleTemplate.AllowTagParams := true; + ModuleTemplate.StartDelimiter := '{+'; + ModuleTemplate.EndDelimiter := '+}'; + ModuleTemplate.OnReplaceTag := @func1callReplaceTag; + + AResponse.Content := ModuleTemplate.GetContent; + + Handled := true; +end; + +procedure TFPWebModule1.func1callReplaceTag(Sender: TObject; const TagString: + String; TagParams: TStringList; Out ReplaceText: String); +begin + if AnsiCompareText(TagString, 'DATETIME') = 0 then + begin + ReplaceText := FormatDateTime(TagParams.Values['FORMAT'], Now); + end else begin + +//Not found value for tag -> TagString + ReplaceText := 'Template tag {+' + TagString + '+} is not implemented yet.'; + end; +end; + +initialization + RegisterHTTPModule('TFPWebModule1', TFPWebModule1); +end. + diff --git a/packages/fcl-web/examples/helloworld/README.txt b/packages/fcl-web/examples/helloworld/README.txt new file mode 100644 index 0000000000..daed011c54 --- /dev/null +++ b/packages/fcl-web/examples/helloworld/README.txt @@ -0,0 +1,116 @@ +Hello world, example +============ +The simplest "Hello World" example using fcl-web (fpweb) that uses a web action +called "func1call" in the web module to generate the response page. + +Note, that the only difference between CGI/FCGI and Apache module is in the +main project .lpr file and the web server (Apache) configuration. + +===================== +1. Compiling +1.a; with FPC +1.b; with Lazarus +2. Setup +2.a; as CGI +2.b; as Apache module +2.c; as FCGI +===================== + +1. Compiling: +------------- +We can either use FPC directly, or Lazarus to compile the CGI/FCGI/Apache +module application. The main project .lpr file, as well as the Lazarus .lpi is +in the cgi/fcgi/apache directories. + +1.a; with FPC +------------- +Enter to the directory (cgi/fcgi/apache) that has the .lpr file you wish to +compile, and then execute the command + +fpc -Fu../webmodule helloworld.lpr + +The -Fu parameter shows FPC where to find the web module source code. All +three web applications share the same web module code. + +1.b; with Lazarus +----------------- +It needs the WebLaz Package installed. Open the .lpi file from the choosen +application directory (cgi/fcgi/apache), and then + +Run -> Build from the menu. + + +2. Setup: +--------- + +2.a; as CGI +----------- +http://<WebServer>/cgi-bin/<CGIExecutableName>/func1call should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/cgi-bin/helloworld.exe/func1call + +Note: You need to change the URL if "cgi-bin" or "helloworld.exe" changes +(for example on Linux it is not helloworld.exe). +Also, if your server is listening on port 80 instead of 8080, you can leave +the :8080 part from the calling URL. + + +2.b; as Apache module +--------------------- +http://<WebServer>/<ApacheLocationName>/func1call should start the +example if everything is set up properly. +ex: http://127.0.0.1:8080/myapache/func1call +if in httpd.conf it was set up as: +LoadModule mod_helloworld "<path_to_mod>/helloworld.dll" +<Location /myapache> + SetHandler mod_helloworld + Order allow,deny + Allow from all +</Location> + +Note: You need to change the URL if "myapache" changes. +Also, for example on Linux the module can be libhelloworld.so and not +helloworld.dll + +Note: If you recompile an apache module while the module itself is loaded into +the Apache server, the compilation might fail because the file is in use +(Apache modules stay in the memory). So first, you always need to stop the +server before you recompile or before you copy over the new version of the +newly created module. +On Linux, it is enough to simply reload Apache after recompile. + + +2.c; as FCGI +------------ +http://<WebServer>/<ApacheScriptAliasName>/func1call should start the example +if everything is set up properly. +ex: http://127.0.0.1:8080/myfcgi/func1call +if in the Apache configuration file (ex: httpd.conf) it was set up as: + +LoadModule fastcgi_module "<path_to_mod>/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "<path_to_fcgi_app>"> +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#External FCGI app, has to start manually, Apache will not do it + FastCgiExternalServer "<path_to_fcgi_app>/helloworld.exe" -host 127.0.0.1:2015 -idle-timeout 30 -flush +#optionally, to shorten the calling URL and to not display the executable file name (if used, no +ExecCGI is needed above) + ScriptAlias /myfcgi "<path_to_fcgi_app>/helloworld.exe" +</IfModule> + +Note: You need to change the module name if needed. For example on Linux, +the module is not mod_fastcgi-2.4.6-AP22.dll but mod_fastcgi.so (need to be +compiled from sources found at http://www.fastcgi.com/dist/ ). +The port (2015 in this example) must match the one set in the project main +file (echo.lpr). +The FCGI application must be running in order for this demo to work (external +FCGI server setup). Do not forget to restart it after changes and +recompilation. +Also, mod_fastcgi is not the same as mod_fcgid that the Apache project is +developing. The latter does not support external FCGI server apps. +There are other ways than external FCGI server apps to handle the FCGI +protocol and both mod_fastcgi and mod_fcgid supports that. However, external +FCGI servers are the best for debugging and development, that is why the +examples do it that way. diff --git a/packages/fcl-web/examples/helloworld/apache/helloworld.lpi b/packages/fcl-web/examples/helloworld/apache/helloworld.lpi new file mode 100644 index 0000000000..9daa75204d --- /dev/null +++ b/packages/fcl-web/examples/helloworld/apache/helloworld.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="helloworld.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="helloworld"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Linking> + <Options> + <ExecutableType Value="Library"/> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/helloworld/apache/helloworld.lpr b/packages/fcl-web/examples/helloworld/apache/helloworld.lpr new file mode 100644 index 0000000000..ee43ea56c7 --- /dev/null +++ b/packages/fcl-web/examples/helloworld/apache/helloworld.lpr @@ -0,0 +1,37 @@ +Library helloworld; + +{$mode objfpc}{$H+} + +Uses +{$ifdef unix} + cthreads, +{$endif} + httpd,fpApache, webmodule; + +Const + +{ The following constant is used to export the module record. It must + always match the name in the LoadModule statement in the apache + configuration file(s). It is case sensitive !} + ModuleName='mod_helloworld'; + +{ The following constant is used to determine whether the module will + handle a request. It should match the name in the SetHandler statement + in the apache configuration file(s). It is not case sensitive. } + + HandlerName=ModuleName; + +Var + DefaultModule : module; {$ifdef unix} public name ModuleName;{$endif unix} + +Exports defaultmodule name ModuleName; + +{$R *.res} + +begin + Application.ModuleName:=ModuleName; + Application.HandlerName:=HandlerName; + Application.SetModuleRecord(DefaultModule); + Application.Initialize; +end. + diff --git a/packages/fcl-web/examples/helloworld/apache/helloworld.res b/packages/fcl-web/examples/helloworld/apache/helloworld.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/helloworld/apache/helloworld.res diff --git a/packages/fcl-web/examples/helloworld/cgi/helloworld.lpi b/packages/fcl-web/examples/helloworld/cgi/helloworld.lpi new file mode 100644 index 0000000000..d5a3dcf498 --- /dev/null +++ b/packages/fcl-web/examples/helloworld/cgi/helloworld.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="helloworld.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="helloworld"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/helloworld/cgi/helloworld.lpr b/packages/fcl-web/examples/helloworld/cgi/helloworld.lpr new file mode 100644 index 0000000000..c96eeae683 --- /dev/null +++ b/packages/fcl-web/examples/helloworld/cgi/helloworld.lpr @@ -0,0 +1,14 @@ +program helloworld; + +{$mode objfpc}{$H+} + +uses + fpCGI, webmodule; + +{$R *.res} + +begin + Application.Initialize; + Application.Run; +end. + diff --git a/packages/fcl-web/examples/helloworld/cgi/helloworld.res b/packages/fcl-web/examples/helloworld/cgi/helloworld.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/helloworld/cgi/helloworld.res diff --git a/packages/fcl-web/examples/helloworld/fcgi/helloworld.lpi b/packages/fcl-web/examples/helloworld/fcgi/helloworld.lpi new file mode 100644 index 0000000000..d5a3dcf498 --- /dev/null +++ b/packages/fcl-web/examples/helloworld/fcgi/helloworld.lpi @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <PathDelim Value="\"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <MainUnitHasCreateFormStatements Value="False"/> + <Runnable Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="helloworld.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="helloworld"/> + </Unit0> + <Unit1> + <Filename Value="..\webmodule\webmodule.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FPWebModule1"/> + <ResourceBaseClass Value="DataModule"/> + <UnitName Value="webmodule"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + </SearchPaths> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/helloworld/fcgi/helloworld.lpr b/packages/fcl-web/examples/helloworld/fcgi/helloworld.lpr new file mode 100644 index 0000000000..9d5080ffc4 --- /dev/null +++ b/packages/fcl-web/examples/helloworld/fcgi/helloworld.lpr @@ -0,0 +1,15 @@ +program helloworld; + +{$mode objfpc}{$H+} + +uses + fpFCGI, webmodule; + +{$R *.res} + +begin + Application.Port:=2015; + Application.Initialize; + Application.Run; +end. + diff --git a/packages/fcl-web/examples/helloworld/fcgi/helloworld.res b/packages/fcl-web/examples/helloworld/fcgi/helloworld.res Binary files differnew file mode 100644 index 0000000000..e66ecf85fe --- /dev/null +++ b/packages/fcl-web/examples/helloworld/fcgi/helloworld.res diff --git a/packages/fcl-web/examples/helloworld/webmodule/webmodule.lfm b/packages/fcl-web/examples/helloworld/webmodule/webmodule.lfm new file mode 100644 index 0000000000..4bd064361e --- /dev/null +++ b/packages/fcl-web/examples/helloworld/webmodule/webmodule.lfm @@ -0,0 +1,15 @@ +object FPWebModule1: TFPWebModule1 + OldCreateOrder = False + Actions = < + item + Name = 'func1call' + Default = False + OnRequest = func1callRequest + Template.AllowTagParams = False + end> + CreateSession = False + Height = 265 + HorizontalOffset = 234 + VerticalOffset = 156 + Width = 274 +end diff --git a/packages/fcl-web/examples/helloworld/webmodule/webmodule.pas b/packages/fcl-web/examples/helloworld/webmodule/webmodule.pas new file mode 100644 index 0000000000..1a5f746800 --- /dev/null +++ b/packages/fcl-web/examples/helloworld/webmodule/webmodule.pas @@ -0,0 +1,43 @@ +unit webmodule; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, HTTPDefs, fpHTTP, fpWeb; + +type + + { TFPWebModule1 } + + TFPWebModule1 = class(TFPWebModule) + procedure func1callRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + private + { private declarations } + public + { public declarations } + end; + +var + FPWebModule1: TFPWebModule1; + +implementation + +{$R *.lfm} + +{ TFPWebModule1 } + +procedure TFPWebModule1.func1callRequest(Sender: TObject; + ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); +begin + AResponse.Content := '<html><body>Hello World!</body></html>'; + + Handled := true; +end; + +initialization + RegisterHTTPModule('TFPWebModule1', TFPWebModule1); +end. + diff --git a/packages/fcl-web/examples/httpapp/testhttp.lpi b/packages/fcl-web/examples/httpapp/testhttp.lpi new file mode 100644 index 0000000000..e8a9de58dc --- /dev/null +++ b/packages/fcl-web/examples/httpapp/testhttp.lpi @@ -0,0 +1,311 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <UseDefaultCompilerOptions Value="True"/> + </Flags> + <MainUnit Value="0"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + <ActiveWindowIndexAtStart Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1" Active="Default"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <Units Count="12"> + <Unit0> + <Filename Value="testhttp.pp"/> + <IsPartOfProject Value="True"/> + <UnitName Value="testhttp"/> + <EditorIndex Value="0"/> + <WindowIndex Value="0"/> + <TopLine Value="1"/> + <CursorPos X="16" Y="5"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="fpwebfile.pp"/> + <UnitName Value="fpwebfile"/> + <EditorIndex Value="10"/> + <WindowIndex Value="0"/> + <TopLine Value="8"/> + <CursorPos X="22" Y="14"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit1> + <Unit2> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/fphttp.pp"/> + <UnitName Value="fphttp"/> + <EditorIndex Value="11"/> + <WindowIndex Value="0"/> + <TopLine Value="188"/> + <CursorPos X="1" Y="196"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit2> + <Unit3> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/fphttpapp.pp"/> + <UnitName Value="fphttpapp"/> + <EditorIndex Value="6"/> + <WindowIndex Value="0"/> + <TopLine Value="14"/> + <CursorPos X="31" Y="20"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit3> + <Unit4> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/custhttpapp.pp"/> + <UnitName Value="custhttpapp"/> + <EditorIndex Value="7"/> + <WindowIndex Value="0"/> + <TopLine Value="35"/> + <CursorPos X="30" Y="39"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit4> + <Unit5> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/fphttpserver.pp"/> + <UnitName Value="fphttpserver"/> + <EditorIndex Value="8"/> + <WindowIndex Value="0"/> + <TopLine Value="18"/> + <CursorPos X="24" Y="39"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit5> + <Unit6> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/httpdefs.pp"/> + <UnitName Value="HTTPDefs"/> + <EditorIndex Value="9"/> + <WindowIndex Value="0"/> + <TopLine Value="1005"/> + <CursorPos X="42" Y="1038"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit6> + <Unit7> + <Filename Value="../../../../../projects/lazarus/components/fpweb/reglazwebextra.pp"/> + <UnitName Value="reglazwebextra"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <WindowIndex Value="0"/> + <TopLine Value="218"/> + <CursorPos X="29" Y="235"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit7> + <Unit8> + <Filename Value="../../../../../projects/lazarus/components/fpweb/weblazideintf.pp"/> + <UnitName Value="WebLazIDEIntf"/> + <EditorIndex Value="5"/> + <WindowIndex Value="0"/> + <TopLine Value="623"/> + <CursorPos X="1" Y="642"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit8> + <Unit9> + <Filename Value="../../../../../projects/lazarus/components/fpweb/frmnewhttpapp.pp"/> + <ComponentName Value="NewHTTPApplicationForm"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="frmnewhttpapp"/> + <EditorIndex Value="3"/> + <WindowIndex Value="0"/> + <TopLine Value="25"/> + <CursorPos X="34" Y="104"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + </Unit9> + <Unit10> + <Filename Value="../../../../../projects/lazarus/components/fpweb/fpwebstrconsts.pas"/> + <UnitName Value="fpWebStrConsts"/> + <EditorIndex Value="4"/> + <WindowIndex Value="0"/> + <TopLine Value="92"/> + <CursorPos X="22" Y="121"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit10> + <Unit11> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/webdata/fpwebdata.pp"/> + <UnitName Value="fpwebdata"/> + <EditorIndex Value="2"/> + <WindowIndex Value="0"/> + <TopLine Value="1"/> + <CursorPos X="14" Y="15"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit11> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="testhttp.pp"/> + <Caret Line="23" Column="3" TopLine="1"/> + </Position1> + <Position2> + <Filename Value="testhttp.pp"/> + <Caret Line="8" Column="44" TopLine="1"/> + </Position2> + <Position3> + <Filename Value="fpwebfile.pp"/> + <Caret Line="1" Column="1" TopLine="1"/> + </Position3> + <Position4> + <Filename Value="testhttp.pp"/> + <Caret Line="29" Column="44" TopLine="1"/> + </Position4> + <Position5> + <Filename Value="fpwebfile.pp"/> + <Caret Line="63" Column="22" TopLine="48"/> + </Position5> + <Position6> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/custhttpapp.pp"/> + <Caret Line="39" Column="30" TopLine="35"/> + </Position6> + <Position7> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/fphttpserver.pp"/> + <Caret Line="35" Column="38" TopLine="18"/> + </Position7> + <Position8> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/httpdefs.pp"/> + <Caret Line="623" Column="33" TopLine="613"/> + </Position8> + <Position9> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/httpdefs.pp"/> + <Caret Line="1012" Column="7" TopLine="1009"/> + </Position9> + <Position10> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/httpdefs.pp"/> + <Caret Line="281" Column="71" TopLine="263"/> + </Position10> + <Position11> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/httpdefs.pp"/> + <Caret Line="1014" Column="21" TopLine="1010"/> + </Position11> + <Position12> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/base/httpdefs.pp"/> + <Caret Line="660" Column="21" TopLine="627"/> + </Position12> + <Position13> + <Filename Value="fpwebfile.pp"/> + <Caret Line="77" Column="60" TopLine="48"/> + </Position13> + <Position14> + <Filename Value="../../../../../projects/lazarus/components/fpweb/reglazwebextra.pp"/> + <Caret Line="86" Column="29" TopLine="58"/> + </Position14> + <Position15> + <Filename Value="../../../../../projects/lazarus/components/fpweb/weblazideintf.pp"/> + <Caret Line="549" Column="14" TopLine="547"/> + </Position15> + <Position16> + <Filename Value="../../../../../projects/lazarus/components/fpweb/frmnewhttpapp.pp"/> + <Caret Line="54" Column="17" TopLine="36"/> + </Position16> + <Position17> + <Filename Value="../../../../../projects/lazarus/components/fpweb/frmnewhttpapp.pp"/> + <Caret Line="41" Column="20" TopLine="41"/> + </Position17> + <Position18> + <Filename Value="../../../../../projects/lazarus/components/fpweb/frmnewhttpapp.pp"/> + <Caret Line="27" Column="29" TopLine="1"/> + </Position18> + <Position19> + <Filename Value="../../../../../projects/lazarus/components/fpweb/reglazwebextra.pp"/> + <Caret Line="93" Column="28" TopLine="76"/> + </Position19> + <Position20> + <Filename Value="../../../../../projects/lazarus/components/fpweb/frmnewhttpapp.pp"/> + <Caret Line="39" Column="43" TopLine="21"/> + </Position20> + <Position21> + <Filename Value="../../../../../projects/lazarus/components/fpweb/frmnewhttpapp.pp"/> + <Caret Line="97" Column="29" TopLine="68"/> + </Position21> + <Position22> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/webdata/fpwebdata.pp"/> + <Caret Line="1" Column="1" TopLine="1"/> + </Position22> + <Position23> + <Filename Value="../../../../../FPC/trunk/packages/fcl-web/src/webdata/fpwebdata.pp"/> + <Caret Line="15" Column="14" TopLine="1"/> + </Position23> + <Position24> + <Filename Value="../../../../../projects/lazarus/components/fpweb/reglazwebextra.pp"/> + <Caret Line="203" Column="23" TopLine="184"/> + </Position24> + <Position25> + <Filename Value="../../../../../projects/lazarus/components/fpweb/frmnewhttpapp.pp"/> + <Caret Line="66" Column="10" TopLine="59"/> + </Position25> + <Position26> + <Filename Value="../../../../../projects/lazarus/components/fpweb/frmnewhttpapp.pp"/> + <Caret Line="71" Column="24" TopLine="39"/> + </Position26> + <Position27> + <Filename Value="../../../../../projects/lazarus/components/fpweb/frmnewhttpapp.pp"/> + <Caret Line="75" Column="18" TopLine="58"/> + </Position27> + <Position28> + <Filename Value="../../../../../projects/lazarus/components/fpweb/reglazwebextra.pp"/> + <Caret Line="111" Column="66" TopLine="95"/> + </Position28> + <Position29> + <Filename Value="../../../../../projects/lazarus/components/fpweb/reglazwebextra.pp"/> + <Caret Line="186" Column="15" TopLine="160"/> + </Position29> + <Position30> + <Filename Value="../../../../../projects/lazarus/components/fpweb/reglazwebextra.pp"/> + <Caret Line="200" Column="3" TopLine="184"/> + </Position30> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="10"/> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/packages/fcl-web/examples/httpapp/testhttp.pp b/packages/fcl-web/examples/httpapp/testhttp.pp new file mode 100644 index 0000000000..479588df47 --- /dev/null +++ b/packages/fcl-web/examples/httpapp/testhttp.pp @@ -0,0 +1,31 @@ +{$mode objfpc} +{$H+} +program testhttp; + +uses + SysUtils, fphttpapp, fpwebfile; + +Procedure Usage; + +begin + Writeln('Usage : testhttp DocumentRoot [Port]'); + Writeln('Where'); + Writeln(' Documentroot location to serve files from. It is mapped to location /files'); + Writeln(' Port port to listen on (default 8080)'); + Halt(1); +end; + +begin + if (ParamCount<1) or (ParamCount>2) then + usage; + if (ParamCount=2) and (StrToIntDef(ParamStr(2),-1)=-1) then + usage; + RegisterFileLocation('files',ParamStr(1)); +{$ifdef unix} + MimeTypesFile:='/etc/mime.types'; +{$endif} + Application.Initialize; + Application.Port:=StrTointDef(ParamStr(2),8080); + Application.Title:='HTTP Demo application'; + Application.Run; +end. diff --git a/packages/fcl-web/examples/jsonrpc/demo1/demo.lpi b/packages/fcl-web/examples/jsonrpc/demo1/demo.lpi index f799e0bd88..8517a1ddf6 100644 --- a/packages/fcl-web/examples/jsonrpc/demo1/demo.lpi +++ b/packages/fcl-web/examples/jsonrpc/demo1/demo.lpi @@ -1,25 +1,27 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <Version Value="7"/> + <Version Value="9"/> <General> <Flags> + <SaveOnlyProjectUnits Value="True"/> <MainUnitHasCreateFormStatements Value="False"/> <Runnable Value="False"/> </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <TargetFileExt Value=""/> <Title Value="FPC JSON-RPC demo "/> <ResourceType Value="res"/> <UseXPManifest Value="True"/> - <Icon Value="0"/> </General> <VersionInfo> <Language Value=""/> <CharSet Value=""/> - <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/> + <StringTable ProductVersion=""/> </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="default" Default="True"/> + </BuildModes> <PublishOptions> <Version Value="2"/> <IgnoreBinaries Value="False"/> @@ -59,21 +61,19 @@ </Units> </ProjectOptions> <CompilerOptions> - <Version Value="8"/> + <Version Value="10"/> <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)/"/> + <IncludeFiles Value="$(ProjOutDir)"/> </SearchPaths> - <Parsing> - <SyntaxOptions> - <UseAnsiStrings Value="True"/> - </SyntaxOptions> - </Parsing> <Linking> <Debugging> <UseHeaptrc Value="True"/> </Debugging> </Linking> <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> <CompilerPath Value="$(CompPath)"/> </Other> </CompilerOptions> diff --git a/packages/fcl-web/examples/jsonrpc/demo1/demo.lpr b/packages/fcl-web/examples/jsonrpc/demo1/demo.lpr index de1a7daf3d..0b2bc9287c 100644 --- a/packages/fcl-web/examples/jsonrpc/demo1/demo.lpr +++ b/packages/fcl-web/examples/jsonrpc/demo1/demo.lpr @@ -8,8 +8,10 @@ uses // {$R *.res} +{$R *.res} + begin - Application.Title:='FPC JSON-RPC demo'; + Application.Title:='FPC JSON-RPC demo '; Application.Initialize; Application.Run; end. diff --git a/packages/fcl-web/examples/jsonrpc/demo1/wmdemo.lrs b/packages/fcl-web/examples/jsonrpc/demo1/wmdemo.lrs deleted file mode 100644 index baec1d8e5c..0000000000 --- a/packages/fcl-web/examples/jsonrpc/demo1/wmdemo.lrs +++ /dev/null @@ -1,15 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TFPWebModule1','FORMDATA',[ - 'TPF0'#13'TFPWebModule1'#12'FPWebModule1'#8'OnCreate'#7#16'DataModuleCreate' - +#14'OldCreateOrder'#8#7'Actions'#14#1#4'Name'#6#6'Manual'#7'Default'#9#9'OnR' - +'equest'#7#21'TFPWebActions0Request'#0#1#4'Name'#6#8'Dispatch'#7'Default'#8#9 - +'OnRequest'#7#21'TFPWebActions1Request'#0#1#4'Name'#6#10'Registered'#7'Defau' - +'lt'#8#9'OnRequest'#7#21'TFPWebActions2Request'#0#1#4'Name'#6#9'ExtDirect'#7 - +'Default'#8#9'OnRequest'#7#21'TFPWebActions3Request'#0#1#4'Name'#6#7'Content' - +#7'Default'#8#9'OnRequest'#7#21'TFPWebActions4Request'#0#1#4'Name'#6#12'ExtD' - +'irectAPI'#7'Default'#8#9'OnRequest'#7#21'TFPWebActions5Request'#0#1#4'Name' - +#6#6'Module'#7'Default'#8#9'OnRequest'#7#21'TFPWebActions6Request'#0#0#9'Act' - +'ionVar'#6#6'Action'#13'CreateSession'#8#6'Height'#3#4#1#16'HorizontalOffset' - +#3'B'#2#14'VerticalOffset'#3'u'#1#5'Width'#3#186#1#0#0 -]); diff --git a/packages/fcl-web/examples/jsonrpc/demo1/wmdemo.pp b/packages/fcl-web/examples/jsonrpc/demo1/wmdemo.pp index 907f7a2bed..ef2db3147c 100644 --- a/packages/fcl-web/examples/jsonrpc/demo1/wmdemo.pp +++ b/packages/fcl-web/examples/jsonrpc/demo1/wmdemo.pp @@ -5,7 +5,7 @@ unit wmdemo; interface uses - Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb; + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb; type @@ -38,6 +38,8 @@ var implementation +{$R *.lfm} + Uses fpjson,jsonparser,fpjsonrpc,webjsonrpc, fpextdirect; { TFPWebModule1 } @@ -376,8 +378,6 @@ begin end; initialization - {$I wmdemo.lrs} - RegisterHTTPModule('echo', TFPWebModule1); end. diff --git a/packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi b/packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi index 5ff3e6c5a7..7218afa0a9 100644 --- a/packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi +++ b/packages/fcl-web/examples/jsonrpc/extdirect/extdemo.lpi @@ -1,25 +1,27 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <Version Value="7"/> + <Version Value="9"/> <General> <Flags> + <SaveOnlyProjectUnits Value="True"/> <MainUnitHasCreateFormStatements Value="False"/> <Runnable Value="False"/> </Flags> + <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <TargetFileExt Value=""/> <Title Value="Ext.Direct demo application"/> <ResourceType Value="res"/> <UseXPManifest Value="True"/> - <Icon Value="0"/> - <ActiveWindowIndexAtStart Value="0"/> </General> <VersionInfo> <Language Value=""/> <CharSet Value=""/> - <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/> + <StringTable ProductVersion=""/> </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="default" Default="True"/> + </BuildModes> <PublishOptions> <Version Value="2"/> <IgnoreBinaries Value="False"/> @@ -47,201 +49,33 @@ <PackageName Value="FCL"/> </Item4> </RequiredPackages> - <Units Count="12"> + <Units Count="2"> <Unit0> <Filename Value="extdemo.lpr"/> <IsPartOfProject Value="True"/> <UnitName Value="extdemo"/> - <EditorIndex Value="1"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="7" Y="6"/> - <UsageCount Value="24"/> - <Loaded Value="True"/> </Unit0> <Unit1> - <Filename Value="wmdemo.pp"/> - <ComponentName Value="FPWebModule1"/> - <ResourceBaseClass Value="DataModule"/> - <UnitName Value="wmdemo"/> - <EditorIndex Value="0"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="21" Y="28"/> - <UsageCount Value="24"/> - <Loaded Value="True"/> - </Unit1> - <Unit2> <Filename Value="wmext.pp"/> <IsPartOfProject Value="True"/> <ComponentName Value="DemoClass"/> <ResourceBaseClass Value="DataModule"/> <UnitName Value="wmext"/> - <EditorIndex Value="6"/> - <WindowIndex Value="0"/> - <TopLine Value="3"/> - <CursorPos X="22" Y="48"/> - <UsageCount Value="24"/> - <Loaded Value="True"/> - </Unit2> - <Unit3> - <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/> - <UnitName Value="fpextdirect"/> - <IsVisibleTab Value="True"/> - <EditorIndex Value="7"/> - <WindowIndex Value="0"/> - <TopLine Value="185"/> - <CursorPos X="49" Y="196"/> - <UsageCount Value="12"/> - <Loaded Value="True"/> - </Unit3> - <Unit4> - <Filename Value="../../../src/jsonrpc/fpjsonrpc.pp"/> - <UnitName Value="fpjsonrpc"/> - <WindowIndex Value="0"/> - <TopLine Value="432"/> - <CursorPos X="6" Y="441"/> - <UsageCount Value="10"/> - </Unit4> - <Unit5> - <Filename Value="../../../../../lazarus/components/fpweb/reglazwebextra.pp"/> - <UnitName Value="reglazwebextra"/> - <EditorIndex Value="10"/> - <WindowIndex Value="0"/> - <TopLine Value="67"/> - <CursorPos X="56" Y="81"/> - <UsageCount Value="12"/> - <Loaded Value="True"/> - </Unit5> - <Unit6> - <Filename Value="wmext.lrs"/> - <EditorIndex Value="9"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="1" Y="9"/> - <UsageCount Value="12"/> - <Loaded Value="True"/> - </Unit6> - <Unit7> - <Filename Value="../../../src/base/fpcgi.pp"/> - <UnitName Value="fpcgi"/> - <EditorIndex Value="2"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="26" Y="20"/> - <UsageCount Value="12"/> - <Loaded Value="True"/> - </Unit7> - <Unit8> - <Filename Value="../../../src/base/custcgi.pp"/> - <UnitName Value="custcgi"/> - <EditorIndex Value="3"/> - <WindowIndex Value="0"/> - <TopLine Value="24"/> - <CursorPos X="33" Y="24"/> - <UsageCount Value="12"/> - <Loaded Value="True"/> - </Unit8> - <Unit9> - <Filename Value="../../../src/base/httpdefs.pp"/> - <UnitName Value="HTTPDefs"/> - <EditorIndex Value="4"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="26" Y="38"/> - <UsageCount Value="12"/> - <Loaded Value="True"/> - </Unit9> - <Unit10> - <Filename Value="../../../src/base/custweb.pp"/> - <UnitName Value="custweb"/> - <EditorIndex Value="5"/> - <WindowIndex Value="0"/> - <TopLine Value="221"/> - <CursorPos X="17" Y="265"/> - <UsageCount Value="12"/> - <Loaded Value="True"/> - </Unit10> - <Unit11> - <Filename Value="../../../src/jsonrpc/webjsonrpc.pp"/> - <UnitName Value="webjsonrpc"/> - <EditorIndex Value="8"/> - <WindowIndex Value="0"/> - <TopLine Value="29"/> - <CursorPos X="27" Y="29"/> - <UsageCount Value="11"/> - <Loaded Value="True"/> - </Unit11> + </Unit1> </Units> - <JumpHistory Count="13" HistoryIndex="12"> - <Position1> - <Filename Value="../../../../../lazarus/components/fpweb/reglazwebextra.pp"/> - <Caret Line="1" Column="1" TopLine="1"/> - </Position1> - <Position2> - <Filename Value="extdemo.lpr"/> - <Caret Line="1" Column="1" TopLine="1"/> - </Position2> - <Position3> - <Filename Value="extdemo.lpr"/> - <Caret Line="11" Column="1" TopLine="1"/> - </Position3> - <Position4> - <Filename Value="wmext.pp"/> - <Caret Line="6" Column="18" TopLine="2"/> - </Position4> - <Position5> - <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/> - <Caret Line="376" Column="36" TopLine="370"/> - </Position5> - <Position6> - <Filename Value="../../../src/base/httpdefs.pp"/> - <Caret Line="1" Column="1" TopLine="1"/> - </Position6> - <Position7> - <Filename Value="../../../src/base/httpdefs.pp"/> - <Caret Line="936" Column="3" TopLine="929"/> - </Position7> - <Position8> - <Filename Value="../../../src/base/custweb.pp"/> - <Caret Line="1" Column="1" TopLine="1"/> - </Position8> - <Position9> - <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/> - <Caret Line="397" Column="17" TopLine="368"/> - </Position9> - <Position10> - <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/> - <Caret Line="29" Column="1" TopLine="26"/> - </Position10> - <Position11> - <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/> - <Caret Line="398" Column="16" TopLine="373"/> - </Position11> - <Position12> - <Filename Value="../../../src/jsonrpc/fpextdirect.pp"/> - <Caret Line="413" Column="21" TopLine="379"/> - </Position12> - <Position13> - <Filename Value="../../../src/jsonrpc/webjsonrpc.pp"/> - <Caret Line="66" Column="14" TopLine="41"/> - </Position13> - </JumpHistory> </ProjectOptions> <CompilerOptions> - <Version Value="8"/> + <Version Value="10"/> <Target> <Filename Value="extdemo.cgi"/> </Target> <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)/"/> + <IncludeFiles Value="$(ProjOutDir)"/> </SearchPaths> - <Parsing> - <SyntaxOptions> - <UseAnsiStrings Value="True"/> - </SyntaxOptions> - </Parsing> <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> <CompilerPath Value="$(CompPath)"/> </Other> </CompilerOptions> diff --git a/packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs b/packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs deleted file mode 100644 index 18013d4c89..0000000000 --- a/packages/fcl-web/examples/jsonrpc/extdirect/wmext.lrs +++ /dev/null @@ -1,10 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TDemoClass','FORMDATA',[ - 'TPF0'#10'TDemoClass'#9'DemoClass'#14'OldCreateOrder'#8#7'APIPath'#6#3'API'#10 - +'RouterPath'#6#6'Router'#6'Height'#3'9'#1#16'HorizontalOffset'#3'$'#2#14'Ver' - +'ticalOffset'#3#230#0#5'Width'#3'g'#1#0#15'TJSONRPCHandler'#3'Add'#9'OnExecu' - +'te'#7#10'AddExecute'#7'Options'#11#0#9'ParamDefs'#14#1#4'Name'#6#1'A'#8'Dat' - +'aType'#7#8'jtNumber'#0#1#4'Name'#6#1'B'#8'DataType'#7#8'jtNumber'#0#0#4'lef' - +'t'#2'8'#3'top'#2' '#0#0#0 -]); diff --git a/packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp b/packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp index 0d5c57a53a..dba3e0b465 100644 --- a/packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp +++ b/packages/fcl-web/examples/jsonrpc/extdirect/wmext.pp @@ -5,7 +5,7 @@ unit wmext; interface uses - Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb, + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb, fpjsonrpc, webjsonrpc, fpextdirect, fpjson; type @@ -27,6 +27,8 @@ var implementation +{$R *.lfm} + { TDemoClass } procedure TDemoClass.AddExecute(Sender: TObject; @@ -45,8 +47,6 @@ begin end; initialization - {$I wmext.lrs} - RegisterHTTPModule('demo', TDemoClass); end. diff --git a/packages/fcl-web/examples/session/sessiondemo.lpi b/packages/fcl-web/examples/session/sessiondemo.lpi new file mode 100644 index 0000000000..129c890a84 --- /dev/null +++ b/packages/fcl-web/examples/session/sessiondemo.lpi @@ -0,0 +1,53 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="7"/> + <General> + <Flags> + <LRSInOutputDirectory Value="False"/> + </Flags> + <SessionStorage Value="InIDEConfig"/> + <MainUnit Value="0"/> + <TargetFileExt Value=""/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="WebLaz"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="sessiondemo.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="sessiondemo"/> + </Unit0> + <Unit1> + <Filename Value="wmsession.pp"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SessionModule"/> + <UnitName Value="wmsession"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="8"/> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/packages/fcl-web/examples/session/sessiondemo.lpr b/packages/fcl-web/examples/session/sessiondemo.lpr new file mode 100644 index 0000000000..2b176f6045 --- /dev/null +++ b/packages/fcl-web/examples/session/sessiondemo.lpr @@ -0,0 +1,11 @@ +program sessiondemo; + +{$mode objfpc}{$H+} + +uses + fpCGI, wmsession; + +begin + Application.Initialize; + Application.Run; +end.
\ No newline at end of file diff --git a/packages/fcl-web/examples/session/wmsession.lfm b/packages/fcl-web/examples/session/wmsession.lfm new file mode 100644 index 0000000000..cd77b323ff --- /dev/null +++ b/packages/fcl-web/examples/session/wmsession.lfm @@ -0,0 +1,25 @@ +object SessionModule: TSessionModule + Actions = < + item + Name = 'NewSession' + OnRequest = NewSessionRequest + end + item + Name = 'InSession' + Default = True + OnRequest = InSessionRequest + end + item + Name = 'EndSession' + OnRequest = EndSessionRequest + end> + ActionVar = 'DemoSession' + CreateSession = True + OnNewSession = SessionModuleNewSession + left = 302 + top = 190 + Height = 0 + HorizontalOffset = 0 + VerticalOffset = 0 + Width = 0 +end diff --git a/packages/fcl-web/examples/session/wmsession.pp b/packages/fcl-web/examples/session/wmsession.pp new file mode 100644 index 0000000000..dd97fe0239 --- /dev/null +++ b/packages/fcl-web/examples/session/wmsession.pp @@ -0,0 +1,165 @@ +unit wmsession; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb; + +type + + { TSessionModule } + + TSessionModule = class(TFPWebModule) + procedure EndSessionRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + procedure InSessionRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + procedure NewSessionRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + procedure SessionModuleNewSession(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +var + SessionModule: TSessionModule; + +implementation + +{$R *.lfm} + +{ TSessionModule } + +{ + The default action is the 'InSession' action. When a new session + is started, the newsession event handler is called, and + we set the 'NewSession' action as default. +} + +procedure TSessionModule.SessionModuleNewSession(Sender: TObject); +begin + Actions.ActionByName('NewSession').Default:=True; + Actions.ActionByName('InSession').Default:=False; +end; + +{ + When a new session is detected + + - either because there was no session,in which case NewSession is the default + + - The URL contained the newsession action in the 'DemoSession' action variable, + something like: + + http://localhost/cgi-bin/sessiondemo.cgi?DemoSession=NewSession + + in either case, the NewSession action is called, and this event is triggered: +} + +procedure TSessionModule.NewSessionRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + +Var + C : TCookie; + +begin + With AResponse.Contents do + begin + Add('<HTML><TITLE>Demo session was started</TITLE><BODY>'); + Add('<H1>New session started</H1>'); + Add('A new session was started<P>.'); + If Session is TFPWebSession then + begin + C:=AResponse.Cookies.FindCookie((Session as TFPWebSession).SessionCookie); + If Assigned(C) then + begin + Add('The issued session cookie is called <B>'+C.Name+'</B><BR> '); + Add('The issued session cookie has value <B>'+C.Value+'</B><BR>.'); + end + else + Add('No session cookie was found.'); + end; + Add('</BODY></HTML>'); + end; + Handled:=True; // Content will be sent. +end; + +{ + The default action is the 'InSession' action. + We display the session cookie, and the value (name 'Var') + that is currently stored in the session object. + + If the user supplied a new value for 'var', we store it in the session. + to supply the value, append + ?var=value + to the URL. +} + +procedure TSessionModule.InSessionRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); + +Var + V : string; + C : TCookie; + +begin + With AResponse.Contents do + begin + Add('<HTML><TITLE>Demo session active</TITLE><BODY>'); + Add('<H1>Demo session active</H1>'); + Add('The demo session is still active<P>'); + If Session is TFPWebSession then + begin + C:=AResponse.Cookies.FindCookie((Session as TFPWebSession).SessionCookie); + If Assigned(C) then + begin + Add('Current session Cookie is called <B>'+C.Name+'</B><BR>'); + Add('and has value <B>'+C.Value+'</B>.'); + end; + V:=Session.Variables['Var']; + If (V<>'') then + Add('<P>Stored session value: <B>'+V+'</B>.') + else + Add('<P>No values stored in session.'); + V:=ARequest.QueryFields.Values['Var']; + If V<>'' then + begin + Add('<P>Storing new session value: <B>'+V+'</B>.'); + Session.Variables['Var']:=V; + end; + end; + Add('</BODY></HTML>'); + AResponse.SendContent; // Handles the response. + end; +end; + + +{ + When the 'EndSession' action is called, the session is ended. The + endsession action can be called by providing the 'EndSession' value for + the 'DemoSession' action variable, something like: + + http://localhost/cgi-bin/sessiondemo.cgi?DemoSession=EndSession +} +procedure TSessionModule.EndSessionRequest(Sender: TObject; ARequest: TRequest; + AResponse: TResponse; var Handled: Boolean); +begin + // Stop the session + Session.Terminate; + With AResponse.Contents do + begin + Add('<HTML><TITLE>Demo Session Is Terminated</TITLE><BODY>'); + Add('<H1>Demo session Terminated</H1>'); + Add('The session was terminated, the cookie is cleared and the'); + Add('stored value is lost'); + Add('</BODY></HTML>'); + end; + AResponse.SendContent; +end; + +initialization + RegisterHTTPModule('session', TSessionModule); +end. diff --git a/packages/fcl-web/examples/webdata/demo/createusers.lpi b/packages/fcl-web/examples/webdata/demo/createusers.lpi index 4fd6fedf28..6e65dc69af 100644 --- a/packages/fcl-web/examples/webdata/demo/createusers.lpi +++ b/packages/fcl-web/examples/webdata/demo/createusers.lpi @@ -1,22 +1,25 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <Version Value="7"/> + <Version Value="9"/> <General> <Flags> + <SaveOnlyProjectUnits Value="True"/> <MainUnitHasCreateFormStatements Value="False"/> <MainUnitHasTitleStatement Value="False"/> </Flags> + <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <TargetFileExt Value=""/> - <Icon Value="0"/> <UseXPManifest Value="True"/> </General> <VersionInfo> - <ProjectVersion Value=""/> <Language Value=""/> <CharSet Value=""/> + <StringTable ProductVersion=""/> </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="default" Default="True"/> + </BuildModes> <PublishOptions> <Version Value="2"/> <IgnoreBinaries Value="False"/> @@ -29,35 +32,32 @@ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> </local> </RunParams> - <Units Count="2"> + <Units Count="1"> <Unit0> <Filename Value="createusers.lpr"/> <IsPartOfProject Value="True"/> <UnitName Value="createusers"/> - <CursorPos X="16" Y="35"/> - <TopLine Value="15"/> - <UsageCount Value="20"/> </Unit0> - <Unit1> - <Filename Value="../../fpc/packages/fcl-db/src/dbase/dbf.pas"/> - <UnitName Value="dbf"/> - <CursorPos X="3" Y="1477"/> - <TopLine Value="1436"/> - <UsageCount Value="10"/> - </Unit1> </Units> - <JumpHistory Count="0" HistoryIndex="-1"/> </ProjectOptions> <CompilerOptions> - <Version Value="8"/> + <Version Value="10"/> <Target> <Filename Value="createusers"/> </Target> <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)/"/> + <IncludeFiles Value="$(ProjOutDir)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> </SearchPaths> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> <CompilerPath Value="$(CompPath)"/> </Other> </CompilerOptions> diff --git a/packages/fcl-web/examples/webdata/demo/createusers.lpr b/packages/fcl-web/examples/webdata/demo/createusers.lpr index 229679c55b..b091c7f4d7 100644 --- a/packages/fcl-web/examples/webdata/demo/createusers.lpr +++ b/packages/fcl-web/examples/webdata/demo/createusers.lpr @@ -127,6 +127,8 @@ var {$IFDEF WINDOWS}{$R createusers.rc}{$ENDIF} +{$R *.res} + begin Application:=TMyApplication.Create(nil); Application.Title:='My Application'; diff --git a/packages/fcl-web/examples/webdata/demo/wmusers.lrs b/packages/fcl-web/examples/webdata/demo/wmusers.lrs deleted file mode 100644 index 1ef43fbfcb..0000000000 --- a/packages/fcl-web/examples/webdata/demo/wmusers.lrs +++ /dev/null @@ -1,12 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TFPWebModule1','FORMDATA',[ - 'TPF0'#13'TFPWebModule1'#12'FPWebModule1'#14'OldCreateOrder'#8#7'Actions'#14#1 - +#4'Name'#6#4'Read'#7'Default'#8#9'OnRequest'#7#21'TFPWebActions0Request'#0#1 - +#4'Name'#6#6'Insert'#7'Default'#8#9'OnRequest'#7#21'TFPWebActions1Request'#0 - +#1#4'Name'#6#6'Update'#7'Default'#8#9'OnRequest'#7#21'TFPWebActions2Request' - +#0#1#4'Name'#6#6'Delete'#7'Default'#8#9'OnRequest'#7#21'TFPWebActions3Reques' - +'t'#0#0#13'CreateSession'#8#6'Height'#3','#1#16'HorizontalOffset'#3#184#2#14 - +'VerticalOffset'#3'n'#1#5'Width'#3#144#1#0#4'TDbf'#4'Dbf1'#9'IndexDefs'#14#0 - +#10'TableLevel'#2#4#13'FilterOptions'#11#0#4'left'#2#23#3'top'#2'5'#0#0#0 -]); diff --git a/packages/fcl-web/examples/webdata/demo/wmusers.pp b/packages/fcl-web/examples/webdata/demo/wmusers.pp index 72aff3fb6e..ec8f16ff9d 100644 --- a/packages/fcl-web/examples/webdata/demo/wmusers.pp +++ b/packages/fcl-web/examples/webdata/demo/wmusers.pp @@ -5,7 +5,7 @@ unit wmusers; interface uses - Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb, + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb, db, dbf, fpwebdata, fpextjs,extjsjson,extjsxml; type @@ -36,6 +36,9 @@ Var ResponseFileName : String; // Set to non empty to write request responses to a file. implementation + +{$R *.lfm} + {$define wmdebug} {$ifdef wmdebug} @@ -294,8 +297,6 @@ begin end; initialization - {$I wmusers.lrs} - RegisterHTTPModule('Provider', TFPWebModule1); end. diff --git a/packages/fcl-web/examples/webdata/demo2/wmusers.lrs b/packages/fcl-web/examples/webdata/demo2/wmusers.lrs deleted file mode 100644 index d84ec9ea08..0000000000 --- a/packages/fcl-web/examples/webdata/demo2/wmusers.lrs +++ /dev/null @@ -1,18 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TFPWebModule1','FORMDATA',[ - 'TPF0'#13'TFPWebModule1'#12'FPWebModule1'#8'OnCreate'#7#16'DataModuleCreate' - +#14'OldCreateOrder'#8#7'Actions'#14#0#9'OnRequest'#7#17'DataModuleRequest'#13 - +'CreateSession'#8#6'Height'#3','#1#16'HorizontalOffset'#3#221#1#14'VerticalO' - +'ffset'#3'.'#1#5'Width'#3#144#1#0#4'TDbf'#4'Dbf1'#8'FilePath'#6'&/home/micha' - +'el/public_html/extjs/demo2/'#9'IndexDefs'#14#0#9'TableName'#6#9'users.dbf' - +#10'TableLevel'#2#4#13'FilterOptions'#11#0#4'left'#2'3'#3'top'#2'@'#0#0#29'T' - +'ExtJSJSonWebdataInputAdaptor'#29'ExtJSJSonWebdataInputAdaptor1'#4'left'#3 - +#146#0#3'top'#2'?'#0#0#23'TExtJSJSONDataFormatter'#23'ExtJSJSONDataFormatter' - +'1'#4'left'#3#207#0#3'top'#2'='#0#0#28'TExtJSXMLWebdataInputAdaptor'#28'ExtJ' - +'SXMLWebdataInputAdaptor1'#4'left'#3#151#0#3'top'#2'e'#0#0#22'TExtJSXMLDataF' - +'ormatter'#22'ExtJSXMLDataFormatter1'#4'left'#3#211#0#3'top'#2'd'#0#0#18'TFP' - +'WebDataProvider'#18'FPWebDataProvider1'#10'DataSource'#7#11'Datasource1'#4 - +'left'#2'i'#3'top'#2'Y'#0#0#11'TDatasource'#11'Datasource1'#7'DataSet'#7#4'D' - +'bf1'#4'left'#2'0'#3'top'#2'h'#0#0#0 -]); diff --git a/packages/fcl-web/examples/webdata/demo2/wmusers.pp b/packages/fcl-web/examples/webdata/demo2/wmusers.pp index 43537a6a1e..a72b186ca6 100644 --- a/packages/fcl-web/examples/webdata/demo2/wmusers.pp +++ b/packages/fcl-web/examples/webdata/demo2/wmusers.pp @@ -5,7 +5,7 @@ unit wmusers; interface uses - Classes, SysUtils, FileUtil, LResources, fpwebdata, extjsjson, extjsxml, + Classes, SysUtils, fpwebdata, extjsjson, extjsxml, HTTPDefs, websession, fpHTTP, fpWeb, dbf, db; type @@ -34,6 +34,8 @@ var implementation +{$R *.lfm} + uses dbugintf; { TFPWebModule1 } @@ -80,7 +82,6 @@ begin end; initialization - {$I wmusers.lrs} RegisterHTTPModule('Provider', TFPWebModule1); end. diff --git a/packages/fcl-web/examples/webdata/demo3/extgrid.lpi b/packages/fcl-web/examples/webdata/demo3/extgrid.lpi index 6c128bfc82..31cb9de8d0 100644 --- a/packages/fcl-web/examples/webdata/demo3/extgrid.lpi +++ b/packages/fcl-web/examples/webdata/demo3/extgrid.lpi @@ -1,21 +1,23 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <Version Value="7"/> + <Version Value="9"/> <General> <Flags> + <SaveOnlyProjectUnits Value="True"/> <MainUnitHasCreateFormStatements Value="False"/> <Runnable Value="False"/> </Flags> + <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <TargetFileExt Value=""/> - <Icon Value="0"/> <UseXPManifest Value="True"/> - <ActiveEditorIndexAtStart Value="3"/> </General> <VersionInfo> - <ProjectVersion Value=""/> + <StringTable ProductVersion=""/> </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="default" Default="True"/> + </BuildModes> <PublishOptions> <Version Value="2"/> <IgnoreBinaries Value="False"/> @@ -47,16 +49,11 @@ <PackageName Value="FCL"/> </Item5> </RequiredPackages> - <Units Count="16"> + <Units Count="2"> <Unit0> <Filename Value="extgrid.lpr"/> <IsPartOfProject Value="True"/> <UnitName Value="extgrid"/> - <CursorPos X="24" Y="6"/> - <TopLine Value="1"/> - <EditorIndex Value="3"/> - <UsageCount Value="21"/> - <Loaded Value="True"/> </Unit0> <Unit1> <Filename Value="wmusers.pp"/> @@ -64,257 +61,26 @@ <ComponentName Value="FPWebProviderDataModule1"/> <ResourceBaseClass Value="DataModule"/> <UnitName Value="wmusers"/> - <CursorPos X="33" Y="60"/> - <TopLine Value="27"/> - <EditorIndex Value="2"/> - <UsageCount Value="21"/> - <Loaded Value="True"/> </Unit1> - <Unit2> - <Filename Value="../demo2/wmusers.pp"/> - <ComponentName Value="FPWebModule1"/> - <HasResources Value="True"/> - <ResourceBaseClass Value="DataModule"/> - <UnitName Value="wmusers"/> - <CursorPos X="1" Y="80"/> - <TopLine Value="45"/> - <UsageCount Value="10"/> - </Unit2> - <Unit3> - <Filename Value="../fpwebdata.pp"/> - <ComponentName Value="FPWebProviderDataModule"/> - <HasResources Value="True"/> - <ResourceBaseClass Value="DataModule"/> - <UnitName Value="fpwebdata"/> - <CursorPos X="26" Y="1530"/> - <TopLine Value="1526"/> - <EditorIndex Value="4"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit3> - <Unit4> - <Filename Value="wmusers.lfm"/> - <UsageCount Value="10"/> - <SyntaxHighlighter Value="LFM"/> - </Unit4> - <Unit5> - <Filename Value="../demo/reglazwebextra.pp"/> - <UnitName Value="reglazwebextra"/> - <CursorPos X="53" Y="50"/> - <TopLine Value="34"/> - <EditorIndex Value="0"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit5> - <Unit6> - <Filename Value="../../../fpc/rtl/objpas/classes/classesh.inc"/> - <CursorPos X="17" Y="1833"/> - <TopLine Value="1812"/> - <UsageCount Value="10"/> - </Unit6> - <Unit7> - <Filename Value="../../../fpc/rtl/objpas/classes/dm.inc"/> - <CursorPos X="3" Y="18"/> - <TopLine Value="16"/> - <UsageCount Value="10"/> - </Unit7> - <Unit8> - <Filename Value="../../../fpc/packages/fcl-web/src/fphttp.pp"/> - <UnitName Value="fphttp"/> - <CursorPos X="3" Y="105"/> - <TopLine Value="108"/> - <EditorIndex Value="5"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit8> - <Unit9> - <Filename Value="../../../fpc/packages/fcl-web/src/fpweb.pp"/> - <UnitName Value="fpWeb"/> - <CursorPos X="3" Y="421"/> - <TopLine Value="419"/> - <EditorIndex Value="6"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit9> - <Unit10> - <Filename Value="../../../fpc/lazarus/components/fpweb/weblazideintf.pp"/> - <UnitName Value="WebLazIDEIntf"/> - <CursorPos X="52" Y="173"/> - <TopLine Value="145"/> - <UsageCount Value="10"/> - </Unit10> - <Unit11> - <Filename Value="../../../fpc/lazarus/components/fpweb/lazweb.pp"/> - <UnitName Value="lazweb"/> - <CursorPos X="12" Y="7"/> - <TopLine Value="1"/> - <UsageCount Value="10"/> - </Unit11> - <Unit12> - <Filename Value="tralala.pp"/> - <ComponentName Value="FPWebModule1"/> - <ResourceBaseClass Value="DataModule"/> - <UnitName Value="tralala"/> - <CursorPos X="7" Y="11"/> - <TopLine Value="1"/> - <UsageCount Value="20"/> - </Unit12> - <Unit13> - <Filename Value="../fpwebdata.lfm"/> - <CursorPos X="1" Y="1"/> - <TopLine Value="1"/> - <UsageCount Value="10"/> - <SyntaxHighlighter Value="LFM"/> - </Unit13> - <Unit14> - <Filename Value="../../../fpc/packages/fcl-web/src/websession.pp"/> - <UnitName Value="websession"/> - <CursorPos X="20" Y="40"/> - <TopLine Value="20"/> - <EditorIndex Value="1"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit14> - <Unit15> - <Filename Value="../../../fpc/packages/fcl-xml/src/xmliconv.pas"/> - <UnitName Value="xmliconv"/> - <CursorPos X="1" Y="64"/> - <TopLine Value="37"/> - <UsageCount Value="10"/> - </Unit15> </Units> - <JumpHistory Count="30" HistoryIndex="29"> - <Position1> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="385" Column="53" TopLine="364"/> - </Position1> - <Position2> - <Filename Value="../../../fpc/packages/fcl-web/src/websession.pp"/> - <Caret Line="381" Column="25" TopLine="345"/> - </Position2> - <Position3> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="385" Column="51" TopLine="364"/> - </Position3> - <Position4> - <Filename Value="../../../fpc/packages/fcl-web/src/websession.pp"/> - <Caret Line="27" Column="39" TopLine="20"/> - </Position4> - <Position5> - <Filename Value="wmusers.pp"/> - <Caret Line="34" Column="29" TopLine="3"/> - </Position5> - <Position6> - <Filename Value="wmusers.pp"/> - <Caret Line="48" Column="45" TopLine="15"/> - </Position6> - <Position7> - <Filename Value="wmusers.pp"/> - <Caret Line="49" Column="45" TopLine="14"/> - </Position7> - <Position8> - <Filename Value="wmusers.pp"/> - <Caret Line="50" Column="45" TopLine="14"/> - </Position8> - <Position9> - <Filename Value="wmusers.pp"/> - <Caret Line="17" Column="18" TopLine="14"/> - </Position9> - <Position10> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="395" Column="32" TopLine="387"/> - </Position10> - <Position11> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1066" Column="1" TopLine="1039"/> - </Position11> - <Position12> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1624" Column="20" TopLine="1606"/> - </Position12> - <Position13> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="955" Column="46" TopLine="933"/> - </Position13> - <Position14> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="956" Column="19" TopLine="933"/> - </Position14> - <Position15> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="957" Column="16" TopLine="933"/> - </Position15> - <Position16> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="971" Column="38" TopLine="933"/> - </Position16> - <Position17> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="975" Column="77" TopLine="954"/> - </Position17> - <Position18> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="985" Column="43" TopLine="954"/> - </Position18> - <Position19> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1013" Column="66" TopLine="992"/> - </Position19> - <Position20> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1017" Column="77" TopLine="992"/> - </Position20> - <Position21> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1042" Column="62" TopLine="1013"/> - </Position21> - <Position22> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1066" Column="35" TopLine="1055"/> - </Position22> - <Position23> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1646" Column="22" TopLine="1630"/> - </Position23> - <Position24> - <Filename Value="wmusers.pp"/> - <Caret Line="15" Column="41" TopLine="1"/> - </Position24> - <Position25> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1655" Column="28" TopLine="1632"/> - </Position25> - <Position26> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1587" Column="17" TopLine="1565"/> - </Position26> - <Position27> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="414" Column="15" TopLine="393"/> - </Position27> - <Position28> - <Filename Value="extgrid.lpr"/> - <Caret Line="6" Column="36" TopLine="1"/> - </Position28> - <Position29> - <Filename Value="extgrid.lpr"/> - <Caret Line="11" Column="17" TopLine="1"/> - </Position29> - <Position30> - <Filename Value="extgrid.lpr"/> - <Caret Line="6" Column="33" TopLine="1"/> - </Position30> - </JumpHistory> </ProjectOptions> <CompilerOptions> - <Version Value="8"/> + <Version Value="10"/> <Target> <Filename Value="extgrid.cgi"/> </Target> <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)/"/> + <IncludeFiles Value="$(ProjOutDir)"/> </SearchPaths> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> <CompilerPath Value="$(CompPath)"/> </Other> </CompilerOptions> diff --git a/packages/fcl-web/examples/webdata/demo3/extgrid.lpr b/packages/fcl-web/examples/webdata/demo3/extgrid.lpr index 346296ac68..f441c3a4ff 100644 --- a/packages/fcl-web/examples/webdata/demo3/extgrid.lpr +++ b/packages/fcl-web/examples/webdata/demo3/extgrid.lpr @@ -9,6 +9,8 @@ uses {$IFDEF WINDOWS}{$R extgrid.rc}{$ENDIF} +{$R *.res} + begin Application.Initialize; Application.Run; diff --git a/packages/fcl-web/examples/webdata/demo3/tralala.lrs b/packages/fcl-web/examples/webdata/demo3/tralala.lrs deleted file mode 100644 index 6c57fc3175..0000000000 --- a/packages/fcl-web/examples/webdata/demo3/tralala.lrs +++ /dev/null @@ -1,7 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TFPWebModule1','FORMDATA',[ - 'TPF0'#13'TFPWebModule1'#12'FPWebModule1'#14'OldCreateOrder'#8#7'Actions'#14#0 - +#13'CreateSession'#8#6'Height'#3','#1#16'HorizontalOffset'#3'I'#2#14'Vertica' - +'lOffset'#3#230#0#5'Width'#3#144#1#0#0 -]); diff --git a/packages/fcl-web/examples/webdata/demo3/wmusers.lrs b/packages/fcl-web/examples/webdata/demo3/wmusers.lrs deleted file mode 100644 index 4a098b738d..0000000000 --- a/packages/fcl-web/examples/webdata/demo3/wmusers.lrs +++ /dev/null @@ -1,21 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TFPWebProviderDataModule1','FORMDATA',[ - 'TPF0'#25'TFPWebProviderDataModule1'#24'FPWebProviderDataModule1'#8'OnCreate' - +#7#16'DataModuleCreate'#14'OldCreateOrder'#8#12'InputAdaptor'#7#29'ExtJSJSon' - +'WebdataInputAdaptor1'#15'ContentProducer'#7#23'ExtJSJSONDataFormatter1'#20 - +'OnGetContentProducer'#7#28'DataModuleGetContentProducer'#17'OnGetInputAdapt' - +'or'#7#25'DataModuleGetInputAdaptor'#6'Height'#3','#1#16'HorizontalOffset'#3 - +#27#2#14'VerticalOffset'#3#191#1#5'Width'#3#144#1#0#29'TExtJSJSonWebdataInpu' - +'tAdaptor'#29'ExtJSJSonWebdataInputAdaptor1'#4'left'#3#176#0#3'top'#2'`'#0#0 - +#23'TExtJSJSONDataFormatter'#23'ExtJSJSONDataFormatter1'#13'AllowPageSize'#8 - +#4'left'#3#176#0#3'top'#3#136#0#0#0#28'TExtJSXMLWebdataInputAdaptor'#28'ExtJ' - +'SXMLWebdataInputAdaptor1'#4'left'#3#216#0#3'top'#2'`'#0#0#22'TExtJSXMLDataF' - +'ormatter'#22'ExtJSXMLDataFormatter1'#13'AllowPageSize'#8#4'left'#3#216#0#3 - +'top'#3#136#0#0#0#4'TDbf'#4'Dbf1'#8'FilePath'#6'&/home/michael/public_html/e' - +'xtjs/demo2/'#9'IndexDefs'#14#0#9'TableName'#6#9'users.dbf'#10'TableLevel'#2 - +#7#13'FilterOptions'#11#0#4'left'#2'O'#3'top'#2'\'#0#0#11'TDatasource'#11'Da' - +'tasource1'#7'DataSet'#7#4'Dbf1'#4'left'#2'L'#3'top'#3#132#0#0#0#18'TFPWebDa' - +'taProvider'#5'AName'#10'DataSource'#7#11'Datasource1'#4'left'#3#133#0#3'top' - +#2'u'#0#0#0 -]); diff --git a/packages/fcl-web/examples/webdata/demo3/wmusers.pp b/packages/fcl-web/examples/webdata/demo3/wmusers.pp index 453db4a376..ea79ccf447 100644 --- a/packages/fcl-web/examples/webdata/demo3/wmusers.pp +++ b/packages/fcl-web/examples/webdata/demo3/wmusers.pp @@ -5,7 +5,7 @@ unit wmusers; interface uses - Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb, + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb, dbf, db, fpwebdata, extjsjson, extjsxml; type @@ -36,6 +36,8 @@ var implementation +{$R *.lfm} + { TFPWebProviderDataModule1 } procedure TFPWebProviderDataModule1.DataModuleGetInputAdaptor(Sender: TObject; @@ -61,8 +63,6 @@ begin end; initialization - {$I wmusers.lrs} - RegisterHTTPModule('Provider', TFPWebProviderDataModule1); end. diff --git a/packages/fcl-web/examples/webdata/demo4/dmusers.lrs b/packages/fcl-web/examples/webdata/demo4/dmusers.lrs deleted file mode 100644 index ec24a1bc6e..0000000000 --- a/packages/fcl-web/examples/webdata/demo4/dmusers.lrs +++ /dev/null @@ -1,12 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TDataModule1','FORMDATA',[ - 'TPF0'#12'TDataModule1'#11'DataModule1'#8'OnCreate'#7#16'DataModuleCreate'#14 - +'OldCreateOrder'#8#6'Height'#3','#1#16'HorizontalOffset'#3'd'#1#14'VerticalO' - +'ffset'#3'h'#1#5'Width'#3#144#1#0#18'TFPWebDataProvider'#5'AName'#10'DataSou' - +'rce'#7#11'Datasource1'#4'left'#3#161#0#3'top'#3#145#0#0#0#11'TDatasource'#11 - +'Datasource1'#7'DataSet'#7#4'Dbf1'#4'left'#2'h'#3'top'#3#160#0#0#0#4'TDbf'#4 - +'Dbf1'#8'FilePath'#6'&/home/michael/public_html/extjs/demo2/'#9'IndexDefs'#14 - +#0#9'TableName'#6#9'users.dbf'#10'TableLevel'#2#7#13'FilterOptions'#11#0#4'l' - +'eft'#2'k'#3'top'#2'x'#0#0#0 -]); diff --git a/packages/fcl-web/examples/webdata/demo4/dmusers.pp b/packages/fcl-web/examples/webdata/demo4/dmusers.pp index 2e03d36f05..214d404fb5 100644 --- a/packages/fcl-web/examples/webdata/demo4/dmusers.pp +++ b/packages/fcl-web/examples/webdata/demo4/dmusers.pp @@ -5,8 +5,7 @@ unit dmusers; interface uses - Classes, SysUtils, FileUtil, LResources, db, dbf, - fpwebdata; + Classes, SysUtils, db, dbf, fpwebdata; type @@ -28,12 +27,12 @@ var implementation -uses dbugintf; +{$R *.lfm} + { TDataModule1 } procedure TDataModule1.DataModuleCreate(Sender: TObject); begin - senddebug('Creating datamodule 1 '+InTToStr(Ord(WebDataProviderManager.Registering))); If not WebDataProviderManager.Registering then begin DBF1.TableName:=ExtractFilePath(ParamStr(0))+'users.dbf'; @@ -45,7 +44,6 @@ begin end; initialization - {$I dmusers.lrs} WebDataProviderManager.RegisterDatamodule(TDataModule1) end. diff --git a/packages/fcl-web/examples/webdata/demo4/extgrid.lpi b/packages/fcl-web/examples/webdata/demo4/extgrid.lpi index 82498b2eb4..574cb700b3 100644 --- a/packages/fcl-web/examples/webdata/demo4/extgrid.lpi +++ b/packages/fcl-web/examples/webdata/demo4/extgrid.lpi @@ -1,23 +1,23 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <Version Value="7"/> + <Version Value="9"/> <General> <Flags> - <SaveClosedFiles Value="False"/> <SaveOnlyProjectUnits Value="True"/> <MainUnitHasCreateFormStatements Value="False"/> <Runnable Value="False"/> </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <TargetFileExt Value=""/> - <Icon Value="0"/> <UseXPManifest Value="True"/> </General> <VersionInfo> - <ProjectVersion Value=""/> + <StringTable ProductVersion=""/> </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="default" Default="True"/> + </BuildModes> <PublishOptions> <Version Value="2"/> <IgnoreBinaries Value="False"/> @@ -79,14 +79,22 @@ </Units> </ProjectOptions> <CompilerOptions> - <Version Value="8"/> + <Version Value="10"/> <Target> <Filename Value="extgrid.cgi"/> </Target> <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)/"/> + <IncludeFiles Value="$(ProjOutDir)"/> </SearchPaths> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> <CompilerPath Value="$(CompPath)"/> </Other> </CompilerOptions> diff --git a/packages/fcl-web/examples/webdata/demo4/extgrid.lpr b/packages/fcl-web/examples/webdata/demo4/extgrid.lpr index 989fed17d4..ddd87fd29d 100644 --- a/packages/fcl-web/examples/webdata/demo4/extgrid.lpr +++ b/packages/fcl-web/examples/webdata/demo4/extgrid.lpr @@ -8,6 +8,8 @@ uses {$IFDEF WINDOWS}{$R extgrid.rc}{$ENDIF} +{$R *.res} + begin Application.Initialize; Application.Run; diff --git a/packages/fcl-web/examples/webdata/demo4/wmjsonusers.lrs b/packages/fcl-web/examples/webdata/demo4/wmjsonusers.lrs deleted file mode 100644 index 19e54f1248..0000000000 --- a/packages/fcl-web/examples/webdata/demo4/wmjsonusers.lrs +++ /dev/null @@ -1,11 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TFPWebProviderDataModule1','FORMDATA',[ - 'TPF0'#25'TFPWebProviderDataModule1'#24'FPWebProviderDataModule1'#14'OldCreat' - +'eOrder'#8#12'InputAdaptor'#7#29'ExtJSJSonWebdataInputAdaptor1'#15'ContentPr' - +'oducer'#7#23'ExtJSJSONDataFormatter1'#6'Height'#3','#1#16'HorizontalOffset' - +#3'{'#2#14'VerticalOffset'#3#230#0#5'Width'#3#144#1#0#29'TExtJSJSonWebdataIn' - +'putAdaptor'#29'ExtJSJSonWebdataInputAdaptor1'#4'left'#3#204#0#3'top'#2'|'#0 - +#0#23'TExtJSJSONDataFormatter'#23'ExtJSJSONDataFormatter1'#13'AllowPageSize' - +#8#4'left'#3#204#0#3'top'#3#164#0#0#0#0 -]); diff --git a/packages/fcl-web/examples/webdata/demo4/wmjsonusers.pp b/packages/fcl-web/examples/webdata/demo4/wmjsonusers.pp index acbf88a11b..3578ccf48c 100644 --- a/packages/fcl-web/examples/webdata/demo4/wmjsonusers.pp +++ b/packages/fcl-web/examples/webdata/demo4/wmjsonusers.pp @@ -5,7 +5,7 @@ unit wmjsonusers; interface uses - Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb, + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb, fpwebdata, extjsjson; type @@ -26,9 +26,9 @@ var implementation -initialization - {$I wmjsonusers.lrs} +{$R *.lfm} +initialization RegisterHTTPModule('JSONProvider', TFPWebProviderDataModule1); end. diff --git a/packages/fcl-web/examples/webdata/demo4/wmxmlusers.lrs b/packages/fcl-web/examples/webdata/demo4/wmxmlusers.lrs deleted file mode 100644 index cf8ce3881b..0000000000 --- a/packages/fcl-web/examples/webdata/demo4/wmxmlusers.lrs +++ /dev/null @@ -1,11 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TFPWebProviderDataModule2','FORMDATA',[ - 'TPF0'#25'TFPWebProviderDataModule2'#24'FPWebProviderDataModule2'#14'OldCreat' - +'eOrder'#8#12'InputAdaptor'#7#28'ExtJSXMLWebdataInputAdaptor1'#15'ContentPro' - +'ducer'#7#22'ExtJSXMLDataFormatter1'#6'Height'#3','#1#16'HorizontalOffset'#3 - +'!'#2#14'VerticalOffset'#3#143#1#5'Width'#3#144#1#0#28'TExtJSXMLWebdataInput' - +'Adaptor'#28'ExtJSXMLWebdataInputAdaptor1'#4'left'#3#244#0#3'top'#2'|'#0#0#22 - +'TExtJSXMLDataFormatter'#22'ExtJSXMLDataFormatter1'#13'AllowPageSize'#8#4'le' - +'ft'#3#244#0#3'top'#3#164#0#0#0#0 -]); diff --git a/packages/fcl-web/examples/webdata/demo4/wmxmlusers.pp b/packages/fcl-web/examples/webdata/demo4/wmxmlusers.pp index aa82b59a08..a4cd1a2f42 100644 --- a/packages/fcl-web/examples/webdata/demo4/wmxmlusers.pp +++ b/packages/fcl-web/examples/webdata/demo4/wmxmlusers.pp @@ -5,7 +5,7 @@ unit wmxmlusers; interface uses - Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb, + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb, fpwebdata, extjsxml; type @@ -26,9 +26,9 @@ var implementation -initialization - {$I wmxmlusers.lrs} +{$R *.lfm} +initialization RegisterHTTPModule('XMLProvider', TFPWebProviderDataModule2); end. diff --git a/packages/fcl-web/examples/webdata/demo5/wmusers.lrs b/packages/fcl-web/examples/webdata/demo5/wmusers.lrs deleted file mode 100644 index 0ccbbab20d..0000000000 --- a/packages/fcl-web/examples/webdata/demo5/wmusers.lrs +++ /dev/null @@ -1,15 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TFPWebProviderDataModule2','FORMDATA',[ - 'TPF0'#25'TFPWebProviderDataModule2'#24'FPWebProviderDataModule2'#14'OldCreat' - +'eOrder'#8#12'InputAdaptor'#7#29'ExtJSJSonWebdataInputAdaptor1'#15'ContentPr' - +'oducer'#7#23'ExtJSJSONDataFormatter1'#20'OnGetContentProducer'#7#28'DataMod' - +'uleGetContentProducer'#17'OnGetInputAdaptor'#7#25'DataModuleGetInputAdaptor' - +#6'Height'#3','#1#16'HorizontalOffset'#3#26#2#14'VerticalOffset'#3#204#1#5'W' - +'idth'#3#144#1#0#29'TExtJSJSonWebdataInputAdaptor'#29'ExtJSJSonWebdataInputA' - +'daptor1'#4'left'#3#204#0#3'top'#2'|'#0#0#28'TExtJSXMLWebdataInputAdaptor'#28 - +'ExtJSXMLWebdataInputAdaptor1'#4'left'#3#244#0#3'top'#2'|'#0#0#22'TExtJSXMLD' - +'ataFormatter'#22'ExtJSXMLDataFormatter1'#13'AllowPageSize'#8#4'left'#3#244#0 - +#3'top'#3#164#0#0#0#23'TExtJSJSONDataFormatter'#23'ExtJSJSONDataFormatter1' - +#13'AllowPageSize'#8#4'left'#3#204#0#3'top'#3#164#0#0#0#0 -]); diff --git a/packages/fcl-web/examples/webdata/demo5/wmusers.pp b/packages/fcl-web/examples/webdata/demo5/wmusers.pp index a0f2883dc0..9ee1b0bd51 100644 --- a/packages/fcl-web/examples/webdata/demo5/wmusers.pp +++ b/packages/fcl-web/examples/webdata/demo5/wmusers.pp @@ -5,7 +5,7 @@ unit wmusers; interface uses - Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb, + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb, db, dbf, fpwebdata, extjsjson, extjsxml; type @@ -32,6 +32,8 @@ var implementation +{$R *.lfm} + Type { TDBFWebDataProvider } @@ -77,8 +79,6 @@ begin end; initialization - {$I wmusers.lrs} - RegisterHTTPModule('Provider', TFPWebProviderDataModule2); WebDataProviderManager.RegisterProvider('AName',TDBFWebDataProvider); end. diff --git a/packages/fcl-web/examples/webdata/demo6/extgrid.lpi b/packages/fcl-web/examples/webdata/demo6/extgrid.lpi index 6ff35389a2..3e20579de3 100644 --- a/packages/fcl-web/examples/webdata/demo6/extgrid.lpi +++ b/packages/fcl-web/examples/webdata/demo6/extgrid.lpi @@ -1,22 +1,24 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <Version Value="7"/> + <Version Value="9"/> <General> <Flags> + <SaveOnlyProjectUnits Value="True"/> <MainUnitHasCreateFormStatements Value="False"/> <Runnable Value="False"/> </Flags> + <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <TargetFileExt Value=""/> <Title Value="SQLDBWebDataProvider demo using ExtJS"/> <UseXPManifest Value="True"/> - <Icon Value="0"/> - <ActiveWindowIndexAtStart Value="0"/> </General> <VersionInfo> - <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/> + <StringTable ProductVersion=""/> </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="default" Default="True"/> + </BuildModes> <PublishOptions> <Version Value="2"/> <IgnoreBinaries Value="False"/> @@ -48,17 +50,11 @@ <PackageName Value="FCL"/> </Item5> </RequiredPackages> - <Units Count="16"> + <Units Count="2"> <Unit0> <Filename Value="extgrid.lpr"/> <IsPartOfProject Value="True"/> <UnitName Value="extgrid"/> - <EditorIndex Value="12"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="33" Y="8"/> - <UsageCount Value="20"/> - <Loaded Value="True"/> </Unit0> <Unit1> <Filename Value="wmusers.pp"/> @@ -66,283 +62,26 @@ <ComponentName Value="FPWebProviderDataModule1"/> <ResourceBaseClass Value="DataModule"/> <UnitName Value="wmusers"/> - <EditorIndex Value="0"/> - <WindowIndex Value="0"/> - <TopLine Value="78"/> - <CursorPos X="29" Y="86"/> - <UsageCount Value="20"/> - <Loaded Value="True"/> </Unit1> - <Unit2> - <Filename Value="../demo5/wmusers.pp"/> - <ComponentName Value="FPWebProviderDataModule2"/> - <HasResources Value="True"/> - <ResourceBaseClass Value="DataModule"/> - <UnitName Value="wmusers"/> - <TopLine Value="44"/> - <CursorPos X="1" Y="70"/> - <UsageCount Value="10"/> - </Unit2> - <Unit3> - <Filename Value="../fpwebdata.pp"/> - <ComponentName Value="FPWebProviderDataModule"/> - <HasResources Value="True"/> - <ResourceBaseClass Value="DataModule"/> - <UnitName Value="fpwebdata"/> - <IsVisibleTab Value="True"/> - <EditorIndex Value="1"/> - <WindowIndex Value="0"/> - <TopLine Value="1584"/> - <CursorPos X="8" Y="1600"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit3> - <Unit4> - <Filename Value="../sqldbwebdata.pp"/> - <UnitName Value="sqldbwebdata"/> - <EditorIndex Value="3"/> - <WindowIndex Value="0"/> - <TopLine Value="49"/> - <CursorPos X="2" Y="70"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit4> - <Unit5> - <Filename Value="../extjsjson.pp"/> - <UnitName Value="extjsjson"/> - <EditorIndex Value="11"/> - <WindowIndex Value="0"/> - <TopLine Value="25"/> - <CursorPos X="3" Y="45"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit5> - <Unit6> - <Filename Value="../extjsxml.pp"/> - <UnitName Value="extjsxml"/> - <EditorIndex Value="4"/> - <WindowIndex Value="0"/> - <TopLine Value="49"/> - <CursorPos X="13" Y="54"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit6> - <Unit7> - <Filename Value="../../wst/wstmodule.pas"/> - <UnitName Value="wstmodule"/> - <EditorIndex Value="5"/> - <WindowIndex Value="0"/> - <TopLine Value="25"/> - <CursorPos X="48" Y="22"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit7> - <Unit8> - <Filename Value="../../../fpc/packages/fcl-web/src/fphttp.pp"/> - <UnitName Value="fphttp"/> - <EditorIndex Value="8"/> - <WindowIndex Value="0"/> - <TopLine Value="109"/> - <CursorPos X="92" Y="100"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit8> - <Unit9> - <Filename Value="../../../fpc/packages/fcl-web/src/websession.pp"/> - <UnitName Value="websession"/> - <EditorIndex Value="10"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="3" Y="27"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit9> - <Unit10> - <Filename Value="../../../fpc/packages/fcl-web/src/httpdefs.pp"/> - <UnitName Value="HTTPDefs"/> - <EditorIndex Value="7"/> - <WindowIndex Value="0"/> - <TopLine Value="264"/> - <CursorPos X="18" Y="285"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit10> - <Unit11> - <Filename Value="../../../source/wst/tests/apache_module/wst_apache_binding.pas"/> - <UnitName Value="wst_apache_binding"/> - <TopLine Value="142"/> - <CursorPos X="1" Y="178"/> - <UsageCount Value="10"/> - </Unit11> - <Unit12> - <Filename Value="../../../fpc/packages/fcl-web/src/fpweb.pp"/> - <UnitName Value="fpWeb"/> - <EditorIndex Value="2"/> - <WindowIndex Value="0"/> - <TopLine Value="412"/> - <CursorPos X="18" Y="452"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit12> - <Unit13> - <Filename Value="../../../Documents/source/wst/wst_global.inc"/> - <TopLine Value="1"/> - <CursorPos X="30" Y="19"/> - <UsageCount Value="10"/> - </Unit13> - <Unit14> - <Filename Value="../../wst/regwstmodule.pp"/> - <UnitName Value="regwstmodule"/> - <EditorIndex Value="6"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="2" Y="1"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit14> - <Unit15> - <Filename Value="../demo/reglazwebextra.pp"/> - <UnitName Value="reglazwebextra"/> - <EditorIndex Value="9"/> - <WindowIndex Value="0"/> - <TopLine Value="37"/> - <CursorPos X="1" Y="73"/> - <UsageCount Value="10"/> - <Loaded Value="True"/> - </Unit15> </Units> - <JumpHistory Count="30" HistoryIndex="29"> - <Position1> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="135" Column="3" TopLine="115"/> - </Position1> - <Position2> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="130" Column="16" TopLine="109"/> - </Position2> - <Position3> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="148" Column="1" TopLine="127"/> - </Position3> - <Position4> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="122" Column="92" TopLine="121"/> - </Position4> - <Position5> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="137" Column="1" TopLine="122"/> - </Position5> - <Position6> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="169" Column="26" TopLine="135"/> - </Position6> - <Position7> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="34" Column="1" TopLine="1"/> - </Position7> - <Position8> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="123" Column="17" TopLine="92"/> - </Position8> - <Position9> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="128" Column="36" TopLine="104"/> - </Position9> - <Position10> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="46" Column="48" TopLine="25"/> - </Position10> - <Position11> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="147" Column="1" TopLine="126"/> - </Position11> - <Position12> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="138" Column="6" TopLine="115"/> - </Position12> - <Position13> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="150" Column="1" TopLine="137"/> - </Position13> - <Position14> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="151" Column="3" TopLine="130"/> - </Position14> - <Position15> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="15" Column="1" TopLine="1"/> - </Position15> - <Position16> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="177" Column="37" TopLine="145"/> - </Position16> - <Position17> - <Filename Value="../../wst/wstmodule.pas"/> - <Caret Line="58" Column="1" TopLine="22"/> - </Position17> - <Position18> - <Filename Value="../demo/reglazwebextra.pp"/> - <Caret Line="17" Column="15" TopLine="1"/> - </Position18> - <Position19> - <Filename Value="../../wst/regwstmodule.pp"/> - <Caret Line="55" Column="79" TopLine="16"/> - </Position19> - <Position20> - <Filename Value="../../wst/regwstmodule.pp"/> - <Caret Line="26" Column="3" TopLine="1"/> - </Position20> - <Position21> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="446" Column="14" TopLine="433"/> - </Position21> - <Position22> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="969" Column="79" TopLine="954"/> - </Position22> - <Position23> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1171" Column="41" TopLine="1154"/> - </Position23> - <Position24> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1281" Column="32" TopLine="1280"/> - </Position24> - <Position25> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1296" Column="30" TopLine="1282"/> - </Position25> - <Position26> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="327" Column="14" TopLine="324"/> - </Position26> - <Position27> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1296" Column="51" TopLine="1280"/> - </Position27> - <Position28> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1594" Column="19" TopLine="1579"/> - </Position28> - <Position29> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1606" Column="58" TopLine="1591"/> - </Position29> - <Position30> - <Filename Value="../fpwebdata.pp"/> - <Caret Line="1607" Column="1" TopLine="1592"/> - </Position30> - </JumpHistory> </ProjectOptions> <CompilerOptions> - <Version Value="8"/> + <Version Value="10"/> <Target> <Filename Value="extgrid.cgi"/> </Target> <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)/"/> + <IncludeFiles Value="$(ProjOutDir)"/> </SearchPaths> + <Parsing> + <SyntaxOptions> + <UseAnsiStrings Value="False"/> + </SyntaxOptions> + </Parsing> <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> <CompilerPath Value="$(CompPath)"/> </Other> </CompilerOptions> diff --git a/packages/fcl-web/examples/webdata/demo6/extgrid.lpr b/packages/fcl-web/examples/webdata/demo6/extgrid.lpr index c08187d081..413e6e0460 100644 --- a/packages/fcl-web/examples/webdata/demo6/extgrid.lpr +++ b/packages/fcl-web/examples/webdata/demo6/extgrid.lpr @@ -8,6 +8,8 @@ uses {$IFDEF WINDOWS}{$R extgrid.rc}{$ENDIF} +{$R *.res} + begin Application.Title:='SQLDBWebDataProvider demo using ExtJS'; Application.Initialize; diff --git a/packages/fcl-web/examples/webdata/demo6/wmusers.lrs b/packages/fcl-web/examples/webdata/demo6/wmusers.lrs deleted file mode 100644 index c5e5ae7ba4..0000000000 --- a/packages/fcl-web/examples/webdata/demo6/wmusers.lrs +++ /dev/null @@ -1,43 +0,0 @@ -{ This is an automatically generated lazarus resource file } - -LazarusResources.Add('TFPWebProviderDataModule1','FORMDATA',[ - 'TPF0'#25'TFPWebProviderDataModule1'#24'FPWebProviderDataModule1'#8'OnCreate' - +#7#16'DataModuleCreate'#14'OldCreateOrder'#8#12'InputAdaptor'#7#29'ExtJSJSon' - +'WebdataInputAdaptor1'#15'ContentProducer'#7#23'ExtJSJSONDataFormatter1'#20 - +'OnGetContentProducer'#7#28'DataModuleGetContentProducer'#17'OnGetInputAdapt' - +'or'#7#25'DataModuleGetInputAdaptor'#6'Height'#3','#1#16'HorizontalOffset'#3 - +'{'#2#14'VerticalOffset'#3#230#0#5'Width'#3#144#1#0#29'TExtJSJSonWebdataInpu' - +'tAdaptor'#29'ExtJSJSonWebdataInputAdaptor1'#4'left'#3#232#0#3'top'#3#152#0#0 - +#0#28'TExtJSXMLWebdataInputAdaptor'#28'ExtJSXMLWebdataInputAdaptor1'#4'left' - +#3#16#1#3'top'#3#152#0#0#0#22'TExtJSXMLDataFormatter'#22'ExtJSXMLDataFormatt' - +'er1'#13'AllowPageSize'#8#4'left'#3#16#1#3'top'#3#192#0#0#0#23'TExtJSJSONDat' - +'aFormatter'#23'ExtJSJSONDataFormatter1'#13'AllowPageSize'#8#4'left'#3#232#0 - +#3'top'#3#192#0#0#0#21'TSQLDBWebDataProvider'#5'ANAME'#17'SelectSQL.Strings' - +#1#6#22'SELECT * FROM FPCUSERS'#0#17'UpdateSQL.Strings'#1#6#19'UPDATE FPCUSE' - +'RS SET'#6#13' NAME=:NAME,'#6#15' LOGIN=:LOGIN,'#6#15' EMAIL=:EMAIL,'#6#22 - +' LASTLOGIN=:LASTLOGIN'#6#5'WHERE'#6#10' (ID=:ID)'#0#17'DeleteSQL.Strings' - +#1#6'#DELETE FROM FPCUSERS WHERE (ID=:ID)'#0#17'InsertSQL.Strings'#1#6#21'IN' - +'SERT INTO FPCUSERS '#6'#(ID, LOGIN, NAME, EMAIL, LASTLOGIN)'#6#6'VALUES'#6 - +'((:ID, :LOGIN, :NAME, :EMAIL, :LASTLOGIN)'#0#10'Connection'#7#13'IBConnecti' - +'on1'#11'IDFieldName'#6#2'ID'#10'OnGetNewID'#7#13'ANAMEGetNewID'#4'left'#2'q' - +#3'top'#2'x'#0#0#13'TIBConnection'#13'IBConnection1'#9'Connected'#8#11'Login' - +'Prompt'#8#12'DatabaseName'#6#26'/wisa/firebird/fpcusers.fb'#14'KeepConnecti' - +'on'#8#8'Password'#6#8'SysteemD'#11'Transaction'#7#15'SQLTransaction1'#8'Use' - +'rName'#6#8'WISASOFT'#4'left'#2'H'#3'top'#2'x'#0#0#9'TSQLQuery'#6'QGetID'#9 - +'IndexName'#6#13'DEFAULT_ORDER'#14'AutoCalcFields'#8#8'Database'#7#13'IBConn' - +'ection1'#11'Transaction'#7#15'SQLTransaction1'#8'ReadOnly'#8#11'SQL.Strings' - +#1#6'9SELECT GEN_ID(GEN_FPCUSERS,1) AS THEID FROM RDB$DATABASE'#0#6'Params' - +#14#0#4'left'#3#155#0#3'top'#2'?'#0#0#15'TSQLTransaction'#15'SQLTransaction1' - +#6'Active'#8#6'Action'#7#6'caNone'#8'Database'#7#13'IBConnection1'#4'left'#2 - +'J'#3'top'#2'@'#0#0#9'TSQLQuery'#9'SQLQuery1'#9'IndexName'#6#13'DEFAULT_ORDE' - +'R'#14'AutoCalcFields'#8#8'Database'#7#13'IBConnection1'#11'Transaction'#7#15 - +'SQLTransaction1'#8'ReadOnly'#8#11'SQL.Strings'#1#6#20'INSERT INTO FPCUSERS' - +#6'#(ID, LOGIN, NAME, EMAIL, LASTLOGIN)'#6#6'VALUES'#6'((:ID, :LOGIN, :NAME,' - +' :EMAIL, :LASTLOGIN)'#6#0#0#6'Params'#14#1#8'DataType'#7#9'ftUnknown'#4'Nam' - +'e'#6#2'ID'#9'ParamType'#7#9'ptUnknown'#0#1#8'DataType'#7#9'ftUnknown'#4'Nam' - +'e'#6#5'LOGIN'#9'ParamType'#7#9'ptUnknown'#0#1#8'DataType'#7#9'ftUnknown'#4 - +'Name'#6#4'NAME'#9'ParamType'#7#9'ptUnknown'#0#1#8'DataType'#7#9'ftUnknown'#4 - +'Name'#6#5'EMAIL'#9'ParamType'#7#9'ptUnknown'#0#1#8'DataType'#7#9'ftUnknown' - +#4'Name'#6#9'LASTLOGIN'#9'ParamType'#7#9'ptUnknown'#0#0#4'left'#3#174#0#3'to' - +'p'#2'o'#0#0#0 -]); diff --git a/packages/fcl-web/examples/webdata/demo6/wmusers.pp b/packages/fcl-web/examples/webdata/demo6/wmusers.pp index fda2f8dff9..8b5c8749ce 100644 --- a/packages/fcl-web/examples/webdata/demo6/wmusers.pp +++ b/packages/fcl-web/examples/webdata/demo6/wmusers.pp @@ -5,7 +5,7 @@ unit wmusers; interface uses - Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb, + Classes, SysUtils, HTTPDefs, websession, fpHTTP, fpWeb, IBConnection, sqldb, fpwebdata, extjsjson, extjsxml, sqldbwebdata; type @@ -39,6 +39,8 @@ var implementation +{$R *.lfm} + uses inifiles; { TFPWebProviderDataModule1 } @@ -100,8 +102,6 @@ begin end; initialization - {$I wmusers.lrs} - RegisterHTTPModule('Provider', TFPWebProviderDataModule1); end. diff --git a/packages/fcl-web/src/base/FCGI-README.txt b/packages/fcl-web/src/base/FCGI-README.txt new file mode 100644 index 0000000000..8fb475ce6c --- /dev/null +++ b/packages/fcl-web/src/base/FCGI-README.txt @@ -0,0 +1,405 @@ +FCGI-README.txt +Last modified: Attila Borka 05/31/2011 +------------------------------------------------------------------------------- +This readme will try to explain and help developers how to be able to +use the FastCGI protocol in Lazarus (package fpweb/lazweb) and FPC +(/packages/fcl-web) applications with the Apache web server. + +There are two FCGI implementations we are able to use at the moment (FPC +rev17597 /2.5.1/) with FPC/Lazarus: + +1. mod_fcgid maintained by Apache (ASF) http://httpd.apache.org/mod_fcgid/ +Easy to set up and use, Apache develops and maintains it. Just needs a +download/install and it is ready to go, even on Linux. +There are a lot of options and fine tuning that can be used, please refer to +their documentation at http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html . + +2. mod_fastcgi from http://www.fastcgi.com/ the original FCGI "inventors" +The latest downloads are available from http://www.fastcgi.com/dist/ . Do not +be alarmed if the latest one is years old. FCGI is a very stable protocol +since many years (started in 1996). +On Linux, you will need to compile the mod_fastcgi module from the source +codes, as binaries are only available for Windows as a DLL. +Note, that mod_fastcgi supports the use of External FCGI Servers, which makes +it possible to run the FCGI application from within Lazarus for example, and +be able to debug it with the GUI on the fly while it is generating the +response pages. This can be a good choice for a development environment. +The documentation is at http://www.fastcgi.com/drupal/node/6 . + + +There are benefits to use both, everyone needs to decide which one fits their +needs the best for a development environment or a live web server after some +research on these modules. + +Do not forget, that unless you use the External FCGI Server way, you need to +restart your web server every time you recompile your FCGI program. +In case you use the External FCGI Server, you need to restart the application +itself after every recompile for the changes to take effect in the web server +responses. The Apache server does not need to be restarted every time in this +latter case. + +=============================================================================== +1. mod_fcgid from Apache +1.1 on Windows +1.2 on Linux +2. mod_fastcgi from fastcgi.com +2.1 on Windows +2.1 on Linux +=============================================================================== + +1. mod_fcgid from Apache: +========================= + +1.1 mod_fcgid from Apache on Windows: +------------------------------------- +Setup Steps: +1.1.1 Download from http://httpd.apache.org/download.cgi#mod_fcgid the latest +Windows zip file and unpack as it instructs you to, over the installed Apache +directory. This puts the mod_fcgid.* files under the current /modules +directory of Apache. + +1.1.2 Now, mod_fcgid is ready to be used as soon as we load it with Apache. + +1.1.3 If you have not done so yet, compile your FCGI application. + +1.1.4 Then, edit the Apache /conf/httpd.conf file and add to the end: +############ +LoadModule fcgid_module "modules/mod_fcgid.so" +<IfModule mod_fcgid.c> + <Directory "<Path_To_Your_FCGI_application>"> + SetHandler fcgid-script +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#optionally, to shorten the URL and to not display the executable file name +#(if ScriptAlias is used, no +ExecCGI is needed above) + ScriptAlias /myfcgid "<Path_To_Your_FCGI_application>/<Your_FCGI_application>" +</IfModule> +############ +Example: +LoadModule fcgid_module "modules/mod_fcgid.so" +<IfModule mod_fcgid.c> + <Directory "C:/My Programs/LazarusFCGITest"> + SetHandler fcgid-script + Order allow,deny + Allow from all + </Directory> + ScriptAlias /myfcgid "C:/My Programs/LazarusFCGITest/helloworld.exe" +</IfModule> + +Note, there are many ways to configure the FCGI applications, this is just but +one example. You can check the Apache and mod_fcgid documentation for +alternatives. + +1.1.5 Start/Restart your Apache server so it will load your FCGI application. +If everything went according to plan, your FCGI application should be listed +in the Windows task manager as running. + +1.1.6 Open your web browser and try to call your new FCGI application. +Example: +http://127.0.0.1:8080/myfcgid/func1call +or +http://127.0.0.1/myfcgid/func1call +depending on your Apache installation and configuration. "myfcgid" is the +ScriptAlias name specified for the FCGI application, func1call is the action +name we want to call within our default web module. If you have multiple web +modules, you can enter the desired web module name before the action name, for +example: +http://127.0.0.1:8080/myfcgid/webmodule1/func1call +or +http://127.0.0.1/myfcgid/webmodule1/func1call + +If there is any problem, you can try and check the Apache error.log for clues. + + +1.2 mod_fcgid from Apache on Linux: +----------------------------------- +Setup Steps: +1.2.1 Install the mod_fcgi module for Apache with your distro's package +manager. +Example on Ubuntu: +sudo apt-get install libapache2-mod-fcgid + +This downloads, installs and configures mod_fcgid without the need to do +anything else. + +1.2.2 Now, mod_fcgid is ready to be used as soon as we load it with Apache. +mod_fcgid.so should be sitting in the /usr/lib/apache2/modules/ directory (on +Ubuntu) + +1.2.3 If you have not done so yet, compile your FCGI application. + +1.2.4 Edit the Apache configuration file (/etc/apache2/apache2.conf on Ubuntu) +and add to the end: +############ +LoadModule fcgid_module "<Path_To_Mod>/mod_fcgid.so" +<IfModule mod_fcgid.c> + <Directory "<Path_To_Your_FCGI_application>"> + SetHandler fcgid-script +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#optionally, to shorten the URL and to not display the executable file name +#(if ScriptAlias is used, no +ExecCGI is needed above) + ScriptAlias /myfcgid "<Path_To_Your_FCGI_application>/<Your_FCGI_application>" +</IfModule> +############ +Example: +LoadModule fcgid_module "/usr/lib/apache2/modules/mod_fcgid.so" +<IfModule mod_fcgid.c> + <Directory "/home/johndoe/LazarusFCGITest"> + SetHandler fcgid-script + Order allow,deny + Allow from all + </Directory> + ScriptAlias /myfcgid "/home/johndoe/LazarusFCGITest/helloworld" +</IfModule> + +(the project was compiled into directory /home/johndoe/LazarusFCGITest/ , and +the FCGI application is called helloworld with no file extension) + +Note, there are many ways to configure the FCGI applications, this is just but +one example. You can check the Apache and mod_fcgid documentation for +alternatives. + +1.2.5 Start/Restart your Apache server so it will load your FCGI application. +If everything went according to plan, and you do a "sudo netstat -l" +(on Ubuntu) from a terminal window, there should be a new line in the result +list looking something like this: +... LISTENING XXXX /var/lib/apache2/fcgid/sock/... +indicating, that the Apache mod_fcgid module has loaded your FCGI application. + +1.2.6 Open your web browser and try to call your new FCGI application. +Example: +http://127.0.0.1/myfcgid/func1call + +"myfcgid" is the ScriptAlias name specified for the FCGI application, and +func1call is the action name we want to call within our default web module. +If you have multiple web modules, you can enter the desired web module name +before the action name, for example: +http://127.0.0.1/myfcgid/webmodule1/func1call . + +If there is any problem, you can try and check the Apache error.log for clues. + + +2. mod_fastcgi from fastcgi.com: +================================ +Unlike the Apache developed mod_fcgid, mod_fastcgi has two main operating +modes for FCGI applications. One is very similar to mod_fcgid (where Apache +itself loads the FCGI application at startup), and one called External FCGI +Server mode. With this latter, Apache will not load the FCGI application at +startup, but it has to be running on its own when a web request arrives +(either as a system service/daemon, or a simple running application) and +listening. This makes it possible to run the FCGI application from within a +debugger interactively, to see/track the request handling like any normal GUI +application debugging. + +2.1 mod_fastcgi from fastcgi.com on Windows: +-------------------------------------------- +Setup Steps: +2.1.1 Download the latest SNAP or stable DLL from http://www.fastcgi.com/dist/ +and put it into the Apache /modules/ directory. + +2.1.2 If you have not done so yet, compile your FCGI application. +In case you want to set up an External FCGI Server, then you must specify a +port number in your main project file (.lpr) before the Application.Run +instruction (this is the only change needed). +Example: +<...snip...> + Application.Initialize; + Application.Port:=9999;//Port the FCGI application is listening on + Application.Run; +<...snip...> + +2.1.3 Edit the Apache /conf/httpd.conf file and add to the end: + + 2.1.3.a External FCGI Server +############ +LoadModule fastcgi_module "modules/<mod_fastcgi_DLL_name>" +<IfModule mod_fastcgi.c> + <Directory "<Path_To_Your_FCGI_application>"> +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#External FCGI app, has to be started and running when a request comes in + FastCgiExternalServer "<Path_To_Your_FCGI_application>/<Your_FCGI_application>" -host 127.0.0.1:<Port> -idle-timeout 30 -flush +#optionally, to shorten the URL and to not display the executable file name (if used, no +ExecCGI is needed above): + ScriptAlias /myfcgi "<Path_To_Your_FCGI_application>/<Your_FCGI_application>" +</IfModule> +############ +Example: +LoadModule fastcgi_module "modules/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "C:/My Programs/LazarusFCGITest"> + Order allow,deny + Allow from all + </Directory> + FastCgiExternalServer "C:/My Programs/LazarusFCGITest/helloworld.exe" -host 127.0.0.1:9999 -idle-timeout 30 -flush + ScriptAlias /myfcgi "C:/My Programs/LazarusFCGITest/helloworld.exe" +</IfModule> + + 2.1.3.b Regular FCGI Server +Replace the FastCgiExternalServer line above with + FastCgiServer "<Path_To_Your_FCGI_application>/<Your_FCGI_application>" -idle-timeout 30 + +Example: +LoadModule fastcgi_module "modules/mod_fastcgi-2.4.6-AP22.dll" +<IfModule mod_fastcgi.c> + <Directory "C:/My Programs/LazarusFCGITest"> + Order allow,deny + Allow from all + </Directory> + FastCgiServer "C:/My Programs/LazarusFCGITest/helloworld.exe" -idle-timeout 30 + ScriptAlias /myfcgi "C:/My Programs/LazarusFCGITest/helloworld.exe" +</IfModule> + +Known issues on Windows: +http://bugs.freepascal.org/view.php?id=19440 + +2.1.4 Start/Restart your Apache server. +If you will use the FastCgiExternalServer, then start your application +manually, so it can start accepting incoming requests from the web server. +If you use the FastCgiServer, then your FCGI application should be launched +by the Apache server when it starts and should be listed in the Windows task +manager as running. + +2.1.5 Open your web browser and try to call your new FCGI application. +Example: +http://127.0.0.1:8080/myfcgi/func1call +or +http://127.0.0.1/myfcgi/func1call +depending on your Apache installation and configuration. + +"myfcgi" is the ScriptAlias name specified for the FCGI application, and +func1call is the action name we want to call within our default web module. +If you have multiple web modules, you can enter the desired web module name +before the action name, for example: +http://127.0.0.1:8080/myfcgi/webmodule1/func1call +or +http://127.0.0.1/myfcgi/webmodule1/func1call + +If there is any problem, you can try and check the Apache error.log for clues. + + +2.2 mod_fastcgi from fastcgi.com on Linux: +------------------------------------------ +Setup Steps: +2.2.1 There are no binaries offered for download for Linux, so we need to get +the mod_fastcgi source codes from http://www.fastcgi.com/dist/ and compile it. + + 2.2.1.1. If the Apache development package headers are not installed, then +we need to get them first: +(on Ubuntu) +>sudo apt-get install apache2-dev + + 2.2.1.2. Get the fastcgi module sources (get the latest SNAP or highest +version stable release from http://www.fastcgi.com/dist/ ) + +>cd /home/johndoe +>wget http://www.fastcgi.com/dist/mod_fastcgi-xxxxxxxxxxx.tar.gz + +Example: wget http://www.fastcgi.com/dist/mod_fastcgi-SNAP-0910052141.tar.gz + + 2.2.1.3. Unpack the source code files. +>tar -xzf mod_fastcgi-*.tar.gz + + 2.2.1.4. Configure the makefile (we use Apache 2.2, so need the Makefile.AP2). +>cd mod_fastcgi-* +>cp Makefile.AP2 Makefile + + 2.2.1.5. Edit the copied Makefile and set top_dir to the proper apache source +directory created by the Apache development package install. For example, on +Ubuntu it is /usr/share/apache2 (containing the .mk file). + + 2.2.1.6. Compile and install (on Ubuntu) +>make +>sudo make install + +2.2.2. Now, we should have a mod_fastcgi.so in /usr/lib/apache2/modules (on +Ubuntu) + +2.2.3. If you have not done so yet, compile your FCGI application. +In case you want to set up an External FCGI Server, then you must specify a +port number in your main project file (.lpr) before the Application.Run +instruction (this is the only change needed). +Example: +<...snip...> + Application.Initialize; + Application.Port:=1234;//Port the FCGI application is listening on + Application.Run; +<...snip...> + +2.2.4 Edit the Apache configuration file (/etc/apache2/apache2.conf on Ubuntu) +and add to the end: + 2.2.4.a External FCGI Server +############ +LoadModule fastcgi_module "<Path_To_Mod>/mod_fastcgi.so" +<IfModule mod_fastcgi.c> + <Directory "<Path_To_Your_FCGI_application>"> +# Options +ExecCGI <- not needed if ScriptAlias is used below + Order allow,deny + Allow from all + </Directory> +#External FCGI app, has to be manually started and running when a request comes in + FastCgiExternalServer "<Path_To_Your_FCGI_application>/<Your_FCGI_application>" -host 127.0.0.1:<Port> -idle-timeout 30 -flush +#optionally, to shorten the URL and to not display the executable file name (if used, no +ExecCGI is needed above): + ScriptAlias /myfcgi "<Path_To_Your_FCGI_application>/<Your_FCGI_application>" +</IfModule> +############ +Example: +LoadModule fastcgi_module "/usr/lib/apache2/modules/mod_fastcgi.so" +<IfModule mod_fastcgi.c> + <Directory "/home/johndoe/LazarusFCGITest"> + Order allow,deny + Allow from all + </Directory> + FastCgiExternalServer "/home/johndoe/LazarusFCGITest/helloworld" -host 127.0.0.1:1234 -idle-timeout 30 -flush + ScriptAlias /myfcgi "/home/johndoe/LazarusFCGITest/helloworld" +</IfModule> + + 2.2.4.b Regular FCGI Server +Replace the FastCgiExternalServer line above with + FastCgiServer "<Path_To_Your_FCGI_application>/<Your_FCGI_application>" -idle-timeout 30 + +Example: +LoadModule fastcgi_module "/usr/lib/apache2/modules/mod_fastcgi.so" +<IfModule mod_fastcgi.c> + <Directory "/home/johndoe/LazarusFCGITest"> + Order allow,deny + Allow from all + </Directory> + FastCgiServer "/home/johndoe/LazarusFCGITest/helloworld" -idle-timeout 30 + ScriptAlias /myfcgi "/home/johndoe/LazarusFCGITest/helloworld" +</IfModule> + +(the project is compiled into directory /home/johndoe/LazarusFCGITest/ , and +the FCGI application is called helloworld with no file extension) + +Note, there are many ways to configure the FCGI applications, this is just but +one example. You can check the Apache and mod_fastcgi documentation for +alternatives. For example, some more information available at +http://www.fastcgi.com/docs/faq.html#typical_httpd.conf + +2.2.5 Start/Restart your Apache server. +If FastCgiExternalServer is used, then start your application manually, so it +can start accepting incoming requests from the web server. +On the other hand, if FastCgiServer is used and everything went according to +plan, then the Apache error.log should contain a warning message about your +FCGI application, saying that it was started. Something like: +[warn] FastCGI: server "/home/johndoe/LazarusFCGITest/helloworld" started... + +2.2.6 Open your web browser and try to call your new FCGI application. +Example: +http://127.0.0.1/myfcgi/func1call +"myfcgi" is the ScriptAlias name specified for the FCGI application, and +func1call is the action name we want to call within our default web module. +If you have multiple web modules, you can enter the desired web module name +before the action name, for example: +http://127.0.0.1/myfcgi/webmodule1/func1call + +If there is any problem, you can try and check the Apache error.log for clues. + +=============================================================================== diff --git a/packages/fcl-web/src/base/Makefile b/packages/fcl-web/src/base/Makefile index 4ad57063d3..e55a11f558 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 [2011/06/09] +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/06/28] # 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 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 @@ -245,7 +245,7 @@ endif ifndef CROSSBINDIR CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) endif -ifeq ($(OS_TARGET),darwin) +ifneq ($(findstring $(OS_TARGET),darwin iphonesim),) ifeq ($(OS_SOURCE),darwin) DARWIN2DARWIN=1 endif @@ -264,188 +264,220 @@ 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)))),) +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +FPCFPMAKE:=$(shell $(FPCPROG) -PB) +ifeq ($(strip $(wildcard $(FPCFPMAKE))),) +FPCFPMAKE:=$(firstword $(FPCPROG)) +endif +else +override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))) +FPMAKE_SKIP_CONFIG=-n +export FPCFPMAKE +export FPMAKE_SKIP_CONFIG +endif +else +FPCFPMAKE=$(FPC) +endif +endif override PACKAGE_NAME=fcl-web override PACKAGE_VERSION=2.4.5 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 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 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 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 @@ -507,6 +539,12 @@ endif ifeq ($(FULL_TARGET),i386-symbian) override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient endif +ifeq ($(FULL_TARGET),i386-nativent) +override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient +endif +ifeq ($(FULL_TARGET),i386-iphonesim) +override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient +endif ifeq ($(FULL_TARGET),m68k-linux) override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient endif @@ -552,6 +590,9 @@ endif ifeq ($(FULL_TARGET),powerpc-embedded) override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient endif +ifeq ($(FULL_TARGET),powerpc-wii) +override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient +endif ifeq ($(FULL_TARGET),sparc-linux) override TARGET_RSTS+=fpcgi fphtml fpweb websession cgiapp fphttpserver fphttpclient endif @@ -688,6 +729,12 @@ endif ifeq ($(FULL_TARGET),i386-symbian) override COMPILER_OPTIONS+=-S2h endif +ifeq ($(FULL_TARGET),i386-nativent) +override COMPILER_OPTIONS+=-S2h +endif +ifeq ($(FULL_TARGET),i386-iphonesim) +override COMPILER_OPTIONS+=-S2h +endif ifeq ($(FULL_TARGET),m68k-linux) override COMPILER_OPTIONS+=-S2h endif @@ -733,6 +780,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 @@ -1166,7 +1216,7 @@ DEBUGSYMEXT=.xcoff SHORTSUFFIX=mac IMPORTLIBPREFIX=imp endif -ifeq ($(OS_TARGET),darwin) +ifneq ($(findstring $(OS_TARGET),darwin iphonesim),) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 @@ -1181,6 +1231,15 @@ ifeq ($(OS_TARGET),symbian) SHAREDLIBEXT=.dll SHORTSUFFIX=symbian endif +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 @@ -1909,6 +1968,30 @@ REQUIRE_PACKAGES_FCL-PASSRC=1 REQUIRE_PACKAGES_FCL-ASYNC=1 REQUIRE_PACKAGES_FCL-NET=1 endif +ifeq ($(FULL_TARGET),i386-nativent) +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),i386-iphonesim) +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),m68k-linux) REQUIRE_PACKAGES_RTL=1 REQUIRE_PACKAGES_FCL-BASE=1 @@ -2142,6 +2225,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 @@ -2549,6 +2644,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) @@ -2566,6 +2670,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)))))) @@ -2575,6 +2682,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) @@ -2592,6 +2708,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)))))) @@ -2601,6 +2720,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) @@ -2618,6 +2746,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)))))) @@ -2627,6 +2758,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) @@ -2644,6 +2784,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)))))) @@ -2653,6 +2796,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) @@ -2670,6 +2822,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)))))) @@ -2679,6 +2834,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) @@ -2696,6 +2860,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)))))) @@ -2705,6 +2872,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) @@ -2722,6 +2898,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)))))) @@ -2731,6 +2910,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) @@ -2748,6 +2936,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)))))) @@ -2757,6 +2948,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) @@ -2774,6 +2974,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)))))) @@ -2783,6 +2986,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) @@ -2800,6 +3012,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)))))) @@ -2809,6 +3024,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) @@ -2826,6 +3050,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)))))) @@ -2835,6 +3062,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) @@ -2852,6 +3088,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)))))) @@ -2861,6 +3100,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) @@ -2878,6 +3126,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)))))) @@ -2887,6 +3138,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) @@ -2904,6 +3164,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)))))) @@ -2913,6 +3176,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) @@ -2930,6 +3202,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)))))) @@ -2939,6 +3214,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) @@ -2956,6 +3240,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)))))) @@ -2965,6 +3252,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) @@ -2982,6 +3278,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)))))) @@ -2991,6 +3290,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) @@ -3008,6 +3316,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)))))) @@ -3017,6 +3328,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) @@ -3034,6 +3354,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) @@ -3146,7 +3469,7 @@ override FPCOPT+=-Aas endif endif ifeq ($(findstring 2.0.,$(FPC_VERSION)),) -ifeq ($(OS_TARGET),linux) +ifneq ($(findstring $(OS_TARGET),linux solaris),) ifeq ($(CPU_TARGET),x86_64) override FPCOPT+=-Cg endif @@ -3443,6 +3766,7 @@ fpc_baseinfo: @$(ECHO) Full Target.. $(FULL_TARGET) @$(ECHO) SourceSuffix. $(SOURCESUFFIX) @$(ECHO) TargetSuffix. $(TARGETSUFFIX) + @$(ECHO) FPC fpmake... $(FPCFPMAKE) @$(ECHO) @$(ECHO) == Directory info == @$(ECHO) diff --git a/packages/fcl-web/src/base/Makefile.fpc b/packages/fcl-web/src/base/Makefile.fpc index 2cdfe998e1..c1ce16056f 100644 --- a/packages/fcl-web/src/base/Makefile.fpc +++ b/packages/fcl-web/src/base/Makefile.fpc @@ -9,7 +9,7 @@ version=2.4.5 [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 diff --git a/packages/fcl-web/src/base/README.txt b/packages/fcl-web/src/base/README.txt index 1818ec4e5b..efeddb1d44 100644 --- a/packages/fcl-web/src/base/README.txt +++ b/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.
\ No newline at end of file diff --git a/packages/fcl-web/src/base/custfcgi.pp b/packages/fcl-web/src/base/custfcgi.pp index 46a08528df..056e07bfb2 100644 --- a/packages/fcl-web/src/base/custfcgi.pp +++ b/packages/fcl-web/src/base/custfcgi.pp @@ -789,15 +789,18 @@ Var begin {$ifndef windows} - Result:=fpaccept(Socket,psockaddr(@FIAddress),@FAddressLength); + repeat + Result:=fpaccept(Socket,nil,nil); + until ((result<>-1) or (SocketError<>ESysEINTR)) and not Terminated; {$else} - {$ifdef windowspipe} +{$ifndef windowspipe} + Result:=fpaccept(Socket,Nil,nil); +{$else windowspipe} if Not fIsWinPipe then - {$endif} - Result:=fpaccept(Socket,psockaddr(@FIAddress),@FAddressLength); - {$ifdef windowspipe} + Result:=fpaccept(Socket,Nil,Nil); If FIsWinPipe or ((Result<0) and (socketerror=10038)) then begin + Result:=-1; B:=ConnectNamedPipe(Socket,Nil); if B or (GetLastError=ERROR_PIPE_CONNECTED) then begin @@ -811,7 +814,7 @@ begin FIsWinPipe:=True; end; end; - {$endif} +{$endif} {$endif} end; @@ -820,6 +823,7 @@ function TFCgiHandler.WaitForRequest(out ARequest: TRequest; out AResponse: TRes var AFCGI_Record : PFCGI_Header; + begin Result := False; AResponse:=Nil; @@ -833,8 +837,11 @@ begin FHandle:=AcceptConnection; if FHandle=THandle(-1) then begin - Terminate; - raise Exception.CreateFmt(SNoInputHandle,[socketerror]); + if not terminated then + begin + Terminate; + raise Exception.CreateFmt(SNoInputHandle,[socketerror]); + end end; repeat If (poUseSelect in ProtocolOptions) then diff --git a/packages/fcl-web/src/base/custhttpapp.pp b/packages/fcl-web/src/base/custhttpapp.pp new file mode 100644 index 0000000000..3e82c5fd2a --- /dev/null +++ b/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. diff --git a/packages/fcl-web/src/base/fpapache.pp b/packages/fcl-web/src/base/fpapache.pp index 497ac47d9c..1e5396258e 100644 --- a/packages/fcl-web/src/base/fpapache.pp +++ b/packages/fcl-web/src/base/fpapache.pp @@ -463,11 +463,9 @@ begin If (Index in [1..NoHTTPFields]) then begin FN:=HTTPFieldNames[Index]; - P:=apr_table_get(FRequest^.headers_in,pchar(FN)); - If (P<>Nil) then - Result:=StrPas(P); + Result:=MaybeP(apr_table_get(FRequest^.headers_in,pchar(FN))); end; - if (Result='') then + if (Result='') and Assigned(FRequest) then case Index of 0 : Result:=MaybeP(FRequest^.protocol); // ProtocolVersion 7 : Result:=MaybeP(FRequest^.content_encoding); //ContentEncoding @@ -480,8 +478,9 @@ begin If (FRequest^.Connection<>Nil) then begin Result:=MaybeP(ap_get_remote_host(FRequest^.Connection, - FRequest^.Per_Dir_Config, - REMOTE_HOST,Nil)); + FRequest^.per_dir_config, +// nil, + REMOTE_NAME,@i)); end; 29 : begin // ScriptName Result:=MaybeP(FRequest^.unparsed_uri); diff --git a/packages/fcl-web/src/base/fphttp.pp b/packages/fcl-web/src/base/fphttp.pp index f2cf5929b7..ccff8a275e 100644 --- a/packages/fcl-web/src/base/fphttp.pp +++ b/packages/fcl-web/src/base/fphttp.pp @@ -147,6 +147,8 @@ Type TSessionFactory = Class(TComponent) private + FSessionCookie: String; + FSessionCookiePath: String; FTimeOut: Integer; FCleanupInterval: Integer; FDoneCount: Integer; @@ -167,6 +169,10 @@ Type Property CleanupInterval : Integer read FCleanupInterval Write FCleanUpInterval; // Default timeout for sessions, in minutes. Property DefaultTimeOutMinutes : Integer Read FTimeOut Write FTimeOut; + // Default session cookie. + property SessionCookie : String Read FSessionCookie Write FSessionCookie; + // Default session cookie path + Property SessionCookiePath : String Read FSessionCookiePath write FSessionCookiePath; end; TSessionFactoryClass = Class of TSessionFactory; @@ -242,8 +248,13 @@ end; function TSessionFactory.CreateSession(ARequest: TRequest): TCustomSession; begin Result:=DoCreateSession(ARequest); - if (FTimeOut<>0) and Assigned(Result) then - Result.TimeoutMinutes:=FTimeOut; + if Assigned(Result) then + begin + if (FTimeOut<>0) then + Result.TimeoutMinutes:=FTimeOut; + Result.SessionCookie:=Self.SessionCookie; + Result.SessionCookiePath:=Self.SessionCookiePath; + end; end; procedure TSessionFactory.DoneSession(var ASession: TCustomSession); diff --git a/packages/fcl-web/src/base/fphttpapp.pp b/packages/fcl-web/src/base/fphttpapp.pp new file mode 100644 index 0000000000..e50425622f --- /dev/null +++ b/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. diff --git a/packages/fcl-web/src/base/fphttpclient.pp b/packages/fcl-web/src/base/fphttpclient.pp index 0ab2ddd375..c1d0a1e3ad 100644 --- a/packages/fcl-web/src/base/fphttpclient.pp +++ b/packages/fcl-web/src/base/fphttpclient.pp @@ -570,6 +570,7 @@ Var ResponseOK : Boolean; begin + SetLength(FBuffer,0); FResponseStatusCode:=ReadResponseHeaders; if not CheckResponseCode(FResponseStatusCode,AllowedResponseCodes) then Raise EHTTPClient.CreateFmt(SErrUnexpectedResponse,[ResponseStatusCode]); diff --git a/packages/fcl-web/src/base/fphttpserver.pp b/packages/fcl-web/src/base/fphttpserver.pp index 5b26eaccb1..77c495751f 100644 --- a/packages/fcl-web/src/base/fphttpserver.pp +++ b/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; @@ -369,6 +368,7 @@ Var begin Request.Method:=GetNextWord(AStartLine); Request.URL:=GetNextWord(AStartLine); + Request.PathInfo:=Request.URL; S:=GetNextWord(AStartLine); If (Pos('HTTP/',S)<>1) then Raise Exception.Create(SErrMissingProtocol); diff --git a/packages/fcl-web/src/base/fpwebfile.pp b/packages/fcl-web/src/base/fpwebfile.pp new file mode 100644 index 0000000000..1e79ca17fe --- /dev/null +++ b/packages/fcl-web/src/base/fpwebfile.pp @@ -0,0 +1,182 @@ +{$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 + Result:=ARequest.URI; + sb; + If (BaseURL<>'') and (Pos(BaseURL,Result)=1) then + Delete(Result,1,Length(BaseURL)); + 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. diff --git a/packages/fcl-web/src/base/httpdefs.pp b/packages/fcl-web/src/base/httpdefs.pp index 2ac19e36c2..b1942caa79 100644 --- a/packages/fcl-web/src/base/httpdefs.pp +++ b/packages/fcl-web/src/base/httpdefs.pp @@ -32,6 +32,9 @@ interface uses Classes,Sysutils; const + DefaultTimeOut = 15; + SFPWebSession = 'FPWebSession'; // Cookie name for session. + fieldAccept = 'Accept'; fieldAcceptCharset = 'Accept-Charset'; fieldAcceptEncoding = 'Accept-Encoding'; @@ -175,7 +178,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); @@ -266,6 +268,7 @@ type FCommand: String; FCommandLine: String; FHandleGetOnPost: Boolean; + FPathInfo, FURI: String; FFiles : TUploadedFiles; FReturnedPathInfo : String; @@ -278,6 +281,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; @@ -354,9 +358,16 @@ type TCustomSession = Class(TComponent) Private + FSessionCookie: String; + FSessionCookiePath: String; FTimeOut: Integer; Protected + // Can be overridden to provide custom behaviour. + procedure SetSessionCookie(const AValue: String); virtual; + procedure SetSessionCookiePath(const AValue: String); virtual; + // When called, generates a new GUID. Override to retrieve GUID from cookie/URL/... Function GetSessionID : String; virtual; + // These must be overridden to actually store/retrieve variables. Function GetSessionVariable(VarName : String) : String; Virtual; abstract; procedure SetSessionVariable(VarName : String; const AValue: String);Virtual;abstract; Public @@ -367,10 +378,19 @@ type Procedure InitResponse(AResponse : TResponse); virtual; // Update response from session (typically, change cookie to response and write session data). Procedure UpdateResponse(AResponse : TResponse); virtual; Abstract; + // Remove variable from list of variables. Procedure RemoveVariable(VariableName : String); virtual; abstract; + // Terminate session Procedure Terminate; virtual; abstract; - Property TimeOutMinutes : Integer Read FTimeOut Write FTimeOut; + // Session timeout in minutes + Property TimeOutMinutes : Integer Read FTimeOut Write FTimeOut default 15; + // ID of this session. Property SessionID : String Read GetSessionID; + // Name of cookie used when tracing session. (may or may not be used) + property SessionCookie : String Read FSessionCookie Write SetSessionCookie; + // Path of cookie used when tracing session. (may or may not be used) + Property SessionCookiePath : String Read FSessionCookiePath write SetSessionCookiePath; + // Variables, tracked in session. Property Variables[VarName : String] : String Read GetSessionVariable Write SetSessionVariable; end; @@ -625,7 +645,6 @@ begin else case Index of 0 : Result:=FHTTPVersion; - 32 : Result:=FURL; 36 : Result:=FHTTPXRequestedWith; else Result := ''; @@ -656,7 +675,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 +1024,29 @@ 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 + 25 : Result:=FPathInfo; + 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 + 25 : FPathInfo:=Value; + 31 : FCommand:=Value; + 32 : FURI:=Value; + else + inherited SetFieldValue(Index, Value); + end end; function TRequest.GetFirstHeaderLine: String; @@ -1695,6 +1728,16 @@ end; { TCustomSession } +procedure TCustomSession.SetSessionCookie(const AValue: String); +begin + FSessionCookie:=AValue; +end; + +procedure TCustomSession.SetSessionCookiePath(const AValue: String); +begin + FSessionCookiePath:=AValue; +end; + function TCustomSession.GetSessionID: String; Var @@ -1708,7 +1751,7 @@ end; constructor TCustomSession.Create(AOwner: TComponent); begin - FTimeOut:=15; + FTimeOut:=DefaultTimeOut; inherited Create(AOwner); end; @@ -1717,7 +1760,8 @@ begin // do nothing end; -procedure TCustomSession.InitSession(ARequest: TRequest; OnNewSession,OnExpired : TNotifyEvent); +procedure TCustomSession.InitSession(ARequest: TRequest; OnNewSession, + OnExpired: TNotifyEvent); begin // Do nothing end; diff --git a/packages/fcl-web/src/base/iniwebsession.pp b/packages/fcl-web/src/base/iniwebsession.pp index 9a55c06dc0..18fe071df7 100644 --- a/packages/fcl-web/src/base/iniwebsession.pp +++ b/packages/fcl-web/src/base/iniwebsession.pp @@ -29,8 +29,6 @@ Type FSessionStarted : Boolean; FCached: Boolean; FIniFile : TMemInifile; - FSessionCookie: String; - FSessionCookiePath: String; FSessionDir: String; FTerminated :Boolean; SID : String; @@ -42,9 +40,7 @@ Type 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 FSessionDir Write FSessionDir; - Property SessionCookiePath : String Read FSessionCookiePath write FSessionCookiePath; Public Destructor Destroy; override; Procedure Terminate; override; @@ -99,8 +95,6 @@ Const 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'; @@ -178,6 +172,8 @@ begin else S:=IniWebSessionClass.Create(Nil); S.SessionDir:=SessionDir; + S.SessionCookie:=SessionCookie; + S.SessionCookiePath:=SessionCookiePath; S.Cached:=Cached; Result:=S; end; @@ -297,7 +293,6 @@ begin 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]; @@ -353,7 +348,7 @@ begin C.Name:=SessionCookie; end; C.Value:=SID; - C.Path:=FSessionCookiePath; + C.Path:=SessionCookiePath; end else If FTerminated then begin diff --git a/packages/fcl-web/src/webdata/extjsjson.pp b/packages/fcl-web/src/webdata/extjsjson.pp index 6f44894ae5..31c0e56663 100644 --- a/packages/fcl-web/src/webdata/extjsjson.pp +++ b/packages/fcl-web/src/webdata/extjsjson.pp @@ -15,7 +15,6 @@ type private FRows : TJSONArray; FCurrentRow : TJSONObject; - FIDValue : TJSONData; FRowIndex : integer; function CheckData: Boolean; Public @@ -525,7 +524,10 @@ begin FCurrentRow:=TJSONObject(D); end else if D is TJSONInt64Number then - FIDValue:=D + begin + FRows:=nil; + FCurrentRow:=TJSONObject.Create(['ID',D]); + end else begin FreeAndNil(D); @@ -545,7 +547,6 @@ begin else FreeAndNil(FRows); FRowIndex:=0; - FreeAndNil(FIDValue); inherited reset; end; @@ -571,22 +572,13 @@ Var I : Integer; begin - Avalue:=''; Result:=False; if CheckData then begin - If Assigned(FIDValue) and (0=CompareText(AFieldName,'ID')) then - begin - AValue:=FIDValue.AsString; - Result:=True; - end - else - begin - I:=FCurrentRow.IndexOfName(AFieldName); - Result:=I<>-1; - if result then - AValue:=FCurrentRow.Items[I].AsString; - end; + I:=FCurrentRow.IndexOfName(AFieldName); + Result:=I<>-1; + if result and (FCurrentRow.Items[I].JSONType<>jtNull) then + AValue:=FCurrentRow.Items[I].AsString; end; end; @@ -595,9 +587,7 @@ begin If Assigned(FRows) then FreeAndNil(FRows) else if assigned(FCurrentRow) then - FreeAndNil(FCurrentRow) - else if Assigned(FIDValue) then - FreeAndNil(FIDValue); + FreeAndNil(FCurrentRow); inherited destroy; end; diff --git a/packages/fcl-web/src/webdata/sqldbwebdata.pp b/packages/fcl-web/src/webdata/sqldbwebdata.pp index 28b5356045..7de0143946 100644 --- a/packages/fcl-web/src/webdata/sqldbwebdata.pp +++ b/packages/fcl-web/src/webdata/sqldbwebdata.pp @@ -349,6 +349,16 @@ end; procedure TCustomSQLDBWebDataProvider.ApplySQLParams(AQuery : TSQLQuery; DoNewID : Boolean = False); + function TryAdaptor (const aName: string; P: TParam) : boolean; + var S : string; + begin + result := Adaptor.TryFieldValue(aName,S); + if not result then + result := Adaptor.TryParamValue(aName,S); + if result then + SetTypedParam(P,S); + end; + var I: Integer; P : TParam; @@ -366,16 +376,20 @@ begin FOnGetParamValue(Self,P,B); if not B then begin - If (P.Name=IDFieldName) and DoNewID then + If (P.Name=IDFieldName) then begin - GetNewID; - SetTypedParam(P,FLastNewID) + if DoNewID then + begin + GetNewID; + SetTypedParam(P,FLastNewID) + end + else + begin + if not TryAdaptor (P.Name, P) then + TryAdaptor('ID', P); + end; end - else If Adaptor.TryFieldValue(P.Name,S) then - SetTypedParam(P,S) - else If Adaptor.TryParamValue(P.Name,S) then - SetTypedParam(P,S) - else + else if not TryAdaptor (P.Name, P) then P.Clear; end; end; diff --git a/packages/fcl-xml/src/htmlelements.pp b/packages/fcl-xml/src/htmlelements.pp index fe579dda1b..5f0e5a25f3 100644 --- a/packages/fcl-xml/src/htmlelements.pp +++ b/packages/fcl-xml/src/htmlelements.pp @@ -128,8 +128,30 @@ type procedure WriteToStream (const aStream : TStream); override; end; +function EscapeHTML(const s : String) : String; +function UnescapeHTML(const s : String) : String; + implementation +function EscapeHTML ( const S : String ) : String; +begin + Result := StringReplace(s, '&', '&', [rfReplaceAll]); + Result := StringReplace(Result, '<', '<', [rfReplaceAll]); + Result := StringReplace(Result, '>', '>', [rfReplaceAll]); + Result := StringReplace(Result, '"', '"', [rfReplaceAll]); + Result := StringReplace(Result, #39, ''', [rfReplaceAll]); // ' - ' does not work on ie :( +end; + +function UnescapeHTML ( const S : String ) : String; +begin + Result := StringReplace(s, '<', '<', [rfReplaceAll]); + Result := StringReplace(Result, '>', '>', [rfReplaceAll]); + Result := StringReplace(Result, '"', '"', [rfReplaceAll]); + Result := StringReplace(Result, ''', #39, [rfReplaceAll]); // ' + Result := StringReplace(Result, ''', #39, [rfReplaceAll]); // ' + Result := StringReplace(Result, '&', '&', [rfReplaceAll]); +end; + { THtmlCustomElement } @@ -201,8 +223,7 @@ end; function THtmlCustomElement.EscapeString(s: string): string; begin - result := s; - //TODO: Needs to convert all the special signs to their html names ("<" has to be "<" etc.) + result := EscapeHTML(s); end; constructor THtmlCustomElement.create(AOwner: TDOMDocument); diff --git a/packages/httpd22/src/aprutil/apr_uri.inc b/packages/httpd22/src/aprutil/apr_uri.inc index 0177eae455..3fee63e975 100644 --- a/packages/httpd22/src/aprutil/apr_uri.inc +++ b/packages/httpd22/src/aprutil/apr_uri.inc @@ -100,6 +100,7 @@ type { The port number, numeric, valid only if port_str != NULL } port: apr_port_t; + BitFlags : Cardinal; // Takes care of is_initialized, dns_looked_up and dns_resolved { has the structure been initialized } // unsigned is_initialized:1; diff --git a/packages/httpd22/src/http_core.inc b/packages/httpd22/src/http_core.inc index c4e126165f..bc9b9b80e3 100644 --- a/packages/httpd22/src/http_core.inc +++ b/packages/httpd22/src/http_core.inc @@ -534,7 +534,7 @@ type response_code_strings: PPChar; { from ErrorDocument, not from * ap_custom_response() } - + flags : cardinal; // takes care of hostname_lookup, content_md5, use_canonical_name d_is_fnmatch and add_default_charse { Hostname resolution etc } { unsigned int hostname_lookups : 4; } @@ -591,7 +591,7 @@ type etag_bits: etag_components_t; etag_add: etag_components_t; etag_remove: etag_components_t; - + flags2 : cardinal; // Takes care of enable_mmap, enable_sendfile, allow_encoded_slashes and use_canonical_phys_port { * Run-time performance tuning } |