2010-11-24 16:55 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbhttpd/core.prg
  * contrib/hbhttpd/widgets.prg
  * contrib/hbhttpd/tests/webapp.prg
    + Added :bTrace block to server class.
    + Changed to use bTrace block for any trace output, 
      meaning there is no explicit '?' command anymore 
      in server lib.
This commit is contained in:
Viktor Szakats
2010-11-24 15:56:06 +00:00
parent 55da2b05b6
commit 5bfb953927
4 changed files with 33 additions and 24 deletions

View File

@@ -16,6 +16,15 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-11-24 16:55 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbhttpd/core.prg
* contrib/hbhttpd/widgets.prg
* contrib/hbhttpd/tests/webapp.prg
+ Added :bTrace block to server class.
+ Changed to use bTrace block for any trace output,
meaning there is no explicit '?' command anymore
in server lib.
2010-11-24 16:11 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
! Fixed RTE in language file generation in some side case,
@@ -41,7 +50,7 @@
* Renamed.
; It's still a lie though. This is broken RDD now. If we
won't have any contributor picking this up from this
stage. This contrib will be moved to examples.
stage, this contrib will be moved to examples.
2010-11-24 12:08 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
- contrib/rddbmcdx/rddbmcdx.hbp
@@ -53,7 +62,7 @@
* contrib/rddbmcdx/bmdbfcdx.c
* Renaming to make it index-type agnostic.
* Trying to hunt down "CDX" in source code.
Huge quanity of them remain.
Huge quantity of them remain.
* contrib/hbhttpd/core.prg
! Fixed unreachable code after BREAK.
@@ -68,7 +77,7 @@
it doesn't build, due to interdependencies and other
stuff which I don't understand.
* Disabled this contrib.
; TODO: Rename it to rddbm.
; TODO: Rename it to rddbm. [DONE]
2010-11-24 11:23 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rdd/dbfcdx/dbfcdx1.c

View File

@@ -3,7 +3,6 @@
*/
#include "hbclass.ch"
#include "common.ch"
#include "error.ch"
#include "hbsocket.ch"
@@ -36,6 +35,7 @@ CREATE CLASS UHttpd
DATA cBindAddress INIT "0.0.0.0"
DATA bLogAccess INIT {|| NIL }
DATA bLogError INIT {|| NIL }
DATA bTrace INIT {|| NIL }
DATA bIdle INIT {|| NIL }
DATA aMount INIT { => }
@@ -120,8 +120,8 @@ METHOD RUN() CLASS UHttpd
ENDIF
ELSE
hb_mutexQueueInfo( Self:hmtxQueue, @nWaiters )
? "New connection", hSocket
? "Waiters:", nWaiters
Eval( Self:bTrace, "New connection", hSocket )
Eval( Self:bTrace, "Waiters:", nWaiters )
IF nWaiters < 2 .AND. Len( aThreads ) < THREAD_COUNT_MAX
/*
We need two threads in worst case. If first thread becomes a sessioned
@@ -203,13 +203,13 @@ STATIC FUNCTION ProcessConnection( oServer )
ELSE
IF nLen == - 1 .AND. hb_socketGetError() == HB_SOCKET_ERR_TIMEOUT
nLen := 0
? "recv() timeout", hSocket
Eval( oServer:bTrace, "recv() timeout", hSocket )
ENDIF
ENDIF
ENDDO
IF nLen == - 1
? "recv() error:", hb_socketGetError()
Eval( oServer:bTrace, "recv() error:", hb_socketGetError() )
ELSEIF nLen == 0 /* connection closed */
ELSE
@@ -234,7 +234,7 @@ STATIC FUNCTION ProcessConnection( oServer )
server["SERVER_PORT"] := aI[HB_SOCKET_ADINFO_PORT]
ENDIF
? Left( cRequest, At( CR_LF + CR_LF, cRequest ) + 1 )
Eval( oServer:bTrace, Left( cRequest, At( CR_LF + CR_LF, cRequest ) + 1 ) )
nReqLen := ParseRequestHeader( @cRequest )
IF nReqLen == NIL
@@ -250,10 +250,10 @@ STATIC FUNCTION ProcessConnection( oServer )
ENDDO
IF nLen == - 1
? "recv() error:", hb_socketGetError()
Eval( oServer:bTrace, "recv() error:", hb_socketGetError() )
ELSEIF nLen == 0 /* connection closed */
ELSE
? cRequest
Eval( oServer:bTrace, cRequest )
ParseRequestBody( Left( cRequest, nReqLen ) )
cRequest := SubStr( cRequest, nReqLen + 1 )
@@ -286,7 +286,7 @@ STATIC FUNCTION ProcessConnection( oServer )
BREAK
ENDIF
ENDIF
? "Close connection1", hSocket
Eval( oServer:bTrace, "Close connection1", hSocket )
hb_socketShutdown( hSocket )
hb_socketClose( hSocket )
END SEQUENCE
@@ -374,7 +374,7 @@ STATIC FUNCTION ProcessRequest( oServer, hSocket, cBuffer )
ENDIF
IF Lower( UGetHeader( "Connection" ) ) == "close" .OR. server["SERVER_PROTOCOL"] == "HTTP/1.0"
? "Close connection2", hSocket
Eval( oServer:bTrace, "Close connection2", hSocket )
hb_socketShutdown( hSocket )
hb_socketClose( hSocket )
ELSE
@@ -387,7 +387,7 @@ STATIC FUNCTION ProcessRequest( oServer, hSocket, cBuffer )
ENDIF
IF ! hb_mutexSubscribe( hmtx, SESSION_TIMEOUT, @aData ) .OR. aData == NIL
? "Session exit"
Eval( oServer:bTrace, "Session exit" )
hb_mutexLock( oServer:hmtxSession )
HB_HDel( oServer:aSession, cSID )
hb_mutexUnlock( oServer:hmtxSession )
@@ -414,7 +414,7 @@ STATIC FUNCTION ProcessRequest( oServer, hSocket, cBuffer )
session := NIL
ELSE
/* session already exists */
? "session pries", server["SCRIPT_NAME"]
Eval( oServer:bTrace, "session pries", server["SCRIPT_NAME"] )
hb_mutexNotify( oServer:aSession[cSID, 2], { hSocket, cBuffer, oServer:aMount[cMount, 1], cPath, server, get, post, cookie, oServer:aSession[cSID, 3] } )
hb_mutexUnlock( oServer:hmtxSession )
ENDIF
@@ -531,7 +531,7 @@ STATIC FUNCTION ParseRequestBody( cRequest )
RETURN NIL
STATIC FUNCTION MakeResponse()
STATIC FUNCTION MakeResponse( oServer )
LOCAL cRet
@@ -604,7 +604,7 @@ STATIC FUNCTION MakeResponse()
UAddHeader( "Content-Length", hb_ntos( Len( t_cResult ) ) )
AEval( t_aHeader, {|x| cRet += x[1] + ": " + x[2] + CR_LF } )
cRet += CR_LF
? cRet
Eval( oServer:bTrace, cRet )
cRet += t_cResult
RETURN cRet
@@ -613,13 +613,13 @@ STATIC PROCEDURE SendResponse( oServer, hSocket )
LOCAL cSend, nLen
cSend := MakeResponse()
cSend := MakeResponse( oServer )
// ? cSend
// Eval( oServer:bTrace, cSend )
DO WHILE Len( cSend ) > 0
IF ( nLen := hb_socketSend( hSocket, cSend ) ) == - 1
? "send() error:", hb_socketGetError(), hSocket
Eval( oServer:bTrace, "send() error:", hb_socketGetError(), hSocket )
EXIT
ELSEIF nLen > 0
cSend := SubStr( cSend, nLen + 1 )
@@ -885,7 +885,9 @@ PROCEDURE UProcFiles( cFileName, lIndex )
LOCAL aDir, aF, nI, cI, tDate, tHDate
DEFAULT lIndex TO .F.
IF ! hb_isLogical( lIndex )
lIndex := .F.
ENDIF
cFileName := StrTran( cFileName, "//", "/" )

View File

@@ -2,8 +2,6 @@
* $Id$
*/
#include "simpleio.ch"
REQUEST DBFCDX
MEMVAR server, get, post, cookie, session
@@ -89,6 +87,7 @@ FUNCTION Main()
oServer:bLogAccess := {| m | oLogAccess:Add( m + hb_eol() ) }
oServer:bLogError := {| m | oLogError:Add( m + hb_eol() ) }
oServer:bTrace := {| ... | QOut( ... ) }
oServer:nPort := 8002
oServer:bIdle := { |o| iif( HB_FILEEXISTS( ".uhttpd.stop" ), ( FErase(".uhttpd.stop" ), o:Stop() ), NIL ) }

View File

@@ -491,7 +491,6 @@ PROCEDURE UProcWidgets( cURL, aMap )
LOCAL aStack, aURL, aFrame, cI, nI, nL, lRet
? "cURL:", cURL
IF HB_HHasKey( aMap, cURL )
// aStack[i] = {url_part, function, variables}
IF ( aStack := hb_HGetDef( session, "_ustack" ) ) == NIL