2012-11-07 04:18 UTC+0100 Viktor Szakats (harbour syenar.net)

* extras/httpsrv/cgifunc.prg
  * extras/httpsrv/modules/tableservletdb.prg
  * extras/httpsrv/session.prg
  * extras/httpsrv/uhttpd.hbp
  * extras/httpsrv/uhttpd.prg
  * extras/httpsrv/uhttpdgd.hbp
  * extras/rddado/adordd.prg
    * formatted
    ! some commented code converted to #if 0/#endif block
This commit is contained in:
Viktor Szakats
2012-11-07 03:19:49 +00:00
parent 6d60145620
commit 2c4d86c392
8 changed files with 91 additions and 162 deletions

View File

@@ -473,7 +473,7 @@ FUNCTION uhttpd_TimeDiffAsSeconds( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
__defaultNIL( @dDateEnd, Date() )
__defaultNIL( @cTimeEnd, Time() )
aRetVal := FT_ELAPSED( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
aRetVal := ft_Elapsed( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
RETURN aRetVal[ 4, 2 ]
@@ -497,8 +497,8 @@ FUNCTION uhttpd_OutputString( cString, aTranslate, lProtected )
FUNCTION uhttpd_HtmlSpecialChars( cString, cQuote_style )
LOCAL aTranslations := { ;
{ '&', '&' },;
{ '<', '&lt;' },;
{ '&', '&amp;' }, ;
{ '<', '&lt;' }, ;
{ '>', '&gt;' } ;
}
@@ -693,50 +693,6 @@ PROCEDURE uhttpd_Die( cError )
FUNCTION uhttpd_HTMLSpace( n )
RETURN Replicate( "&nbsp;", n ) // "&#32;"
/* FROM FT LIB */
STATIC FUNCTION FT_ELAPSED( dStart, dEnd, cTimeStart, cTimeEnd )
LOCAL nTotalSec, nCtr, nConstant, nTemp, aRetVal[ 4, 2 ]
IF HB_ISSTRING( dStart )
cTimeStart := dStart
dStart := Date()
ELSEIF ! HB_ISDATE( dStart )
dStart := Date()
ENDIF
IF HB_ISSTRING( dEnd )
cTimeEnd := dEnd
dEnd := Date()
ELSEIF ! HB_ISDATE( dEnd )
dEnd := Date()
ENDIF
iif( ! HB_ISSTRING( cTimeStart ), cTimeStart := '00:00:00', )
iif( ! HB_ISSTRING( cTimeEnd ), cTimeEnd := '00:00:00', )
nTotalSec := ;
( dEnd - dStart ) * 86400 + ;
Val( cTimeEnd ) * 3600 + ;
Val( SubStr( cTimeEnd, At( ':', cTimeEnd ) + 1, 2 ) ) * 60 + ;
iif( RAt( ':', cTimeEnd ) == At( ':', cTimeEnd ), 0, ;
Val( SubStr( cTimeEnd, RAt( ':', cTimeEnd ) + 1 ) ) ) - ;
Val( cTimeStart ) * 3600 - ;
Val( SubStr( cTimeStart, At( ':', cTimeStart ) + 1, 2 ) ) * 60 - ;
iif( RAt( ':', cTimeStart ) == At( ':', cTimeStart ), 0, ;
Val( SubStr( cTimeStart, RAt( ':', cTimeStart ) + 1 ) ) )
nTemp := nTotalSec
FOR nCtr := 1 TO 4
nConstant := iif( nCtr == 1, 86400, iif( nCtr == 2, 3600, iif( nCtr == 3, 60, 1 ) ) )
aRetVal[ nCtr, 1 ] := Int( nTemp / nConstant )
aRetval[ nCtr, 2 ] := nTotalSec / nConstant
nTemp -= aRetVal[ nCtr, 1 ] * nConstant
NEXT
RETURN aRetVal
PROCEDURE uhttpd_WriteToLogFile( cString, cLog, lCreate )
LOCAL nHandle, cSep
@@ -777,13 +733,13 @@ FUNCTION uhttpd_SplitFileName( cFile )
hb_FNameSplit( cFile, @cPath, @cName, @cExt, @cDrive )
hFile := { ;
"FILE" => cFile,;
"DRIVE" => cDrive,;
"PATH" => cPath,;
"NAME" => cName,;
"EXT" => cExt,;
"FULLPATH" => NIL,;
"FULLNAME" => cName + cExt,;
"FILE" => cFile, ;
"DRIVE" => cDrive, ;
"PATH" => cPath, ;
"NAME" => cName, ;
"EXT" => cExt, ;
"FULLPATH" => NIL, ;
"FULLNAME" => cName + cExt, ;
"UNC" => NIL ;
}

View File

@@ -368,9 +368,11 @@ METHOD xmlEncode( input ) CLASS TableManager
CASE '>'
out += "&gt;"
EXIT
// CASE ' '
// out += "&nbsp;"
// EXIT
#if 0
CASE ' '
out += "&nbsp;"
EXIT
#endif
CASE Chr( 9 ) // E'\t'
CASE Chr( 13 ) // E'\r'
CASE Chr( 10 ) // E'\n'

View File

@@ -779,55 +779,10 @@ STATIC FUNCTION TimeDiffAsSeconds( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
__defaultNIL( @dDateEnd, Date() )
__defaultNIL( @cTimeEnd, Time() )
aRetVal := FT_ELAPSED( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
aRetVal := ft_Elapsed( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
RETURN aRetVal[ 4, 2 ]
// Nanforum ELAPSED
STATIC FUNCTION FT_ELAPSED( dStart, dEnd, cTimeStart, cTimeEnd )
LOCAL nTotalSec, nCtr, nConstant, nTemp, aRetVal[ 4, 2 ]
IF HB_ISSTRING( dStart )
cTimeStart := dStart
dStart := Date()
ELSEIF ! HB_ISDATE( dStart )
dStart := Date()
ENDIF
IF HB_ISSTRING( dEnd )
cTimeEnd := dEnd
dEnd := Date()
ELSEIF ! HB_ISDATE( dEnd )
dEnd := Date()
ENDIF
iif( ! HB_ISSTRING( cTimeStart ), cTimeStart := '00:00:00', )
iif( ! HB_ISSTRING( cTimeEnd ), cTimeEnd := '00:00:00', )
nTotalSec := ;
( dEnd - dStart ) * 86400 + ;
Val( cTimeEnd ) * 3600 + ;
Val( SubStr( cTimeEnd, At( ':', cTimeEnd ) + 1, 2 ) ) * 60 + ;
iif( RAt( ':', cTimeEnd ) == At( ':', cTimeEnd ), 0, ;
Val( SubStr( cTimeEnd, RAt( ':', cTimeEnd ) + 1 ) ) ) - ;
Val( cTimeStart ) * 3600 - ;
Val( SubStr( cTimeStart, At( ':', cTimeStart ) + 1, 2 ) ) * 60 - ;
iif( RAt( ':', cTimeStart ) == At( ':', cTimeStart ), 0, ;
Val( SubStr( cTimeStart, RAt( ':', cTimeStart ) + 1 ) ) )
nTemp := nTotalSec
FOR nCtr := 1 TO 4
nConstant := iif( nCtr == 1, 86400, iif( nCtr == 2, 3600, iif( nCtr == 3, 60, 1 ) ) )
aRetVal[ nCtr, 1 ] := Int( nTemp / nConstant )
aRetval[ nCtr, 2 ] := nTotalSec / nConstant
nTemp -= aRetVal[ nCtr, 1 ] * nConstant
NEXT
RETURN aRetVal
// ------------------------------
METHOD Encode() CLASS uhttpd_Session

View File

@@ -4,4 +4,5 @@
-mt -gui uhttpd.prg cgifunc.prg cookie.prg session.prg
-l{win}hbwin
hbwin.hbc
hbnf.hbc

View File

@@ -569,7 +569,7 @@ PROCEDURE Main( ... )
#ifdef __PLATFORM__WINDOWS
// windows resource releasing - 1 millisecond wait
IF WIN_SYSREFRESH( 1 ) != 0
IF win_SysRefresh( 1 ) != 0
EXIT
ENDIF
#endif
@@ -694,7 +694,7 @@ STATIC FUNCTION AcceptConnections()
#ifdef __PLATFORM__WINDOWS
// releasing resources
IF WIN_SYSREFRESH( 1 ) != 0
IF win_SysRefresh( 1 ) != 0
lQuitRequest := .T.
ENDIF
#endif
@@ -849,7 +849,7 @@ STATIC FUNCTION ProcessConnection()
#ifdef __PLATFORM__WINDOWS
// releasing resources
IF WIN_SYSREFRESH( 1 ) != 0
IF win_SysRefresh( 1 ) != 0
lQuitRequest := .T.
EXIT
ENDIF
@@ -1010,7 +1010,7 @@ STATIC FUNCTION ServiceConnection()
#ifdef __PLATFORM__WINDOWS
// releasing resources
IF WIN_SYSREFRESH( 1 ) != 0
IF win_SysRefresh( 1 ) != 0
lQuitRequest := .T.
EXIT
ENDIF
@@ -2838,49 +2838,49 @@ STATIC FUNCTION LoadMimeTypes()
// TODO: load mime types from file
RETURN { ;
"css" => "text/css",;
"htm" => "text/html",;
"html" => "text/html",;
"txt" => "text/plain",;
"text" => "text/plain",;
"asc" => "text/plain",;
"c" => "text/plain",;
"h" => "text/plain",;
"cpp" => "text/plain",;
"hpp" => "text/plain",;
"log" => "text/plain",;
"rtf" => "text/rtf",;
"xml" => "text/xml",;
"xsl" => "text/xsl",;
"bmp" => "image/bmp",;
"gif" => "image/gif",;
"jpg" => "image/jpeg",;
"jpe" => "image/jpeg",;
"jpeg" => "image/jpeg",;
"png" => "image/png",;
"tif" => "image/tiff",;
"tiff" => "image/tiff",;
"djv" => "image/vnd.djvu",;
"djvu" => "image/vnd.djvu",;
"ico" => "image/x-icon",;
"xls" => "application/excel",;
"doc" => "application/msword",;
"pdf" => "application/pdf",;
"ps" => "application/postscript",;
"eps" => "application/postscript",;
"ppt" => "application/powerpoint",;
"bz2" => "application/x-bzip2",;
"gz" => "application/x-gzip",;
"tgz" => "application/x-gtar",;
"js" => "application/x-javascript",;
"tar" => "application/x-tar",;
"tex" => "application/x-tex",;
"zip" => "application/zip",;
"midi" => "audio/midi",;
"mp3" => "audio/mpeg",;
"wav" => "audio/x-wav",;
"qt" => "video/quicktime",;
"mov" => "video/quicktime",;
"css" => "text/css", ;
"htm" => "text/html", ;
"html" => "text/html", ;
"txt" => "text/plain", ;
"text" => "text/plain", ;
"asc" => "text/plain", ;
"c" => "text/plain", ;
"h" => "text/plain", ;
"cpp" => "text/plain", ;
"hpp" => "text/plain", ;
"log" => "text/plain", ;
"rtf" => "text/rtf", ;
"xml" => "text/xml", ;
"xsl" => "text/xsl", ;
"bmp" => "image/bmp", ;
"gif" => "image/gif", ;
"jpg" => "image/jpeg", ;
"jpe" => "image/jpeg", ;
"jpeg" => "image/jpeg", ;
"png" => "image/png", ;
"tif" => "image/tiff", ;
"tiff" => "image/tiff", ;
"djv" => "image/vnd.djvu", ;
"djvu" => "image/vnd.djvu", ;
"ico" => "image/x-icon", ;
"xls" => "application/excel", ;
"doc" => "application/msword", ;
"pdf" => "application/pdf", ;
"ps" => "application/postscript", ;
"eps" => "application/postscript", ;
"ppt" => "application/powerpoint", ;
"bz2" => "application/x-bzip2", ;
"gz" => "application/x-gzip", ;
"tgz" => "application/x-gtar", ;
"js" => "application/x-javascript", ;
"tar" => "application/x-tar", ;
"tex" => "application/x-tex", ;
"zip" => "application/zip", ;
"midi" => "audio/midi", ;
"mp3" => "audio/mpeg", ;
"wav" => "audio/x-wav", ;
"qt" => "video/quicktime", ;
"mov" => "video/quicktime", ;
"avi" => "video/x-msvideo" }
STATIC FUNCTION GT_notifier( nEvent, xParams )

View File

@@ -3,5 +3,5 @@
#
@uhttpd.hbp
hbgd.hbc -DGD_SUPPORT
hbct.hbc