2009-01-20 00:20 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com)
+ harbour/contrib/examples/uhttpd/modules/info.prg
+ New sample showing server variables
* harbour/contrib/examples/uhttpd/home/index.html
* harbour/contrib/examples/uhttpd/readme.txt
* harbour/contrib/examples/uhttpd/uhttpd.prg
* updated for new sample
This commit is contained in:
@@ -8,6 +8,14 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
|
||||
*/
|
||||
|
||||
2009-01-20 00:20 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com)
|
||||
+ harbour/contrib/examples/uhttpd/modules/info.prg
|
||||
+ New sample showing server variables
|
||||
* harbour/contrib/examples/uhttpd/home/index.html
|
||||
* harbour/contrib/examples/uhttpd/readme.txt
|
||||
* harbour/contrib/examples/uhttpd/uhttpd.prg
|
||||
* updated for new sample
|
||||
|
||||
2009-01-19 23:43 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com)
|
||||
* harbour/Changelog
|
||||
* fixed path of previous upload
|
||||
|
||||
@@ -16,5 +16,9 @@ Examples:
|
||||
<a href="testxmldb.html">Test Ajax XML Database</a>
|
||||
<br>
|
||||
<a href="counter.html">Test Ajax Counter</a>
|
||||
<br>
|
||||
<a href="/serverstatus">Server Status</a>
|
||||
<br>
|
||||
<a href="/info">Alias to /cgi-bin/info.hrb page with server variables</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
112
harbour/contrib/examples/uhttpd/modules/info.prg
Normal file
112
harbour/contrib/examples/uhttpd/modules/info.prg
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* $Id: rlcdx.prg 9754 2008-10-27 22:40:04Z vszakats $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* uHTTPD info page
|
||||
*
|
||||
* Copyright 2009 Francesco Saverio Giudice <info / at / fsgiudice.com>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
Show internal variables.
|
||||
Call it with: /info
|
||||
*/
|
||||
|
||||
|
||||
#include "common.ch"
|
||||
#include "hbclass.ch"
|
||||
|
||||
MEMVAR _SERVER, _REQUEST, _GET, _POST
|
||||
|
||||
FUNCTION HRBMAIN()
|
||||
LOCAL cHtml
|
||||
|
||||
cHtml := ShowServerInfo()
|
||||
|
||||
RETURN cHtml
|
||||
|
||||
STATIC FUNCTION ShowServerInfo()
|
||||
LOCAL cHtml := ""
|
||||
|
||||
cHtml += DisplayVars( _Server , "SERVER Vars" )
|
||||
cHtml += "<br>"
|
||||
cHtml += DisplayVars( _Get , "GET Vars" )
|
||||
cHtml += "<br>"
|
||||
cHtml += DisplayVars( _Post , "POST Vars" )
|
||||
cHtml += "<br>"
|
||||
//cHtml += DisplayVars( _Cookie , "COOKIE Vars" )
|
||||
//cHtml += "<br>"
|
||||
//cHtml += DisplayVars( _Files , "FILE Vars" )
|
||||
//cHtml += "<br>"
|
||||
cHtml += DisplayVars( _Request, "REQUEST Vars" )
|
||||
cHtml += "<br>"
|
||||
//cHtml += DisplayVars( _Session, "SESSION Vars" )
|
||||
//cHtml += "<br>"
|
||||
RETURN cHtml
|
||||
|
||||
STATIC FUNCTION DisplayVars( hHash, cTitle )
|
||||
LOCAL cHtml := ""
|
||||
cHtml += "<table width='90%' align='center' border='1'>"
|
||||
cHtml += "<th colspan=2>" + hb_cStr( cTitle ) + "</th>"
|
||||
cHtml += "<tr>"
|
||||
cHtml += "<th width='20%'>KEY</th>"
|
||||
cHtml += "<th width='80%'>VALUE</th>"
|
||||
cHtml += "</tr>"
|
||||
cHtml += DisplayHash( hHash )
|
||||
cHtml += "</table>"
|
||||
RETURN cHtml
|
||||
|
||||
STATIC FUNCTION DisplayHash( hHash )
|
||||
LOCAL cHtml := ""
|
||||
LOCAL cKey, cSubKey
|
||||
|
||||
FOR EACH cKey IN hHash:Keys
|
||||
cHtml += "<tr>"
|
||||
cHtml += "<td>" + hb_cStr( cKey ) + "</td>"
|
||||
cHtml += "<td>" + hb_cStr( hHash[ cKey ] ) + "</td>"
|
||||
cHtml += "</tr>"
|
||||
NEXT
|
||||
RETURN cHtml
|
||||
@@ -7,6 +7,10 @@ uhttpd -?
|
||||
|
||||
Before starting please build modules in modules folder using bldhrb.bat
|
||||
|
||||
Once started connect to uhttpd using:
|
||||
http://localhost:8082
|
||||
to see default index page.
|
||||
|
||||
Francesco
|
||||
|
||||
|
||||
|
||||
@@ -144,8 +144,9 @@ STATIC s_nServiceConnections, s_nMaxServiceConnections, s_nTotServiceConnections
|
||||
STATIC s_aRunningThreads := {}
|
||||
STATIC s_aServiceThreads := {}
|
||||
|
||||
// ALIASES: you can add here any alias to real file and call it
|
||||
// TODO: add aliases from ini file
|
||||
STATIC s_hFileAliases := { "/info" => "/cgi-bin/info.hrb", "/wait" => "/cgi-bin/wait.hrb" }
|
||||
STATIC s_hFileAliases := { "/info" => "/cgi-bin/info.hrb" }
|
||||
|
||||
THREAD STATIC s_cResult, s_nStatusCode, s_aHeader, s_cErrorMsg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user