FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour tIpClientHttp bug
Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
tIpClientHttp bug
Posted: Thu Nov 03, 2016 05:38 PM

Hi all,
I noted a problem downloading a text file through tipclienthttp oHttp:Readall:
it is a 200 rows text file and some rows contains spur characters but only on Windows XP,Vista, 7, all is right on Windows 8/10.
Is there something wrong on my code or do I have to upgrade my xharbour libs ?
I'm using xHarbour with FWH Sept 2015 and BCC7.0

oUrl := TURL():New( "my http url")
 oHttp:= TIpClientHttp():new( oUrl, .f. )
IF .NOT. oHttp:open()
    ? "Connection error:", oHttp:lastErrorMessage()
    QUIT
ENDIF
cHtml   := oHttp:readAll() && cHtml contains spur characters 
oHttp:close()

Thank you in advance

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tIpClientHttp bug
Posted: Thu Nov 03, 2016 06:04 PM
Code (fw): Select all Collapse
/* TIP HTTP advanced operations test */

#require "hbssl"
#require "hbtip"

#if ! defined( __HBSCRIPT__HBSHELL )
REQUEST __HBEXTERN__HBSSL__
#endif

PROCEDURE Main( cURL )

 LOCAL oHTTP, oURL, i

 IF Empty( oURL := TUrl():New( cURL ) )
   ? "Invalid URL", cURL
   RETURN
 ENDIF

 IF !( oURL:cProto == "http" ) .AND. ;
   !( oURL:cProto == "https" )
   ? "This is a header test for http/https."
   ? "Use an http/https address."
   RETURN
 ENDIF

 IF oURL:cProto == "https" .AND. ! tip_SSL()
   ? "Error: Requires SSL support"
   RETURN
 ENDIF

 oHTTP := TIPClientHTTP():New( oURL )
 oHTTP:nConnTimeout := 20000
 ? "Connecting with", oURL:cServer
 IF oHTTP:Open( cURL )
   ? "Connection eshtablished"
   ? "Retrieving", oURL:cPath, oURL:cFile, oURL:cQuery

   IF oHTTP:Get( oURL:cPath )
    ? "Get Successful"
    FOR EACH i IN oHTTP:hHeaders
      ? i:__enumKey() + ":", i
    NEXT
   ELSE
    ? "Get failure (server reply:", oHTTP:cReply, ")"
   ENDIF

   oHTTP:Close()
 ELSE
   ? "Can't connect with", oURL:cServer
   IF oHTTP:SocketCon == NIL
    ? "Connection not initiated"
   ELSEIF hb_inetErrorCode( oHTTP:SocketCon ) == 0
    ? "Server replied:", oHTTP:cReply
   ELSE
    ? "Error in connection:", hb_inetErrorDesc( oHTTP:SocketCon )
   ENDIF
 ENDIF

 ? "Done"

 RETURN
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tIpClientHttp bug
Posted: Thu Nov 03, 2016 06:06 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion