Archived Forum Post

Index of archived forum posts

Question:

OLD DLL http.download works fine New Dll does not

Mar 17 '15 at 13:18

VB 6.0 on 64bit Windows 7 Pro New DLL Version: 9.5.0.48 Old chilkathttp DLL Version: 9.3.2.0

Same code works with old DLL, but downloads fail in new DLL only change in code is PercentDone(pctdone/percent) callback

thanks for any help Randy


Answer

This is part of a utility program I wrote a few years ago it downloads all the tools I need in the field to fix/clean up infected systems. there is a small text file with name,url, localfilename that gets read, downloads the latest version unzips if needed and a few other things. when I updated to the mono DLL, several of my programs had issues, most of which have been fixed. LastErrorText, both good and failed are below

Thanks for the help

Code snip

Public WithEvents http As ChilkatHttp

Private Sub Command1_Click() Set http = New ChilkatHttp success = http.UnlockComponent("SuperSecretCodeGoesHere") If (success <> 1) Then MsgBox "Failed To Unlock HTTP Component" Exit Sub End If

GetFile

End Sub Private Sub GetFile() Dim strErrLog, strUrl, strFileName, strInfo As String Dim success As Long

Set http = New ChilkatHttp
http.MimicIE = True
http.FollowRedirects = True     ' <------------ it's turned on
http.KeepEventLog = True

' Any url ending in / and not a direct filename    
strUrl = "http://downloads.malwarebytes.org/file/mbam/"

strFileName = "InstallMBAM.EXE"
strInfo = "MalwareBytes Anti-Malware"

success = http.Download(strUrl, App.Path & "\" & strFileName)
strErrLog = http.LastErrorText
If success = 1 Then
    Label1.Caption = "It Worked!"

    Debug.Print strErrLog

Else
    Label1.Caption = "It Failed!"

    Debug.Print strErrLog

End If

End Sub

Success log

   ++++++++++++++++++++++++++++++++++++
ChilkatLog:
  Download:
    DllDate: Aug  5 2012
    UnlockPrefix: RAGSOFHttp
    Username: SHOP2:randy
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    backgroundThread: 0
    url: http://downloads.malwarebytes.org/file/mbam/
    toLocalPath: D:ProgrammingAppsIWroteGetToolstestcodeInstallMBAM.EXE
    localFileAlreadyExists: 1  ***EXISTING FILE DOES NOT MATTER
    QuickGetToOutput_Download:
      qGet_1:
        simpleHttpRequest_3:
          httpMethod: GET
          requestUrl: http://downloads.malwarebytes.org/file/mbam/
          Connecting to web server...
          httpServer: downloads.malwarebytes.org
          port: 80
          ConnectTimeoutMs_1: 10000
          calling ConnectSocket2
          IPV6 enabled connect with NO heartbeat.
          connectingTo: downloads.malwarebytes.org
          dnsCacheLookup: downloads.malwarebytes.org
          Resolving domain name (IPV4)
          GetHostByNameHB_ipv4: Elapsed time: 16 millisec
          myIP_1: 192.168.1.99
          myPort_1: 59611
          connect successful (1)
          connectElapsedMs: 47
          -- BuildIeGetRequest --
          Not auto-adding cookies.
          sendElapsedMs: 0
          StatusCode: 302
          StatusText: Moved Temporarily
          Reading response body...
          readResponseElapsedMs: 63
          redirectUrl: http://data-cdn.mbamupdates.com/v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe
          newUrlLocation:
            url: http://downloads.malwarebytes.org/file/mbam/
            location: http://data-cdn.mbamupdates.com/v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe
            newUrlFinal: http://data-cdn.mbamupdates.com/v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe
          --newUrlLocation
          RedirectGet:
            QuickGetToOutput_Redirect:
              newUrl: http://data-cdn.mbamupdates.com/v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe
              qGet_1:
                simpleHttpRequest_3:
                  httpMethod: GET
                  requestUrl: http://data-cdn.mbamupdates.com/v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe
                  Using new connection...
                  httpServer: data-cdn.mbamupdates.com
                  port: 80
                  ConnectTimeoutMs_1: 10000
                  calling ConnectSocket2
                  IPV6 enabled connect with NO heartbeat.
                  connectingTo: data-cdn.mbamupdates.com
                  dnsCacheLookup: data-cdn.mbamupdates.com
                  Resolving domain name (IPV4)
                  GetHostByNameHB_ipv4: Elapsed time: 15 millisec
                  myIP_1: 192.168.1.99
                  myPort_1: 59612
                  connect successful (1)
                  -- BuildIeGetRequest --
                  Not auto-adding cookies.
                  sendElapsedMs: 0
                  StatusCode: 200
                  StatusText: OK
                  Reading response body...
                  readResponseElapsedMs: 2122
                --simpleHttpRequest_3
              --qGet_1
            --QuickGetToOutput_Redirect
          --RedirectGet
        --simpleHttpRequest_3
      --qGet_1
    --QuickGetToOutput_Download
    DownloadNumBytes: 20447072
    bFileDeleted: 0
    totalElapsedMs: 2247
    ContentLength: 20447072
    Success.
  --Download
--ChilkatLog

++++++++++++++++++++++++++++++++++++

Failure log
ChilkatLog:
  Download:
    DllDate: Mar  6 2015
    ChilkatVersion: 9.5.0.48
    UnlockPrefix: RAGSOFHttp
    Username: SHOP2:randy
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    url: http://downloads.malwarebytes.org/file/mbam/
    toLocalPath: D:ProgrammingAppsIWroteGetToolstestcodeInstallMBAM.EXE
    currentWorkingDir: D:ProgrammingAppsIWroteGetToolstestcode
    a_httpDownload:
      httpDownloadFile:
        localFilePath: D:ProgrammingAppsIWroteGetToolstestcodeInstallMBAM.EXE
        localFileAlreadyExists: 0
        quickHttpRequest:
          httpVerb: GET
          url: http://downloads.malwarebytes.org/file/mbam/
          openHttpConnection:
            Opening connection directly to HTTP server.
            httpHostname: downloads.malwarebytes.org
            httpPort: 80
            ssl: 0
            HTTP connection succeeded.
          --openHttpConnection
          buildQuickRequest:
            genStartLine:
              startLine: GET /file/mbam/ HTTP/1.1
            --genStartLine
            addCookies:
              Not auto-adding cookies.
              sendCookies: 1
              cookieDir: 
            --addCookies
          --buildQuickRequest
          sendRequestHeader:
            sendHeaderElapsedMs: 0
          --sendRequestHeader
          statusCode: 302
          statusText: Moved Temporarily
          readResponseBody:
            contentLength: 106
          --readResponseBody
        --quickHttpRequest
      --httpDownloadFile
      getRedirectUrl:
        Location: http://data-cdn.mbamupdates.com/v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe
        newLocation:
          url: http://downloads.malwarebytes.org/file/mbam/
          location: http://data-cdn.mbamupdates.com/v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe
          newUrlFinal: http://data-cdn.mbamupdates.com/v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe
        --newLocation
      --getRedirectUrl
      httpDownloadFile:
        localFilePath: D:ProgrammingAppsIWroteGetToolstestcodeInstallMBAM.EXE
        localFileAlreadyExists: 0
        quickHttpRequest:
          httpVerb: GET
          url: http://data-cdn.mbamupdates.com/v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe
          openHttpConnection:
            Using existing connection.
          --openHttpConnection
          buildQuickRequest:
            genStartLine:
              startLine: GET /v2/mbam/consumer/data/mbam-setup-2.0.4.1028.exe HTTP/1.1
            --genStartLine
            addCookies:
              Not auto-adding cookies.
              sendCookies: 1
              cookieDir: 
            --addCookies
          --buildQuickRequest
          sendRequestHeader:
            sendHeaderElapsedMs: 0
          --sendRequestHeader
          statusCode: 503
          statusText: Service Temporarily Unavailable
          readResponseBody:
            contentLength: 21
          --readResponseBody
          checkCloseConnection:
            Response includes connection:close header (or proxy-connection:close header)
          --checkCloseConnection
        --quickHttpRequest
      --httpDownloadFile
    --a_httpDownload
    totalElapsedMs: 406
    ContentLength: 21
    Failed.
  --Download
--ChilkatLog


Answer

This problem is now fixed. Here are the new builds:

32-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatAx-9.5.0-win32.zip
64-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatAx-9.5.0-x64.zip

The problem was that the redirect was to a different sub-domain (data-cdn.mbamupdates.com vs downloads.malwarebytes.org) and Chilkat needed to use a different connection.


Answer

Hi Randy,

Please provide the contents of the LastErrorText property immediately after the failed call. A code sample could be useful too.

Also, please put the above in <pre></pre> tags to make it more readable.