03-28-2018, 05:41 PM
From email:
For it need to modify Http.Get.
Member function Http.Get3
Http.Connect is encrypted because contains code to decrypt the password parameter. Its version without encrypted password support:
Member function Http.Connect2
Alternatively use WinHttp. It is a Windows COM library. It is simple to use and does not have QM wrapper functions. Examples - search the forum.
Quote:We need to copy the Http class to make some changes due to a lack of header support in GET methods; however it appears the Http.Connect method is encrypted.
For it need to modify Http.Get.
Member function Http.Get3
function# $remotefile str&data [flags] [inetflags] [str&responseheaders] [$headers] ;;flags: 1-3 cache flags, 16 download to file, 32 run in other thread
;Downloads web page or other file.
;Returns: 1 success, 0 failed.
;remotefile - file to download, relative to server. Examples: "index.htm", "images/earth.jpg".
;data - variable that receives file data. If flag 16 - variable that contains local file name.
;flags, inetflags, responseheaders - see <help>IntGetFile</help>. Does not support flags: 4, 8. For https use INTERNET_FLAG_SECURE in inetflags.
;headers - additional headers to send.
;REMARKS
;At first call Connect to connect to web server.
#opt nowarnings 1 ;;private System function
if(flags&0x10000) goto g1 ;;thread
if(!Cache(flags inetflags)) ret
if(flags&0x10000=0) if(m_dlg or flags&32) ret Thread(1 &remotefile "Downloading" remotefile)
;g1
__HInternet hi=HttpOpenRequest(m_hi "GET" remotefile 0 0 0 inetflags 0); if(!hi) ret Error
if(!HttpSendRequest(hi headers -1 0 0)) ret Error
if(&responseheaders and !GetResponseHeaders(hi responseheaders)) ret Error
ret Read(hi data flags&16)
;note: HttpOpenRequestW does not support Unicode too.
Http.Connect is encrypted because contains code to decrypt the password parameter. Its version without encrypted password support:
Member function Http.Connect2
function# $server [$username] [$password] [port] [flags] ;;port: http 0, https 443.
;Connects to a http or https server.
;Must be called before you can call other functions of Http class.
;Returns connection handle, which can be used to call WinInet functions directly. Returns 0 if failed.
;Actually this function does not make connection until you call other Http functions. For example, it does not fail if the server does not exist.
;server - server name like "www.xxxxxx.com", or IP.
;username, password - in most cases should be omitted or "". Does not support encrypted password.
;port - port number. If omitted or 0, uses 80. For https use port 443, and in other functions use INTERNET_FLAG_SECURE in inetflags.
;flags - currently not used and must be 0.
#opt nowarnings 1 ;;private System function
if(!m_hitop and !Init) ret
Disconnect
lasterror.all
_i=find(server "://"); if(_i>=0) server=_s.get(server _i+3)
m_hi=InternetConnectW(m_hitop @server iif(port port INTERNET_DEFAULT_HTTP_PORT) @iif(username username "") @password INTERNET_SERVICE_HTTP 0 0)
ret m_hi
;note: when adding new flags, don't use flag 1, because used previously.
Alternatively use WinHttp. It is a Windows COM library. It is simple to use and does not have QM wrapper functions. Examples - search the forum.