2008-06-04 17:32 UTC+0100 Viktor Szakats (harbour.01 syenar hu)

* contrib/hbcurl/hbcurl.c
     * Changed all logical options to default to .T.. This 
       way all work the same way, and in real life usage 
       the logical parameter can omitted in most cases.
       INCOMPATIBLE.

   * contrib/hbcurl/tests/ftp_uldl.prg
     + Added small example to get a dir listing.
This commit is contained in:
Viktor Szakats
2008-06-04 15:36:06 +00:00
parent 98a30e52a3
commit b9fa2c3ef9
3 changed files with 33 additions and 4 deletions

View File

@@ -8,6 +8,16 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-06-04 17:32 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* contrib/hbcurl/hbcurl.c
* Changed all logical options to default to .T.. This
way all work the same way, and in real life usage
the logical parameter can omitted in most cases.
INCOMPATIBLE.
* contrib/hbcurl/tests/ftp_uldl.prg
+ Added small example to get a dir listing.
2008-06-04 17:21 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* contrib/hbcurl/hbcurl.c
+ Changed to use hb_parc() (instead of hb_parcx()) for all

View File

@@ -69,8 +69,7 @@
#include "hbcurl.ch"
#define HB_CURL_OPT_BOOL( n ) ( ISLOG( n ) ? ( long ) hb_parl( n ) : hb_parnl( n ) )
#define HB_CURL_OPT_BOOL_TRUE( n ) ( ISLOG( n ) ? ( long ) hb_parl( n ) : ( ISNUM( n ) ? hb_parnl( n ) : 1 ) )
#define HB_CURL_OPT_BOOL( n ) ( ISLOG( n ) ? ( long ) hb_parl( n ) : ( ISNUM( n ) ? hb_parnl( n ) : 1 ) )
#define HB_CURL_OPT_LARGENUM( n ) ( ( curl_off_t ) hb_parnint( n ) )
/* NOTE: Since LIBCURL_VERSION_NUM doesn't reflect real revision,
@@ -898,10 +897,10 @@ HB_FUNC( CURL_EASY_SETOPT )
res = curl_easy_setopt( hb_curl->curl, CURLOPT_INFILESIZE_LARGE, HB_CURL_OPT_LARGENUM( 3 ) );
break;
case HB_CURLOPT_UPLOAD:
res = curl_easy_setopt( hb_curl->curl, CURLOPT_UPLOAD, HB_CURL_OPT_BOOL_TRUE( 3 ) );
res = curl_easy_setopt( hb_curl->curl, CURLOPT_UPLOAD, HB_CURL_OPT_BOOL( 3 ) );
break;
case HB_CURLOPT_DOWNLOAD: /* Harbour extension */
res = curl_easy_setopt( hb_curl->curl, CURLOPT_UPLOAD, ! HB_CURL_OPT_BOOL_TRUE( 3 ) );
res = curl_easy_setopt( hb_curl->curl, CURLOPT_UPLOAD, ! HB_CURL_OPT_BOOL( 3 ) );
break;
case HB_CURLOPT_MAXFILESIZE:
res = curl_easy_setopt( hb_curl->curl, CURLOPT_MAXFILESIZE, hb_parnl( 3 ) );

View File

@@ -88,6 +88,26 @@ FUNCTION Main( cDL, cUL )
? "DOWNLOAD:", curl_easy_perform( curl )
curl_easy_reset( curl )
Inkey( 0 )
DEFAULT cDL TO "ftp://ftp.cisco.com/"
/* Now let's download a dirlist */
? curl_easy_setopt( curl, HB_CURLOPT_DOWNLOAD )
? curl_easy_setopt( curl, HB_CURLOPT_DIRLISTONLY )
? curl_easy_setopt( curl, HB_CURLOPT_URL, cDL )
? curl_easy_setopt( curl, HB_CURLOPT_SSL_VERIFYPEER, .F. )
? curl_easy_setopt( curl, HB_CURLOPT_SSL_VERIFYHOST, .F. )
? curl_easy_setopt( curl, HB_CURLOPT_SETDOWNLOADFILE, "test_in.txt" )
? curl_easy_setopt( curl, HB_CURLOPT_SETPROGRESS, {| nPos, nLen | a := CurGet(), DispOutAt( 11, 10, Str( ( nPos / nLen ) * 100, 6, 2 ) + "%" ), CurSet( a ) } )
? curl_easy_setopt( curl, HB_CURLOPT_NOPROGRESS, .F. )
? curl_easy_setopt( curl, HB_CURLOPT_VERBOSE, .F. )
? "DOWNLOAD:", curl_easy_perform( curl )
/* Cleanup session */
curl_easy_cleanup( curl )