Question download pdf from https fails

#1
Hi everybody,

i have a quite simple program to download pdf-files. It works perfectly with http, but fails with https. Both URLs work in explorer/firefox. Can anybody point out whats wrong ?
Code:
/*-------------------------------------------------------------------------------------------------------------*/
DEF VAR cURL             AS CHAR         NO-UNDO.
DEF VAR cLocalFileName   AS CHAR         NO-UNDO.
DEF VAR iRetC            AS INT          NO-UNDO.

ASSIGN
    cLocalFileName = "c:\temp\test.pdf"
    /*------------ THIS FAILS -----------------*/
    cURL = "https://datapadmo.it-park.at/Projekte/datapad/smg/datapad.nsf/api/uploads/Uebernahmeprotokoll_Stift_Klosterneuburg_123_10-07-2018_16-28-47.pdf?file=Uebernahmeprotokoll_Stift_Klosterneuburg_123_10-07-2018_16-28-47.pdf&customer=DgmGHz97HFnb73Nc9"
    /*------------ THIS WORKS -----------------*/
    cURL = "http://datapad.it-park.at/datapad/igel/pdfuploads/a556afa309b7598f20_Übergabeprotokoll__27-02-2017_16_47_46.pdf"
.

/* remove old version from IE cache                                                          */
run DeleteURLCacheEntry (input cURL).
/* ...and from explorer                                                                      */
OS-DELETE VALUE(cLocalFileName) NO-ERROR.

/* download the new file-version                                                             */
run urlDownloadToFileA (0, cURL, cLocalFileName, 0, 0, OUTPUT iRetC).

MESSAGE "downloading:~t" cURL
        "~n~nto:~t~t" cLocalFileName
        "~n~nReturnCode:~t" iRetC
    "~n~nlocal file exists:~t" SEARCH(cLocalFileName) <> ?
   VIEW-AS ALERT-BOX INFO BUTTONS OK TITLE PROGRAM-NAME(1).


/**********************************************************************************************
  EXTERNAL PROCEDURES                                                                         *
*********************************************************************************************/
procedure URLDownloadToFileA external "URLMON.DLL" :
    define input parameter pCaller    as long.
    define input parameter szURL      as character.
    define input parameter szFilename as character.
    define input parameter dwReserved as long.
    define input parameter lpfnCB     as long.
    define return parameter ReturnValue as long.
end procedure.

procedure DeleteUrlCacheEntry external "WININET.DLL" :
    define input parameter lbszUrlName as character.
end procedure.
 
Last edited by a moderator:
#3
I know this solution, unchecked the options, but it didn't help.
Anyway, I doubt that this could be the reason, because when I enter the URL directly in the addresline of the browser, I CAN download the pdf.
Just with this code it doesn't work.
 
#5
you are right, unchecking "Do not save encrypted pages to disk" DOES solve the problem (generally), I checked it on 2 other machines.
The computer, where we still have this problem, is quite old, so I recommended to throw it out and consider this problam as solved.
Thanks for your help !
 
Top