Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. File transfer (GET) via HTTPS

File transfer (GET) via HTTPS

Scheduled Pinned Locked Moved C / C++ / MFC
comhelpsysadminquestionannouncement
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jonas Larsson
    wrote on last edited by
    #1

    Hi all, here's my problem. Im developing an activex control to work as a "proxy" between a server and a pda. The users will go to a webpage and from that webpage, they will be able to update/change the configuration of our app on their pda. The problem is that sometimes, the files that we need to download are a bit too big to put in the asp generated code so we thought we'd let the activex control do the downloading to pc by itself. This works great with HTTP, using wininet, but fails misserably with HTTPS[1]. Ive checked out msdn and tried the things they say at http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q168151&[^] Im fairly new to this webstuff thingamajiggs so I thought I'd check to see if anyone has had similar problems with code working with HTTP but not HTTPS. [1] I get a webpage back saying: "ERROR: The requested URL could not be retrieved" “Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002

    A 1 Reply Last reply
    0
    • J Jonas Larsson

      Hi all, here's my problem. Im developing an activex control to work as a "proxy" between a server and a pda. The users will go to a webpage and from that webpage, they will be able to update/change the configuration of our app on their pda. The problem is that sometimes, the files that we need to download are a bit too big to put in the asp generated code so we thought we'd let the activex control do the downloading to pc by itself. This works great with HTTP, using wininet, but fails misserably with HTTPS[1]. Ive checked out msdn and tried the things they say at http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q168151&[^] Im fairly new to this webstuff thingamajiggs so I thought I'd check to see if anyone has had similar problems with code working with HTTP but not HTTPS. [1] I get a webpage back saying: "ERROR: The requested URL could not be retrieved" “Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002

      A Offline
      A Offline
      Andreas Saurwein
      wrote on last edited by
      #2

      MSDN[^] contains a nice sample how to download a file as you need it. It works also fine with a https connection.

      int x=1, y=5;
      x^=y^=x^=y; // whats the content of x and y now?
      ClickHereForHelp();

      J 1 Reply Last reply
      0
      • A Andreas Saurwein

        MSDN[^] contains a nice sample how to download a file as you need it. It works also fine with a https connection.

        int x=1, y=5;
        x^=y^=x^=y; // whats the content of x and y now?
        ClickHereForHelp();

        J Offline
        J Offline
        Jonas Larsson
        wrote on last edited by
        #3

        Thanks, but I already got that part down. I guess I wasnt clear enough about the problem. :) My problem is this: Everything works dandy with normal http calls. If its a SSL connection I add INTERNET_DEFAULT_HTTPS_PORT to my InternetConnect call and add the flags INTERNET_FLAG_SECURE|INTERNET_FLAG_IGNORE_CERT_DATE_INVALID|INTERNET_FLAG_IGNORE_CERT_CN_INVALID to my HttpOpenRequest call. When I run it (using InternetOpen, InternetConnect, HttpOpenRequest, HttpSendRequest, HttpQueryInfo and InternetReadFile) everything returns correct values, but the page/file being sent with https is not the file i requested, but some kind of error page.

        ERROR

        The requested URL could not be retrieved


        While trying to retrieve the URL:
        www.mycurrentclient.com:0

        The following error was encountered:

        • Invalid URL

        Some aspect of the requested URL is incorrect. Possible problems:

        • Missing or incorrect access protocol (should be `http://'' or similar)

        • Missing hostname

        • Illegal double-escape in the URL-Path

        • Illegal character in hostname; underscores are not allowed

        Your cache administrator is root.

        but when calling the exact same URL with a normal HTTP call, I receive the file I was looking for. So, I guess my question is this: Should I do something other than what MS states in their doc's to be able to do GET's with HTTPS, or could this be a problem with the site im connecting to/the computer im connecting from? “Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002

        A 1 Reply Last reply
        0
        • J Jonas Larsson

          Thanks, but I already got that part down. I guess I wasnt clear enough about the problem. :) My problem is this: Everything works dandy with normal http calls. If its a SSL connection I add INTERNET_DEFAULT_HTTPS_PORT to my InternetConnect call and add the flags INTERNET_FLAG_SECURE|INTERNET_FLAG_IGNORE_CERT_DATE_INVALID|INTERNET_FLAG_IGNORE_CERT_CN_INVALID to my HttpOpenRequest call. When I run it (using InternetOpen, InternetConnect, HttpOpenRequest, HttpSendRequest, HttpQueryInfo and InternetReadFile) everything returns correct values, but the page/file being sent with https is not the file i requested, but some kind of error page.

          ERROR

          The requested URL could not be retrieved


          While trying to retrieve the URL:
          www.mycurrentclient.com:0

          The following error was encountered:

          • Invalid URL

          Some aspect of the requested URL is incorrect. Possible problems:

          • Missing or incorrect access protocol (should be `http://'' or similar)

          • Missing hostname

          • Illegal double-escape in the URL-Path

          • Illegal character in hostname; underscores are not allowed

          Your cache administrator is root.

          but when calling the exact same URL with a normal HTTP call, I receive the file I was looking for. So, I guess my question is this: Should I do something other than what MS states in their doc's to be able to do GET's with HTTPS, or could this be a problem with the site im connecting to/the computer im connecting from? “Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002

          A Offline
          A Offline
          Andreas Saurwein
          wrote on last edited by
          #4

          Is the server correctly set up to handle https? Does it have any certificate?

          int x=1, y=5;
          x^=y^=x^=y; // whats the content of x and y now?
          ClickHereForHelp();

          J 1 Reply Last reply
          0
          • A Andreas Saurwein

            Is the server correctly set up to handle https? Does it have any certificate?

            int x=1, y=5;
            x^=y^=x^=y; // whats the content of x and y now?
            ClickHereForHelp();

            J Offline
            J Offline
            Jonas Larsson
            wrote on last edited by
            #5

            Yes, it is. I think I've found my error, but Im trying to re-verify it by having the webguys change something in the asp and I didnt want to post anything until I was sure it was fixed. The problem was me not using InternetCrackUrl (what a horrible name for a function ;P ), so I sent www.mycurrentcustomer.com/path as server and file.xxx as file in my requests. I changed it to www.mycurrentcustomer.com and path/file.xxx and it worked. :-O Weird that the old way worked for normal HTPP calls though... Anyway, thanks for the help! :beer: “Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups