Archived Forum Post

Index of archived forum posts

Question:

HTTP Download Failure

Nov 05 '13 at 14:29
SocketConnect: www.certainty3d.com:80

HostnameResolve: www.certainty3d.com

ResolvedToIp: 192.185.5.13

SocketConnected: www.certainty3d.com:80

RequestHeader: GET /projectstore/XRu76MqZLu/metadata/Tiles%203.dot HTTP/1.1
Accept: */*
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
User-Agent: Chilkat/1.0.0 (+http://www.chilkatsoft.com/ChilkatHttpUA.asp)
Host: www.certainty3d.com
Connection: Keep-Alive

HttpInfo: Begin reading response

RecvByteCount: 1

RecvBytesPerSec: 21

ResponseHeader: 
HTTP/1.1 403 Forbidden
Date: Mon, 28 Oct 2013 18:17:10 GMT
Server: Apache
Last-Modified: Fri, 30 Aug 2013 17:13:28 GMT
Accept-Ranges: bytes
Content-Length: 18156
Keep-Alive: timeout=5, max=75
Connection: Keep-Alive
Content-Type: text/html

HttpStatusCode: 403

HttpInfo: Begin reading response body...

ResponseContentLength: 18156

PercentDone: 6

PercentDone: 14

PercentDone: 22

PercentDone: 30

PercentDone: 38

PercentDone: 46

PercentDone: 54

PercentDone: 62

PercentDone: 70

PercentDone: 79

PercentDone: 87

PercentDone: 95

PercentDone: 100

ChilkatLog:
  Download:
    DllDate: Aug 15 2013
    ChilkatVersion: 9.4.1.42
    UnlockPrefix: RIEGLUHttp
    Username: MAURICIOPC:MTerneus
    Architecture: Little Endian; 32-bit
    Language: .NET 2.0
    VerboseLogging: 0
    backgroundThread: 1
    url: http://www.certainty3d.com/projectstore/XRu76MqZLu/metadata/Tiles 3.dot
    toLocalPath: C:\ZF\Tiles 3.dot
    localFileAlreadyExists: 0
    QuickGetToOutput_Download:
      qGet_1:
        simpleHttpRequest_3:
          httpMethod: GET
          requestUrl: http://www.certainty3d.com/projectstore/XRu76MqZLu/metadata/Tiles%203.dot
          Connecting to web server...
          httpServer: www.certainty3d.com
          port: 80
          ConnectTimeoutMs_1: 10000
          calling ConnectSocket2
          IPV6 enabled connect with NO heartbeat.
          connectingTo: www.certainty3d.com
          resolveHostname1:
            Resolving domain name (IPV4) via gethostbyname
          --resolveHostname1
          GetHostByNameHB_ipv4: Elapsed time: 0 millisec
          myIP_1: 192.168.2.13
          myPort_1: 55004
          connect successful (1)
          Turning on TCP_NODELAY.
          socketOptions:
            SO_SNDBUF: 8192
            SO_RCVBUF: 8192
            TCP_NODELAY: 1
          --socketOptions
          connectElapsedMs: 46
          -- BuildGetRequest --
          Not auto-adding cookies.
          sendElapsedMs: 0
          StatusCode: 403
          StatusText: Forbidden
          contentLength: 18156
          Reading response body...
          readResponseElapsedMs: 234
        --simpleHttpRequest_3
      --qGet_1
    --QuickGetToOutput_Download
    bFileDeleted: 1
    totalElapsedMs: 296
    Failed.
  --Download
--ChilkatLog

Why is this failing? works fine in C++ Fails in .net

        Public Function DownloadFile(ByVal url As String, ByVal destination As String) As Boolean

        Dim http As New Chilkat.Http()

        Dim success As Boolean

        '  Any string unlocks the component for the 1st 30-days.
        success = http.UnlockComponent("xxxxxxxxxxx")
        If (success <> True) Then
            MsgBox(http.LastErrorText)
            Exit Function
        End If

        '  Download the Python language install.
        '  Note: This URL may have changed since this example was created.
        success = http.Download(url, destination)
        If (success <> True) Then
            Debug.Print(http.LastErrorText)
            Return False
        Else
            MsgBox("Python Download Complete!")
            Return True
        End If

        'Dim success As Boolean = _http.Download(url, destination)

        'If success = False Then
        '    Debug.Print(_http.LastErrorText)
        '    Return False
        'End If

        'Return True

    End Function

Answer

A website can behave differently based on the User-Agent header field. For example, if you browse to a website from your iPhone, a website might recognize the user-agent as being a smart phone and then serve a different version of the site. Likewise, maybe some websites only want interactive users logging in, and check to see if it's FireFox, IE, or Chrome, and if not then rejects the request. Of course, your application could be truly interactive, it's just that it might use Chilkat HTTP to do the HTTP communications..


Answer

The 403 response code (HTTP/1.1 403 Forbidden) indicates that a login/password is required to access the resource.


Answer

Need to use http.MimicIE for the download to work.. Not sure why?