Page 2 of 3

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Fri Jul 24, 2020 11:29 am
by HGAutomator
Danielle, thanks for clearing up the missing pieces. I understand now.

Serge, I'll take another look at HMG. Hopefully, it works smoothly with Minigui.

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Tue Jul 28, 2020 12:11 am
by HGAutomator
Serge,

I was able to make the build work with the hbc/hbp file, and that solves a whole host of problems.

But unfortunately, I'm still getting an error when using an https url as the parameter to new():

Code: Select all

Http_o := TIpClientHttp():New( ChangeLink_s )

Error BASE/1081 Operation not supported: TIPCLIENTHTTP:new() Args: [1] = O TIPCLIENTHTTP [2] = C https

I'll try tracing through the class again, to see if something pops out that isn't immediately obvious.


serge_girard wrote: Wed Jul 22, 2020 2:13 pm Try this:

In your HBC file

Code: Select all

inc=yes
head=native
libs=hbssl
libs=libeay32
libs=ssleay32
in your HBP file

Code: Select all

hbssl.hbc
Serge

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Tue Jul 28, 2020 12:57 am
by AUGE_OHR
hi,

have a look at c:\harbour\contrib\hbtip\tests\http_adv.prg

Code: Select all

http_adv.exe https://www.hmgforum.com/viewtopic.php?f=5&t=6531
Connecting with www.hmgforum.com
Connection eshtablished
Retrieving / viewtopic.php f=5
Get Successful
Date: Tue, 28 Jul 2020 00:55:15 GMT
Server: Apache
Cache-Control: private, no-cache="set-cookie"
Expires: Tue, 28 Jul 2020 00:55:16 GMT
Referrer-Policy: strict-origin-when-cross-origin
Set-Cookie: phpbb3_8539k_sid=c26d0f6976f9d19fd89ccf4b4f4ed3ec; expires=Wed, 28-Jul-2021 00:55:16 GMT; path=/; domain=hmg
forum.com; HttpOnly
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Done
Press any key to continue...

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Tue Jul 28, 2020 2:10 am
by HGAutomator
Thanks Auge,

the answer is in this check, in the http_adv.prg module:

Code: Select all

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

Gotta stop for the night, but at least I have a direction for tomorrow.


Thanks & regards,



AUGE_OHR wrote: Tue Jul 28, 2020 12:57 am hi,

have a look at c:\harbour\contrib\hbtip\tests\http_adv.prg

Code: Select all

http_adv.exe https://www.hmgforum.com/viewtopic.php?f=5&t=6531
Connecting with www.hmgforum.com
Connection eshtablished
Retrieving / viewtopic.php f=5
Get Successful
Date: Tue, 28 Jul 2020 00:55:15 GMT
Server: Apache
Cache-Control: private, no-cache="set-cookie"
Expires: Tue, 28 Jul 2020 00:55:16 GMT
Referrer-Policy: strict-origin-when-cross-origin
Set-Cookie: phpbb3_8539k_sid=c26d0f6976f9d19fd89ccf4b4f4ed3ec; expires=Wed, 28-Jul-2021 00:55:16 GMT; path=/; domain=hmg
forum.com; HttpOnly
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Done
Press any key to continue...

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Tue Jul 28, 2020 3:38 am
by AUGE_OHR
hi,

i have change HMG32.HBC for SSL an Email

Code: Select all

# paths

incpaths=/.
incpaths=include
libpaths=lib

# main hmg libs

libs=hmg
libs=crypt
libs=edit
libs=editex
libs=graph
libs=ini
libs=report
libs=hfcl

# system libs

libs=msvfw32
libs=vfw32

# harbour contrib libs

libs=hbmysql
libs=mysql
libs=hbfimage
libs=hbpgsql
libs=sddmy

libs=hbvpdf

libs=hbct
libs=hbwin
libs=hbmzip
libs=minizip
libs=hbmemio
libs=hbmisc
libs=hbtip
libs=sqlite3
libs=hbsqlit3
libs=sddodbc
libs=rddsql
libs=hbodbc
libs=odbc32
libs=hbhpdf
libs=hbnetio
libs=xhb
libs=png
libs=libhpdf
libs=hbzebra

# ***** include this lines *****

libs=hbssl
libs=libeay32
libs=ssleay32
Libs=hbtip


# ***** end include this lines *****

# link compiled resources

sources=${hb_curdir}_temp.o

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Tue Jul 28, 2020 3:18 pm
by HGAutomator
Update: Got it, after throwing in:

REQUEST __HBEXTERN__HBSSL__

Disregard the rest, just leaving it for anyone researching the topic in the future.

Thanks everyone, for their assistance. I'll get a donation to the project this week, if they take donations.


****************************************************************************
Yikes. Still not working, not sure what's missing.

This is my hbc file:

Code: Select all

inc=yes
head=native
libpaths=c:\HWDebug
libs=hwgdebug
libs=hbssl
libs=libeay32
libs=ssleay32
libs=hbtip
, and the HB_STATIC_OPENSSL environmental variable is set, before running the app:

Code: Select all

SET HB_STATIC_OPENSSL=yes

Where is tip_SSL() defined? Maybe looking at that, would give me a clue.

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Tue Jul 28, 2020 6:16 pm
by danielmaximiliano
HGAutomator wrote: Tue Jul 28, 2020 3:18 pm Where is tip_SSL() defined? Maybe looking at that, would give me a clue.
f you are going to use the hbtip library with the different secure sites (read HTTPs, POP3s, FTPs, IMAPs), it is suggested that this library be compiled with SSL (Secure Sockets Layer) support.
in this case you should add "SET HB_STATIC_OPENSSL=yes"
as is indicated in : https://github.com/harbour/core#how-to- ... components
in "C:\Harbour\contrib\hbtip" generate or run line by line from CMD to create such libraries

Code: Select all

rem @echo off
rem *************************************
rem ADD in case Install OpenSSL
SET HB_WITH_OPENSSL=C:\OpenSSL32\include
SET HB_STATIC_OPENSSL=yes
rem *************************************

set Backup=%path%
set path=%path%;C:\hmg.3.4.4;c:\openssl32;C:\OpenSSL32\include
build hbtip.hbp
set path=%backup%

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Tue Jul 28, 2020 8:00 pm
by HGAutomator
Hi Daniel,

Yep, that's in both my batch file, and in the application, using hb_SetEnv.

Almost everything is working fine, except for trying to readall(), which returns nothing. The headers are returned, and they contain data. But that's a separate issue. The response code is a 301, so maybe I have to use a diferent url, after retriving it from another property of the TIpClientHttp class. Don't know, yet.

I tested the equivalent code with Xailer's TInternet class, and was able to download the html. So that's available, in the meantime.

So for now, everything's good. Just have to explore & experiment further.



danielmaximiliano wrote: Tue Jul 28, 2020 6:16 pm
HGAutomator wrote: Tue Jul 28, 2020 3:18 pm Where is tip_SSL() defined? Maybe looking at that, would give me a clue.
f you are going to use the hbtip library with the different secure sites (read HTTPs, POP3s, FTPs, IMAPs), it is suggested that this library be compiled with SSL (Secure Sockets Layer) support.
in this case you should add "SET HB_STATIC_OPENSSL=yes"
as is indicated in : https://github.com/harbour/core#how-to- ... components
in "C:\Harbour\contrib\hbtip" generate or run line by line from CMD to create such libraries

Code: Select all

rem @echo off
rem *************************************
rem ADD in case Install OpenSSL
SET HB_WITH_OPENSSL=C:\OpenSSL32\include
SET HB_STATIC_OPENSSL=yes
rem *************************************

set Backup=%path%
set path=%path%;C:\hmg.3.4.4;c:\openssl32;C:\OpenSSL32\include
build hbtip.hbp
set path=%backup%

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Tue Jul 28, 2020 9:27 pm
by apais
301 is a redirection directive

Re: Is TIpClientHttp supposed to work for secured sites?

Posted: Tue Jul 28, 2020 10:08 pm
by danielmaximiliano
HGAutomator wrote: Tue Jul 28, 2020 8:00 pm Almost everything is working fine, except for trying to readall(), which returns nothing. The headers are returned, and they contain data. But that's a separate issue. The response code is a 301, so maybe I have to use a diferent url, after retriving it from another property of the TIpClientHttp class. Don't know, yet.
this is what I found about answer 301

https://tools.ietf.org/html/rfc2616#section-9.2
10.3.2 301 Moved Permanently

The requested resource has been assigned a new permanent URI and any
future references to this resource SHOULD use one of the returned
URIs. Clients with link editing capabilities ought to automatically
re-link references to the Request-URI to one or more of the new
references returned by the server, where possible. This response is
cacheable unless indicated otherwise.

The new permanent URI SHOULD be given by the Location field in the
response. Unless the request method was HEAD, the entity of the
response SHOULD contain a short hypertext note with a hyperlink to
the new URI(s).

If the 301 status code is received in response to a request other
than GET or HEAD, the user agent MUST NOT automatically redirect the
request unless it can be confirmed by the user, since this might
change the conditions under which the request was issued.

Note: When automatically redirecting a POST request after
receiving a 301 status code, some existing HTTP/1.0 user agents
will erroneously change it into a GET request.