diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 97da2196f5..03a68ac6e3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,22 @@ The license applies to all entries newer than 2009-04-28. */ +2011-05-06 13:38 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbtip/encurl.prg + * contrib/hbtip/hbtip.hbx + * contrib/hbtip/cgi.prg + * contrib/hbtip/url.prg + * contrib/hbtip/httpcli.prg + * contrib/hbtip/encurlc.c + * promoted to documented level (renamed, INCOMPATIBLE): + __TIP_URL_ENCODE() -> TIP_URL_ENCODE() + __TIP_URL_DECODE() -> TIP_URL_DECODE() + + * contrib/hbtip/encb64c.c + * contrib/hbtip/encb64.prg + % deleted __TIP_BASE64_ENCODE() + replaced by core HB_BASE64ENCODE() + 2011-05-06 13:14 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * INSTALL * little discouragment to use HB_QTPATH diff --git a/harbour/contrib/hbtip/cgi.prg b/harbour/contrib/hbtip/cgi.prg index 87eaec7edd..92098727f5 100644 --- a/harbour/contrib/hbtip/cgi.prg +++ b/harbour/contrib/hbtip/cgi.prg @@ -136,7 +136,7 @@ METHOD New() CLASS TIpCgi FOR nCount := 1 TO nLen aVar := hb_ATokens( aTemp[ nCount ], "=" ) IF Len( aVar ) == 2 - ::hPosts[ AllTrim( __tip_url_Decode( aVar[ 1 ] ) ) ] := __tip_url_Decode( aVar[ 2 ] ) + ::hPosts[ AllTrim( tip_URLDecode( aVar[ 1 ] ) ) ] := tip_URLDecode( aVar[ 2 ] ) ENDIF NEXT ENDIF @@ -150,7 +150,7 @@ METHOD New() CLASS TIpCgi FOR nCount := 1 TO nLen aVar := hb_ATokens( aTemp[ nCount ], "=" ) IF Len( aVar ) == 2 - ::hGets[ AllTrim( __tip_url_Decode( aVar[ 1 ] ) ) ] := __tip_url_Decode( aVar[ 2 ] ) + ::hGets[ AllTrim( tip_URLDecode( aVar[ 1 ] ) ) ] := tip_URLDecode( aVar[ 2 ] ) ENDIF NEXT ENDIF @@ -165,7 +165,7 @@ METHOD New() CLASS TIpCgi FOR nCount := 1 TO nLen aVar := hb_ATokens( aTemp[ nCount ], "=" ) IF Len( aVar ) == 2 - ::hCookies[ AllTrim( __tip_url_Decode( aVar[ 1 ] ) ) ] := __tip_url_Decode( aVar[ 2 ] ) + ::hCookies[ AllTrim( tip_URLDecode( aVar[ 1 ] ) ) ] := tip_URLDecode( aVar[ 2 ] ) ENDIF NEXT ENDIF diff --git a/harbour/contrib/hbtip/encb64.prg b/harbour/contrib/hbtip/encb64.prg index 52e5a1b1b1..63369d54b6 100644 --- a/harbour/contrib/hbtip/encb64.prg +++ b/harbour/contrib/hbtip/encb64.prg @@ -72,4 +72,4 @@ METHOD Encode( cData ) CLASS TIPEncoderBase64 RETURN __tip_base64_encode( cData, ::bHttpExcept ) METHOD Decode( cData ) CLASS TIPEncoderBase64 - RETURN __tip_base64_decode( cData ) + RETURN hb_base64decode( cData ) diff --git a/harbour/contrib/hbtip/encb64c.c b/harbour/contrib/hbtip/encb64c.c index 46f1ceb3de..319334ca46 100644 --- a/harbour/contrib/hbtip/encb64c.c +++ b/harbour/contrib/hbtip/encb64c.c @@ -163,86 +163,3 @@ HB_FUNC( __TIP_BASE64_ENCODE ) /* this function also adds a zero */ hb_retclen_buffer( cRet, nPosRet ); } - -HB_FUNC( __TIP_BASE64_DECODE ) -{ - const char * cData = hb_parc( 1 ); - HB_UCHAR * cRet; - HB_ISIZ nLen = hb_parclen( 1 ); - HB_ISIZ nPos = 0, nPosRet = 0, nPosBlock = 0; - HB_UCHAR cElem; - - if( ! cData ) - { - hb_errRT_BASE( EG_ARG, 3012, NULL, - HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) ); - return; - } - - if( ! nLen ) - { - hb_retc_null(); - return; - } - - - /* we know exactly the renturned length. */ - cRet = ( HB_UCHAR * ) hb_xgrab( ( nLen / 4 + 1 ) * 3 ); - - while( nPos < nLen ) - { - cElem = cData[ nPos ]; - - if( cElem >= 'A' && cElem <= 'Z' ) - cElem -= 'A'; - else if( cElem >= 'a' && cElem <= 'z' ) - cElem = cElem - 'a' + 26; - else if( cElem >= '0' && cElem <= '9' ) - cElem = cElem - '0' + 52; - else if( cElem == '+' ) - cElem = 62; - else if( cElem == '/' ) - cElem = 63; - else if( cElem == '=' ) /* end of stream? */ - break; - else /* RFC 2045 specifies characters not in base64 must be ignored */ - { - nPos++; - continue; - } - - switch( nPosBlock ) - { - case 0: - cRet[ nPosRet ] = cElem << 2; - nPosBlock++; - break; - case 1: - /* higer bits are zeros */ - cRet[ nPosRet ] |= cElem >> 4; - nPosRet++; - cRet[ nPosRet ] = cElem << 4; - nPosBlock++; - break; - case 2: - /* higer bits are zeros */ - cRet[ nPosRet ] |= cElem >> 2; - nPosRet++; - cRet[ nPosRet ] = cElem << 6; - nPosBlock++; - break; - case 3: - cRet[ nPosRet ] |= cElem; - nPosRet++; - nPosBlock = 0; - break; - } - - nPos++; - } - - /* this function also adds a zero */ - /* hopefully reduce the size of cRet */ - cRet = ( HB_UCHAR * ) hb_xrealloc( cRet, nPosRet + 1 ); - hb_retclen_buffer( ( char * ) cRet, nPosRet ); -} diff --git a/harbour/contrib/hbtip/encurl.prg b/harbour/contrib/hbtip/encurl.prg index ea1adf32c1..d1fb058dbb 100644 --- a/harbour/contrib/hbtip/encurl.prg +++ b/harbour/contrib/hbtip/encurl.prg @@ -63,7 +63,7 @@ METHOD New() CLASS TIPEncoderURL RETURN Self METHOD Encode( cData ) CLASS TIPEncoderURL - RETURN __tip_url_encode( cData ) + RETURN tip_URLencode( cData ) METHOD Decode( cData ) CLASS TIPEncoderURL - RETURN __tip_url_decode( cData ) + RETURN tip_URLdecode( cData ) diff --git a/harbour/contrib/hbtip/encurlc.c b/harbour/contrib/hbtip/encurlc.c index 7f7551ea19..56933b1a8e 100644 --- a/harbour/contrib/hbtip/encurlc.c +++ b/harbour/contrib/hbtip/encurlc.c @@ -54,7 +54,7 @@ #include "hbapiitm.h" #include "hbapierr.h" -HB_FUNC( __TIP_URL_ENCODE ) +HB_FUNC( TIP_URLENCODE ) { const char * cData = hb_parc( 1 ); HB_ISIZ nLen = hb_parclen( 1 ); @@ -116,7 +116,7 @@ HB_FUNC( __TIP_URL_ENCODE ) hb_retclen_buffer( cRet, nPosRet ); } -HB_FUNC( __TIP_URL_DECODE ) +HB_FUNC( TIP_URLDECODE ) { const char * cData = hb_parc( 1 ); HB_ISIZ nLen = hb_parclen( 1 ); diff --git a/harbour/contrib/hbtip/hbtip.hbx b/harbour/contrib/hbtip/hbtip.hbx index 92ff348c9d..97566cc50e 100644 --- a/harbour/contrib/hbtip/hbtip.hbx +++ b/harbour/contrib/hbtip/hbtip.hbx @@ -68,12 +68,11 @@ DYNAMIC TIP_JSONSPECIALCHARS DYNAMIC TIP_MIMETYPE DYNAMIC TIP_SSL DYNAMIC TIP_TIMESTAMP +DYNAMIC TIP_URLDECODE +DYNAMIC TIP_URLENCODE DYNAMIC TURL -DYNAMIC __TIP_BASE64_DECODE DYNAMIC __TIP_BASE64_ENCODE DYNAMIC __TIP_PSTRCOMPI -DYNAMIC __TIP_URL_DECODE -DYNAMIC __TIP_URL_ENCODE #if defined( __HBEXTREQ__ ) .OR. defined( __HBEXTERN__HBTIP__REQUEST ) #uncommand DYNAMIC => EXTERNAL diff --git a/harbour/contrib/hbtip/httpcli.prg b/harbour/contrib/hbtip/httpcli.prg index 76e064fa3d..1957fb3278 100644 --- a/harbour/contrib/hbtip/httpcli.prg +++ b/harbour/contrib/hbtip/httpcli.prg @@ -132,9 +132,9 @@ METHOD Post( xPostData, cQuery ) CLASS tIPClientHTTP cData := "" y := Len( xPostData ) FOR nI := 1 TO y - cTmp := __tip_url_Encode( AllTrim( hb_cStr( hb_HKeyAt( xPostData, nI ) ) ) ) + cTmp := tip_URLEncode( AllTrim( hb_cStr( hb_HKeyAt( xPostData, nI ) ) ) ) cData += cTmp + "=" - cTmp := __tip_url_Encode( hb_cStr( hb_HValueAt( xPostData, nI ) ) ) + cTmp := tip_URLEncode( hb_cStr( hb_HValueAt( xPostData, nI ) ) ) cData += cTmp IF nI != y cData += "&" @@ -144,9 +144,9 @@ METHOD Post( xPostData, cQuery ) CLASS tIPClientHTTP cData := "" y := Len( xPostData ) FOR nI := 1 TO y - cTmp := __tip_url_Encode( AllTrim( hb_cStr( xPostData[ nI, 1 ] ) ) ) + cTmp := tip_URLEncode( AllTrim( hb_cStr( xPostData[ nI, 1 ] ) ) ) cData += cTmp + "=" - cTmp := __tip_url_Encode( hb_cStr( xPostData[ nI, 2 ] ) ) + cTmp := tip_URLEncode( hb_cStr( xPostData[ nI, 2 ] ) ) cData += cTmp IF nI != y cData += "&" @@ -514,17 +514,17 @@ METHOD PostMultiPart( xPostData, cQuery ) CLASS tIPClientHTTP ELSEIF hb_isHash( xPostData ) y := Len( xPostData ) FOR nI := 1 TO y - cTmp := __tip_url_Encode( AllTrim( hb_cStr( hb_HKeyAt( xPostData, nI ) ) ) ) + cTmp := tip_URLEncode( AllTrim( hb_cStr( hb_HKeyAt( xPostData, nI ) ) ) ) cData += cBound + cCrlf + 'Content-Disposition: form-data; name="' + cTmp + '"' + cCrlf + cCrLf - cTmp := __tip_url_Encode( AllTrim( hb_cStr( hb_HValueAt( xPostData, nI ) ) ) ) + cTmp := tip_URLEncode( AllTrim( hb_cStr( hb_HValueAt( xPostData, nI ) ) ) ) cData += cTmp + cCrLf NEXT ELSEIF hb_isArray( xPostData ) y := Len( xPostData ) FOR nI := 1 TO y - cTmp := __tip_url_Encode( AllTrim( hb_cStr( xPostData[ nI, 1 ] ) ) ) + cTmp := tip_URLEncode( AllTrim( hb_cStr( xPostData[ nI, 1 ] ) ) ) cData += cBound + cCrlf + 'Content-Disposition: form-data; name="' + cTmp + '"' + cCrlf + cCrLf - cTmp := __tip_url_Encode( AllTrim( hb_cStr( xPostData[ nI, 2 ] ) ) ) + cTmp := tip_URLEncode( AllTrim( hb_cStr( xPostData[ nI, 2 ] ) ) ) cData += cTmp + cCrLf NEXT diff --git a/harbour/contrib/hbtip/url.prg b/harbour/contrib/hbtip/url.prg index 14ff49cc9a..04d42a48ff 100644 --- a/harbour/contrib/hbtip/url.prg +++ b/harbour/contrib/hbtip/url.prg @@ -207,8 +207,8 @@ METHOD AddGetForm( xPostData ) IF hb_isHash( xPostData ) y := Len( xPostData ) FOR nI := 1 TO y - cData += __tip_url_Encode( AllTrim( hb_cStr( hb_HKeyAt( xPostData, nI ) ) ) ) + "=" - cData += __tip_url_Encode( AllTrim( hb_cStr( hb_HValueAt( xPostData, nI ) ) ) ) + cData += tip_URLEncode( AllTrim( hb_cStr( hb_HKeyAt( xPostData, nI ) ) ) ) + "=" + cData += tip_URLEncode( AllTrim( hb_cStr( hb_HValueAt( xPostData, nI ) ) ) ) IF nI != y cData += "&" ENDIF @@ -216,8 +216,8 @@ METHOD AddGetForm( xPostData ) ELSEIF hb_isArray( xPostData ) y := Len( xPostData ) FOR nI := 1 TO y - cData += __tip_url_Encode( AllTrim( hb_cStr( xPostData[ nI, 1 ] ) ) ) + "=" - cData += __tip_url_Encode( AllTrim( hb_cStr( xPostData[ nI, 2 ] ) ) ) + cData += tip_URLEncode( AllTrim( hb_cStr( xPostData[ nI, 1 ] ) ) ) + "=" + cData += tip_URLEncode( AllTrim( hb_cStr( xPostData[ nI, 2 ] ) ) ) IF nI != y cData += "&" ENDIF