Question download pdf from https fails

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:
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.
 

oli

Member
Strange. I've tested your piece of code under Win7/IE11 and noticed that deselecting "Do not save encrypted pages to disk" allowed the PDF to be saved.
What is your version of Windows & IE?
 

Attachments

  • Do not save encrypted pages to disk-OFF.jpg
    Do not save encrypted pages to disk-OFF.jpg
    26.3 KB · Views: 3
  • Do not save encrypted pages to disk-ON.jpg
    Do not save encrypted pages to disk-ON.jpg
    26.7 KB · Views: 3
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 !
 

Cecil

19+ years progress programming and still learning.
Looks like Windows XP has a problem.
 

Attachments

  • SSL Server Test_ datapadmo.it-park.at (Powered by Qualys SSL Labs).pdf
    212 KB · Views: 3
Top