From 14bb643a9abe96206579794233cb8deb3560afc1 Mon Sep 17 00:00:00 2001 From: Francesco Saverio Giudice Date: Fri, 31 Jul 2009 08:28:22 +0000 Subject: [PATCH] 2009-07-31 10:26 UTC+0200 Francesco Saverio Giudice (info/at/fsgiudice.com) * harbour/examples/httpsrv/uhttpd.prg * Uploaded Handler_HrbScript() changes missed in previous upload. I need vacations! --- harbour/ChangeLog | 5 +++ harbour/examples/httpsrv/uhttpd.prg | 49 +++++++++++++++-------------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9844b2e509..fb96e63365 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,11 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-31 10:26 UTC+0200 Francesco Saverio Giudice (info/at/fsgiudice.com) + * harbour/examples/httpsrv/uhttpd.prg + * Uploaded Handler_HrbScript() changes missed in previous upload. + I need vacations! + 2009-07-31 10:16 UTC+0200 Francesco Saverio Giudice (info/at/fsgiudice.com) * harbour/Changelog * fixed wrong month in previous updates diff --git a/harbour/examples/httpsrv/uhttpd.prg b/harbour/examples/httpsrv/uhttpd.prg index e1b5b6e2f6..2ac4005b6e 100644 --- a/harbour/examples/httpsrv/uhttpd.prg +++ b/harbour/examples/httpsrv/uhttpd.prg @@ -2814,37 +2814,40 @@ STATIC FUNCTION Handler_HrbScript( cFileName ) cHRBBody := HRB_LoadFromFile( uhttpd_OSFileName( cFileName ) ) ENDIF IF hb_mutexLock( s_hmtxHRB ) - IF HRB_ACTIVATE_CACHE - // caching modules - IF !hb_HHasKey( s_hHRBModules, cFileName ) - hb_HSet( s_hHRBModules, cFileName, HRB_LoadFromFile( uhttpd_OSFileName( cFileName ) ) ) + BEGIN SEQUENCE + IF HRB_ACTIVATE_CACHE + // caching modules + IF !hb_HHasKey( s_hHRBModules, cFileName ) + hb_HSet( s_hHRBModules, cFileName, HRB_LoadFromFile( uhttpd_OSFileName( cFileName ) ) ) + ENDIF + cHRBBody := s_hHRBModules[ cFileName ] ENDIF - cHRBBody := s_hHRBModules[ cFileName ] - ENDIF - WriteToConsole( "Executing: " + cFileName ) - IF !EMPTY( pHRB := HB_HRBLOAD( cHRBBody ) ) + WriteToConsole( "Executing: " + cFileName ) + IF !EMPTY( pHRB := HB_HRBLOAD( cHRBBody ) ) - // save current directory - cCurPath := CurDrive() + hb_osDriveSeparator() + HB_OSPathSeparator() + CurDir() - // Change dir to document root - DirChange( s_cDocumentRoot ) + // save current directory + cCurPath := CurDrive() + hb_osDriveSeparator() + HB_OSPathSeparator() + CurDir() + // Change dir to document root + DirChange( s_cDocumentRoot ) - xResult := HRBMAIN() + xResult := HRBMAIN() #ifdef DEBUG_ACTIVE - hb_ToOutDebug( "Handler_HrbScript(): cFileName = %s,\n\rcCurPath = %s,\n\rs_cDocumentRoot = %s,\n\rpHRB = %s,\n\rxResult = %s\n\r", ; - cFileName, cCurPath, s_cDocumentRoot, pHRB, xResult ) + hb_ToOutDebug( "Handler_HrbScript(): cFileName = %s,\n\rcCurPath = %s,\n\rs_cDocumentRoot = %s,\n\rpHRB = %s,\n\rxResult = %s\n\r", ; + cFileName, cCurPath, s_cDocumentRoot, pHRB, xResult ) #endif - // return to original folder - DirChange( cCurPath ) + // return to original folder + DirChange( cCurPath ) - HB_HRBUNLOAD( pHRB ) - ELSE - uhttpd_SetStatusCode( 404 ) - t_cErrorMsg := "File does not exist: " + cFileName - ENDIF - hb_mutexUnlock( s_hmtxHRB ) + HB_HRBUNLOAD( pHRB ) + ELSE + uhttpd_SetStatusCode( 404 ) + t_cErrorMsg := "File does not exist: " + cFileName + ENDIF + ALWAYS + hb_mutexUnlock( s_hmtxHRB ) + END SEQUENCE ENDIF