2013-06-06 01:56 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbtip/client.prg
! Fixed: to test if a connection is available actually or not
before sending other info. This fixes a RTE when a SSL over
HTTP request was made and internet access was not available.

* contrib/hbtip/httpcli.prg
+ Added: METHOD Head() for HEAD verb of HTTP interface.

METHOD SetConnectionPersistent()
This does not send "Connection: close" header entry.
Useful in cases where many requests are required to
be submitted under one session. :close() may be
called to close the connection explicitly.

METHOD IsConnectionAlive()
It allows the application to test connection's state
and facilitates to take alternate action.
This commit is contained in:
Pritpal Bedi
2013-06-06 02:07:49 -07:00
parent f779685e1a
commit 208734b18e
3 changed files with 37 additions and 5 deletions

View File

@@ -10,6 +10,25 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-06-06 01:56 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbtip/client.prg
! Fixed: to test if a connection is available actually or not
before sending other info. This fixes a RTE when a SSL over
HTTP request was made and internet access was not available.
* contrib/hbtip/httpcli.prg
+ Added: METHOD Head() for HEAD verb of HTTP interface.
METHOD SetConnectionPersistent()
This does not send "Connection: close" header entry.
Useful in cases where many requests are required to
be submitted under one session. :close() may be
called to close the connection explicitly.
METHOD IsConnectionAlive()
It allows the application to test connection's state
and facilitates to take alternate action.
2013-06-05 23:40 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/gtwvg/wvgcore.c
+ Added: function WVT_DRAWPICTUREEX

View File

@@ -750,6 +750,10 @@ METHOD inetConnect( cServer, nPort, SocketCon ) CLASS TIPClient
hb_inetConnect( cServer, nPort, SocketCon )
IF hb_inetStatus( SocketCon ) == -1 /* IMPORTANT: if internet connection is off and address is not resolved and it is SSL compliant, then RTE , must be avoided - Pritpal*/
RETURN NIL
ENDIF
IF ! Empty( ::nDefaultSndBuffSize )
::InetSndBufSize( SocketCon, ::nDefaultSndBuffSize )
ENDIF

View File

@@ -65,23 +65,27 @@ CREATE CLASS TIPClientHTTP FROM TIPClient
VAR cAuthMode INIT ""
VAR cBoundary
VAR aAttachments INIT {}
VAR lPersistent INIT .F.
METHOD New( oUrl, xTrace, oCredentials )
METHOD Get( cQuery )
METHOD Post( xPostData, cQuery )
METHOD Put( xPostData, cQuery )
METHOD Delete( xPostData, cQuery )
METHOD Head( xPostData, cQuery )
METHOD ReadHeaders( lClear )
METHOD Read( nLen )
METHOD UseBasicAuth() INLINE ::cAuthMode := "Basic"
METHOD UseBasicAuth() INLINE ::cAuthMode := "Basic"
METHOD ReadAll()
METHOD SetCookie
METHOD GetCookies
METHOD Boundary
METHOD setCookie( cLine )
METHOD getcookies( cHost, cPath )
METHOD Boundary( nType )
METHOD Attach( cName, cFileName, cType )
METHOD PostMultiPart( xPostData, cQuery )
METHOD WriteAll( cFile )
METHOD StandardFields()
METHOD SetConnectionPersistent() INLINE ::lPersistent := .T.
METHOD IsConnectionAlive() INLINE ::inetErrorCode( ::SocketCon ) == 0
PROTECTED:
@@ -125,6 +129,9 @@ METHOD Put( xPostData, cQuery ) CLASS TIPClientHTTP
METHOD Delete( xPostData, cQuery ) CLASS TIPClientHTTP
RETURN ::postByVerb( xPostData, cQuery, "DELETE" )
METHOD Head( xPostData, cQuery ) CLASS TIPClientHTTP
RETURN ::postByVerb( xPostData, cQuery, "HEAD" )
METHOD PostByVerb( xPostData, cQuery, cVerb ) CLASS TIPClientHTTP
LOCAL cData, nI, cTmp, y
@@ -193,7 +200,9 @@ METHOD StandardFields() CLASS TIPClientHTTP
::inetSendAll( ::SocketCon, "Host: " + ::oUrl:cServer + ::cCRLF )
::inetSendAll( ::SocketCon, "User-agent: " + ::cUserAgent + ::cCRLF )
::inetSendAll( ::SocketCon, "Connection: close" + ::cCRLF )
IF ! ::lPersistent
::inetSendAll( ::SocketCon, "Connection: close" + ::cCRLF )
ENDIF
// Perform a basic authentication request
IF ::cAuthMode == "Basic" .AND. !( "Authorization" $ ::hFields )