2012-10-08 22:09 UTC+0200 Viktor Szakats (harbour syenar.net)
* contrib/gtwvg/activex.prg
* contrib/gtwvg/class.prg
* contrib/gtwvg/crt.prg
* contrib/gtwvg/menubar.prg
* contrib/gtwvg/paint.prg
* contrib/gtwvg/parthdlr.prg
* contrib/gtwvg/pushbut.prg
* contrib/gtwvg/statbar.prg
* contrib/gtwvg/static.prg
* contrib/gtwvg/syswnd.prg
* contrib/gtwvg/tabpage.prg
* contrib/gtwvg/toolbar.prg
* contrib/gtwvg/wnd.prg
* extras/httpsrv/cgifunc.prg
* extras/httpsrv/cookie.prg
* extras/httpsrv/session.prg
* extras/httpsrv/uhttpd.prg
* use __defaultNIL() instead of DEFAULT TO
* deleted common.ch from all files
* contrib/hbmisc/numtxtru.prg
% minor optimization
* contrib/hbmisc/tests/numtxtru.prg
* avoid using a .dbf as output, instead use STDOUT
* added lines to make it work using hbrun
* switched output and HVM to UTF-8, so it can be
displayed on more systems (both as stdalone exe
and as hbrun script)
This commit is contained in:
@@ -50,7 +50,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.ch"
|
||||
#include "error.ch"
|
||||
#include "fileio.ch"
|
||||
|
||||
@@ -66,7 +65,7 @@ FUNCTION uhttpd_GetVars( cFields, cSeparator )
|
||||
LOCAL hHashVars := { => }
|
||||
LOCAL aField, cField, aFields
|
||||
LOCAL cName, xValue
|
||||
DEFAULT cSeparator TO "&"
|
||||
__defaultNIL( @cSeparator, "&" )
|
||||
|
||||
aFields := uhttpd_Split( cSeparator, cFields )
|
||||
|
||||
@@ -285,9 +284,9 @@ FUNCTION uhttpd_SplitString( cString, cDelim, lRemDelim, nCount )
|
||||
LOCAL aLines := {}, cLine
|
||||
LOCAL nHowMany := 0
|
||||
|
||||
DEFAULT cDelim TO ( CHR( 13 ) + CHR( 10 ) )
|
||||
DEFAULT lRemDelim TO .T.
|
||||
DEFAULT nCount TO -1
|
||||
__defaultNIL( @cDelim, ( CHR( 13 ) + CHR( 10 ) ) )
|
||||
__defaultNIL( @lRemDelim, .T. )
|
||||
__defaultNIL( @nCount, -1 )
|
||||
|
||||
//WriteToLogFile( "Splitstring: " + cStr( cString ) )
|
||||
|
||||
@@ -320,12 +319,12 @@ RETURN aLines
|
||||
*/
|
||||
FUNCTION uhttpd_URLEncode( cString, lComplete )
|
||||
#ifdef HB_USE_HBTIP
|
||||
DEFAULT lComplete TO .T.
|
||||
__defaultNIL( @lComplete, .T. )
|
||||
RETURN TIPENCODERURL_ENCODE( cString, lComplete )
|
||||
#else
|
||||
LOCAL cRet := "", i, nVal, cChar
|
||||
|
||||
DEFAULT lComplete TO .T.
|
||||
__defaultNIL( @lComplete, .T. )
|
||||
|
||||
FOR i := 1 TO Len( cString )
|
||||
cChar := SubStr( cString, i, 1)
|
||||
@@ -396,10 +395,10 @@ FUNCTION uhttpd_DateToGMT( dDate, cTime, nDayToAdd, nSecsToAdd )
|
||||
LOCAL aDays := { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }
|
||||
LOCAL aMonths := { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
|
||||
|
||||
DEFAULT dDate TO DATE()
|
||||
DEFAULT cTime TO TIME()
|
||||
DEFAULT nDayToAdd TO 0
|
||||
DEFAULT nSecsToAdd TO 0
|
||||
__defaultNIL( @dDate, DATE() )
|
||||
__defaultNIL( @cTime, TIME() )
|
||||
__defaultNIL( @nDayToAdd, 0 )
|
||||
__defaultNIL( @nSecsToAdd, 0 )
|
||||
|
||||
//Tracelog( "DateToGMT - StartingValue", dDate, cTime, nDayToAdd, nSecsToAdd )
|
||||
|
||||
@@ -438,9 +437,10 @@ FUNCTION uhttpd_AddSecondsToTime( cTime, nSecsToAdd, nDaysAdded )
|
||||
LOCAL nOneDaySeconds := 86400 // 24 * 60 * 60
|
||||
LOCAL cNewTime, nSecs
|
||||
|
||||
DEFAULT cTime TO TIME()
|
||||
DEFAULT nSecsToAdd TO 0
|
||||
DEFAULT nDaysAdded TO 0 // nDaysAdded can be already valued, so below i add to this value
|
||||
__defaultNIL( @cTime, TIME() )
|
||||
__defaultNIL( @nSecsToAdd, 0 )
|
||||
// nDaysAdded can be already valued, so below i add to this value
|
||||
__defaultNIL( @nDaysAdded, 0 )
|
||||
|
||||
IF nSecsToAdd != 0
|
||||
nSecs := Secs( cTime ) + nSecsToAdd
|
||||
@@ -456,8 +456,8 @@ RETURN cNewTime
|
||||
FUNCTION uhttpd_TimeDiffAsSeconds( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
|
||||
LOCAL aRetVal
|
||||
|
||||
DEFAULT dDateEnd TO DATE()
|
||||
DEFAULT cTimeEnd TO TIME()
|
||||
__defaultNIL( @dDateEnd, DATE() )
|
||||
__defaultNIL( @cTimeEnd, TIME() )
|
||||
|
||||
aRetVal := FT_ELAPSED( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
|
||||
|
||||
@@ -465,8 +465,8 @@ RETURN aRetVal[ 4, 2 ]
|
||||
|
||||
FUNCTION uhttpd_OutputString( cString, aTranslate, lProtected )
|
||||
LOCAL cHtml
|
||||
DEFAULT lProtected TO .F.
|
||||
DEFAULT aTranslate TO { { '"', '"' }, { ' ', ' ' } }
|
||||
__defaultNIL( @lProtected, .F. )
|
||||
__defaultNIL( @aTranslate, { { '"', '"' }, { ' ', ' ' } } )
|
||||
|
||||
//TraceLog( "OutputString( cString, aTranslate, lProtected )", cString, aTranslate, lProtected )
|
||||
IF lProtected
|
||||
@@ -487,7 +487,7 @@ FUNCTION uhttpd_HtmlSpecialChars( cString, cQuote_style )
|
||||
RETURN uhttpd_HtmlConvertChars( cString, cQuote_style, aTranslations )
|
||||
|
||||
FUNCTION uhttpd_HtmlConvertChars( cString, cQuote_style, aTranslations )
|
||||
DEFAULT cQuote_style TO "ENT_COMPAT"
|
||||
__defaultNIL( @cQuote_style, "ENT_COMPAT" )
|
||||
DO CASE
|
||||
CASE cQuote_style == "ENT_COMPAT"
|
||||
aAdd( aTranslations, { '"', '"' } )
|
||||
@@ -709,9 +709,9 @@ PROCEDURE uhttpd_WriteToLogFile( cString, cLog, lCreate )
|
||||
|
||||
cSep := hb_ps()
|
||||
|
||||
//DEFAULT cLog TO AppFullPath() + cSep + "logfile.log"
|
||||
DEFAULT cLog TO cSep + "tmp" + cSep + "logfile.log"
|
||||
DEFAULT lCreate TO .F.
|
||||
// __defaultNIL( @cLog, AppFullPath() + cSep + "logfile.log" )
|
||||
__defaultNIL( @cLog, cSep + "tmp" + cSep + "logfile.log" )
|
||||
__defaultNIL( @lCreate, .F. )
|
||||
|
||||
IF cLog != NIL
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.ch"
|
||||
#include "hbclass.ch"
|
||||
|
||||
#command IF <lexpr> THEN <*statement*> =>;
|
||||
@@ -99,10 +98,13 @@ METHOD SetCookieDefaults( cDomain, cPath, nExpireDays, nExpireSecs ) CLASS uhttp
|
||||
METHOD SetCookie( cCookieName, xValue, cDomain, cPath, cExpires, lSecure, lHttpOnly ) CLASS uhttpd_Cookie
|
||||
LOCAL cStr, nPos, nCookies
|
||||
|
||||
DEFAULT cDomain TO ::cDomain
|
||||
DEFAULT cPath TO ::cPath
|
||||
DEFAULT cExpires TO uhttpd_DateToGMT( Date(), Time(), ::nExpireDays, ::nExpireSecs )
|
||||
DEFAULT lHttpOnly TO .F.
|
||||
__defaultNIL( @cDomain, ::cDomain )
|
||||
__defaultNIL( @cPath, ::cPath )
|
||||
__defaultNIL( @lHttpOnly, .F. )
|
||||
|
||||
IF cExpires == NIL
|
||||
cExpires := uhttpd_DateToGMT( Date(), Time(), ::nExpireDays, ::nExpireSecs )
|
||||
ENDIF
|
||||
|
||||
::lHttpOnly := lHttpOnly
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.ch"
|
||||
#include "hbclass.ch"
|
||||
#include "fileio.ch"
|
||||
#include "directry.ch"
|
||||
@@ -165,8 +164,8 @@ METHOD New( cSessionName, cSessionPath ) CLASS uhttpd_Session
|
||||
|
||||
//hb_ToOutDebug( "cSessionName = %s, cSessionPath = %s\n\r", cSessionName, cSessionPath )
|
||||
|
||||
DEFAULT cSessionName TO "SESSION"
|
||||
DEFAULT cSessionPath TO ::cSavePath
|
||||
__defaultNIL( @cSessionName, "SESSION" )
|
||||
__defaultNIL( @cSessionPath, ::cSavePath )
|
||||
|
||||
//::cSID := ::GenerateSID()
|
||||
|
||||
@@ -414,7 +413,7 @@ METHOD GetSessionVars( aHashVars, cFields, cSeparator ) CLASS uhttpd_Session
|
||||
LOCAL cSessPrefix := ::cName + "_"
|
||||
LOCAL cFieldsNotInSession := ""
|
||||
LOCAL cSessVarName
|
||||
DEFAULT cSeparator TO "&"
|
||||
__defaultNIL( @cSeparator, "&" )
|
||||
|
||||
aFields := hb_regexSplit( cSeparator, cFields )
|
||||
|
||||
@@ -490,8 +489,9 @@ METHOD GenerateSID( cCRCKey ) CLASS uhttpd_Session
|
||||
LOCAL nLenTemp
|
||||
//LOCAL a := 0
|
||||
|
||||
//DEFAULT cCRCKey TO "3InFoW4lL5" // Max Lenght must to be 10
|
||||
DEFAULT cCRCKey TO MY_CRCKEY // Max Lenght must to be 10
|
||||
// Max Lenght must to be 10
|
||||
// __defaultNIL( @cCRCKey, "3InFoW4lL5" )
|
||||
__defaultNIL( @cCRCKey, MY_CRCKEY )
|
||||
|
||||
/* Let's generate the sequence */
|
||||
//cSID := Space( nLenSID )
|
||||
@@ -529,9 +529,10 @@ METHOD CheckSID( cSID, cCRCKey ) CLASS uhttpd_Session
|
||||
LOCAL lOk
|
||||
//LOCAL a := 0
|
||||
|
||||
DEFAULT ::cSID TO ::RegenerateID()
|
||||
DEFAULT cSID TO ::cSID
|
||||
DEFAULT cCRCKey TO MY_CRCKEY // Max Lenght must to be 10
|
||||
__defaultNIL( @::cSID, ::RegenerateID() )
|
||||
__defaultNIL( @cSID, ::cSID )
|
||||
// Max Lenght must to be 10
|
||||
__defaultNIL( @cCRCKey, MY_CRCKEY )
|
||||
|
||||
//hb_toOutDebug( "cSID = %s, ::cSID = %s\n\r", hb_valtoexp( cSID ), hb_valtoexp( ::cSID ) )
|
||||
|
||||
@@ -592,7 +593,7 @@ METHOD SessionRead( cID ) CLASS uhttpd_Session
|
||||
LOCAL cBuffer
|
||||
LOCAL nRetry := 0
|
||||
|
||||
DEFAULT cID TO ::cSID
|
||||
__defaultNIL( @cID, ::cSID )
|
||||
cFile := ::cSavePath + hb_ps() + ::cName + "_" + cID
|
||||
//TraceLog( "SessionRead: cFile", cFile )
|
||||
IF File( cFile )
|
||||
@@ -632,8 +633,8 @@ METHOD SessionWrite( cID, cData ) CLASS uhttpd_Session
|
||||
LOCAL nRetry := 0
|
||||
|
||||
//TraceLog( "SessionWrite() - cID, cData", cID, cData )
|
||||
DEFAULT cID TO ::cSID
|
||||
DEFAULT cData TO ""
|
||||
__defaultNIL( @cID, ::cSID )
|
||||
__defaultNIL( @cData, "" )
|
||||
|
||||
nFileSize := Len( cData )
|
||||
|
||||
@@ -671,7 +672,7 @@ METHOD SessionDestroy( cID ) CLASS uhttpd_Session
|
||||
LOCAL nRetry := 0
|
||||
|
||||
//TraceLog( "SessionDestroy() - cID", cID )
|
||||
DEFAULT cID TO ::cSID
|
||||
__defaultNIL( @cID, ::cSID )
|
||||
|
||||
_SESSION := { => }
|
||||
::oCookie:DeleteCookie( ::cName )
|
||||
@@ -706,7 +707,7 @@ METHOD SessionGC( nMaxLifeTime ) CLASS uhttpd_Session
|
||||
LOCAL nSecs
|
||||
LOCAL aDir, aFile
|
||||
|
||||
DEFAULT nMaxLifeTime TO ::nGc_MaxLifeTime
|
||||
__defaultNIL( @nMaxLifeTime, ::nGc_MaxLifeTime )
|
||||
aDir := Directory( ::cSavePath + hb_ps() + ::cName + "_*.*" )
|
||||
|
||||
FOR EACH aFile IN aDir
|
||||
@@ -724,8 +725,8 @@ METHOD SessionGC( nMaxLifeTime ) CLASS uhttpd_Session
|
||||
STATIC FUNCTION TimeDiffAsSeconds( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
|
||||
LOCAL aRetVal
|
||||
|
||||
DEFAULT dDateEnd TO DATE()
|
||||
DEFAULT cTimeEnd TO TIME()
|
||||
__defaultNIL( @dDateEnd, DATE() )
|
||||
__defaultNIL( @cTimeEnd, TIME() )
|
||||
|
||||
aRetVal := FT_ELAPSED( dDateStart, dDateEnd, cTimeStart, cTimeEnd )
|
||||
|
||||
|
||||
@@ -85,7 +85,6 @@
|
||||
#define FIXED_THREADS // This force application to use fixed number of running threads and no service threads
|
||||
|
||||
#include "fileio.ch"
|
||||
#include "common.ch"
|
||||
#include "inkey.ch"
|
||||
#include "error.ch"
|
||||
#include "hbmemory.ch"
|
||||
@@ -1639,8 +1638,9 @@ PROCEDURE uhttpd_SetStatusCode(nStatusCode)
|
||||
|
||||
|
||||
PROCEDURE uhttpd_SetHeader( cType, cValue )
|
||||
//LOCAL nI
|
||||
//DEFAULT lReplace TO .T. // Needed from SetCookie()
|
||||
// LOCAL nI
|
||||
// // Needed from SetCookie()
|
||||
// __defaultNIL( @lReplace, .T. )
|
||||
|
||||
hb_HSet( _HTTP_RESPONSE, cType, cValue )
|
||||
|
||||
@@ -1658,7 +1658,7 @@ PROCEDURE uhttpd_SetHeader( cType, cValue )
|
||||
FUNCTION uhttpd_GetHeader( cType )
|
||||
RETURN uhttpd_HGetValue( _HTTP_RESPONSE, cType )
|
||||
/*
|
||||
DEFAULT nPos TO 1
|
||||
__defaultNIL( @nPos, 1 )
|
||||
|
||||
nPos := hb_HPos( hHash, cKey ))
|
||||
IF ( nPos := ASCAN( t_aHeader, {| x | UPPER( x[ 1 ] ) == UPPER( cType ) }, nPos ) ) > 0
|
||||
@@ -1802,7 +1802,7 @@ FUNCTION uhttpd_split( cSeparator, cString, nMax )
|
||||
LOCAL aRet := {}, nI
|
||||
LOCAL nIter := 0
|
||||
|
||||
DEFAULT nMax TO 0
|
||||
__defaultNIL( @nMax, 0 )
|
||||
|
||||
DO WHILE ( nI := AT( cSeparator, cString ) ) > 0
|
||||
AADD( aRet, LEFT( cString, nI - 1 ) )
|
||||
|
||||
Reference in New Issue
Block a user