tIpClientHttp bug

tIpClientHttp bug

Postby Marco Turco » Thu Nov 03, 2016 5: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: tIpClientHttp bug

Postby karinha » Thu Nov 03, 2016 6:04 pm

Code: Select all  Expand view

/* 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
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: tIpClientHttp bug

Postby karinha » Thu Nov 03, 2016 6:06 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests