login about faq

I found a bug in the active x http component. When I create a request object for HEAD and PUT requests the component is adding 4 additional spaces to the end of the path string.

Here is my vb6 code.

Function CheckContainer(ID As Long, Y As Single, M As Single, tContainer As String) As String
            Dim Container As String
            Dim oResp As CHILKATHTTPLib.ChilkatHttpResponse
            Dim oReq As New CHILKATHTTPLib.ChilkatHttpRequest
            Dim I As Single
            Static ErrCount As Single

'XML Snippet attached

Container = xApp.ChilkatPath("HTTP|BaseContainer|*")
Container = Replace(Container, "~~Year~~", Y)
Container = Replace(Container, "~~AgencyID~~", ID)
Container = Replace(Container, "~~Month~~", M)

Debug.Print Len(Container)   'Returns 21
Debug.Print Container        'Returns IssueArchive-1-2013-4

Container = Trim(Container)
Debug.Print Len(Container)   'Returns 21

With oReq
    .HttpVerb = "HEAD"
    .ContentType = ""
    .AddHeader "Host", "storage.clouddrive.com"
    .AddHeader "X-Auth-Token", RS_AuthToken
    .Path = RS_StorageURL & "/" & Container

End With

oHttp.SessionLogFilename = "C:\oHttp_Log_head.txt"

Set oResp = oHttp.SynchronousRequest(RS_Server, 443, 1, oReq)
If Not oResp Is Nothing Then Exit For

Select Case oResp.StatusCode
Case 201
    Debug.Print oResp.Header

Case 204   'Exists
    CheckContainer = Container

Case 404 'Not Found
    oReq.Path = RS_StorageURL & "/" & Container
    oReq.HttpVerb = "PUT"
    oReq.ContentType = "text/plain"

    Set oResp = oHttp.SynchronousRequest(RS_Server, 443, 1, oReq)

    If oResp.StatusCode = 201 Then   'Created
        CheckContainer = Container

    Else
        Stop

    End If

Case Else
    Debug.Print "Response Status"
    Debug.Print oResp.StatusCode

    Debug.Print "Response Headers"
    Debug.Print oResp.Header        
    Stop

End Select
Set oReq = Nothing
Set oResp = Nothing

End Function

Here is the HTTP Log, you will see the %20 for each space that was added

---- Sending ----
HEAD /v1/MossoCloudFS_56e9ae2f-a3f9-4d5b-a211-406d4b093bad/IssueArchive-1-2013-4%20%20%20%20 HTTP/1.1
Host: storage.clouddrive.com
X-Auth-Token: 7e9f4a42-b307-4a10-88c4-2c23125ddb21

---- Received ---- HTTP/1.1 404 Not Found Content-Length: 0 Content-Type: text/html; charset=UTF-8 X-Trans-Id: tx9b2bd29266064b8bb18c08ca8ef75429 Date: Mon, 29 Apr 2013 20:32:25 GMT

---- Sending ---- PUT /v1/MossoCloudFS_56e9ae2f-a3f9-4d5b-a211-406d4b093bad/IssueArchive-1-2013-4%20%20%20%20 HTTP/1.1 Host: storage.clouddrive.com X-Auth-Token: 7e9f4a42-b307-4a10-88c4-2c23125ddb21

---- Received ---- HTTP/1.1 201 Created Content-Length: 0 Content-Type: text/html; charset=UTF-8 X-Trans-Id: tx3452f9d142a540ea8e42373b80f845eb Date: Mon, 29 Apr 2013 20:32:40 GMT

Update: Here is the .LastErrorText, in my debug window I see the 4 spaces. Here if you highlight the line for the path, you will the extra spaces.

ChilkatLog:
  SynchronousRequest:
    DllDate: Dec 12 2012
    UnlockPrefix: INSURAHttp
    Username: MATHIS:erik
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    domain: storage101.dfw1.clouddrive.com
    port: 443
    ssl: 1
    RequestData:
      HttpVersion: 1.1
      Verb: HEAD
      Path: /v1/MossoCloudFS_56e9ae2f-a3f9-4d5b-a211-406d4b093bad/IssueArchive-1-2013-4  
Charset: windows-1252 SendCharset: 0 MimeHeader: Host: storage.clouddrive.com X-Auth-Token: 7e9f4a42-b307-4a10-88c4-2c23125ddb21 --RequestData ReadTimeout: 20 ConnectTimeout: 10 httpConnect: hostname: storage101.dfw1.clouddrive.com port: 443 ssl: 1 Need to establish connection to the HTTP server... ConnectTimeoutMs_1: 10000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. connectingTo: storage101.dfw1.clouddrive.com resolveHostname1: dnsCacheLookup: storage101.dfw1.clouddrive.com Resolving domain name (IPV4) --resolveHostname1 GetHostByNameHB_ipv4: Elapsed time: 31 millisec myIP_1: 8.0.0.3 myPort_1: 2461 connect successful (1) clientHelloMajorMinorVersion: 3.1 buildClientHello: majorVersion: 3 minorVersion: 1 numRandomBytes: 32 sessionIdSize: 0 numCipherSuites: 10 numCompressionMethods: 1 --buildClientHello readIncomingTls_serverHello: processTlsRecord: processHandshake: handshakeMessageType: ServerHello handshakeMessageLen: 0x46 processHandshakeMessage: MessageType: ServerHello Processing ServerHello... ServerHello: MajorVersion: 3 MinorVersion: 1 SessionIdLen: 32 CipherSuite: RSA_WITH_RC4_128_SHA CipherSuite: 00,05 CompressionMethod: 0 Queueing ServerHello message. ServerHello is OK. --ServerHello --processHandshakeMessage --processHandshake --processTlsRecord --readIncomingTls_serverHello HandshakeQueue: MessageType: ServerHello --HandshakeQueue Dequeued ServerHello message. readIncomingTls_6: processTlsRecord: processHandshake: handshakeMessageType: Certificate handshakeMessageLen: 0xd44 processHandshakeMessage: MessageType: Certificate ProcessCertificates: Certificate: derSize: 1116 certSubjectCN: storage101.dfw1.clouddrive.com certSerial: 75CCB8F7011B14EBA0253E92D7EA124E certIssuerCN: Thawte DV SSL CA --Certificate Certificate: derSize: 1171 certSubjectCN: Thawte DV SSL CA certSerial: 7610128A17B682BB3A1F9D1A9A35C092 certIssuerCN: thawte Primary Root CA --Certificate Certificate: derSize: 1097 certSubjectCN: thawte Primary Root CA certSerial: 3365500879AD73E230B9E01D0D7FAC91 certIssuerCN: Thawte Premium Server CA --Certificate NumCertificates: 3 Queueing Certificates message... --ProcessCertificates --processHandshakeMessage --processHandshake --processTlsRecord --readIncomingTls_6 Dequeued Certificate message. readIncomingTls_6: processTlsRecord: processHandshake: handshakeMessageType: ServerHelloDone handshakeMessageLen: 0x0 processHandshakeMessage: MessageType: ServerHelloDone Queueing HelloDone message. --processHandshakeMessage --processHandshake --processTlsRecord --readIncomingTls_6 DequeuedMessageType: ServerHelloDone OK to ServerHelloDone! No client certificate required by the server. Encrypted pre-master secret with server certificate RSA public key is OK. Sending ClientKeyExchange... Sent ClientKeyExchange message. Sending ChangeCipherSpec... Sent ChangeCipherSpec message. Derived keys. Installed new outgoing security params. Sending FINISHED message.. algorithm: arc4 keyLength: 128 Sent FINISHED message.. readIncomingTls_changeCipherSpec2: processTlsRecord: processChangeCipherSpec: ccsProtocolType: 1 --processChangeCipherSpec --processTlsRecord --readIncomingTls_changeCipherSpec2 readIncomingTls_handshakeFinished2: processTlsRecord: processHandshake: handshakeMessageType: HandshakeFinished handshakeMessageLen: 0xc processHandshakeMessage: MessageType: HandshakeFinished FinishedMsgLen: 12 Queueing Finished message. --processHandshakeMessage --processHandshake --processTlsRecord --readIncomingTls_handshakeFinished2 Dequeue the FINISHED message... Dequeued Finished message. Handshake completed successfully. Secure Channel Established. Connected --httpConnect connectTime1: Elapsed time: 265 millisec sendRequestGetResponse_1: sendRequest: Not auto-adding cookies. --sendRequest sendRequestTime: Elapsed time: 16 millisec ---- Reading HTTP Response ---- readResponse2_4: Finished reading 204 header-only response. readResponseTime: Elapsed time: 47 millisec --readResponse2_4 processResponse_3: responseStatus: 204 --processResponse_3 --sendRequestGetResponse_1 totalTime: Elapsed time: 328 millisec Success. --SynchronousRequest --ChilkatLog

-Erik

XML Snippet

5/1/2013 Here is the results from the pre-release of chilkathttp.dll

GetLastErrorText for path

ChilkatLog:
  Path:
    DllDate: Apr 30 2013
    ChilkatVersion: 9.4.1.12
    UnlockPrefix: INSURAHttp
    Username: MATHIS:erik
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    path: [/v1/MossoCloudFS_56e9ae2f-a3f9-4d5b-a211-406d4b093bad/IssueArchive-1-2013-4]
  --Path
--ChilkatLog

GetLastErrorText for SynchronousRequest

ChilkatLog:
  SynchronousRequest:
    DllDate: Apr 30 2013
    ChilkatVersion: 9.4.1.12
    UnlockPrefix: INSURAHttp
    Username: MATHIS:erik
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    domain: storage101.dfw1.clouddrive.com
    port: 443
    ssl: 1
    RequestData:
      HttpVersion: 1.1
      Verb: HEAD
      Path: /v1/MossoCloudFS_56e9ae2f-a3f9-4d5b-a211-406d4b093bad/IssueArchive-1-2013-4  
Charset: windows-1252 SendCharset: 0 MimeHeader: Host: storage.clouddrive.com X-Auth-Token: 89f16511-5448-4431-9b63-000ba33d8910 --RequestData ReadTimeout: 20 ConnectTimeout: 10 path: [/v1/MossoCloudFS_56e9ae2f-a3f9-4d5b-a211-406d4b093bad/IssueArchive-1-2013-4 ] httpConnect: hostname: storage101.dfw1.clouddrive.com port: 443 ssl: 1 Need to establish connection to the HTTP server... ConnectTimeoutMs_1: 10000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. connectingTo: storage101.dfw1.clouddrive.com resolveHostname1: Resolving domain name (IPV4) via gethostbyname --resolveHostname1 GetHostByNameHB_ipv4: Elapsed time: 0 millisec myIP_1: 8.0.0.3 myPort_1: 3416 connect successful (1) clientHelloMajorMinorVersion: 3.1 buildClientHello: majorVersion: 3 minorVersion: 1 numRandomBytes: 32 sessionIdSize: 0 numCipherSuites: 10 numCompressionMethods: 1 --buildClientHello readIncomingTls_serverHello: processTlsRecord: processHandshake: handshakeMessageType: ServerHello handshakeMessageLen: 0x46 processHandshakeMessage: MessageType: ServerHello Processing ServerHello... ServerHello: MajorVersion: 3 MinorVersion: 1 SessionIdLen: 32 CipherSuite: RSA_WITH_RC4_128_SHA CipherSuite: 00,05 CompressionMethod: 0 Queueing ServerHello message. ServerHello is OK. --ServerHello --processHandshakeMessage --processHandshake --processTlsRecord --readIncomingTls_serverHello HandshakeQueue: MessageType: ServerHello --HandshakeQueue Dequeued ServerHello message. readIncomingTls_6: processTlsRecord: processHandshake: handshakeMessageType: Certificate handshakeMessageLen: 0xd44 processHandshakeMessage: MessageType: Certificate ProcessCertificates: Certificate: derSize: 1116 certSubjectCN: storage101.dfw1.clouddrive.com certSerial: 75CCB8F7011B14EBA0253E92D7EA124E certIssuerCN: Thawte DV SSL CA --Certificate Certificate: derSize: 1171 certSubjectCN: Thawte DV SSL CA certSerial: 7610128A17B682BB3A1F9D1A9A35C092 certIssuerCN: thawte Primary Root CA --Certificate Certificate: derSize: 1097 certSubjectCN: thawte Primary Root CA certSerial: 3365500879AD73E230B9E01D0D7FAC91 certIssuerCN: Thawte Premium Server CA --Certificate NumCertificates: 3 Queueing Certificates message... --ProcessCertificates --processHandshakeMessage --processHandshake --processTlsRecord --readIncomingTls_6 Dequeued Certificate message. readIncomingTls_6: processTlsRecord: processHandshake: handshakeMessageType: ServerHelloDone handshakeMessageLen: 0x0 processHandshakeMessage: MessageType: ServerHelloDone Queueing HelloDone message. --processHandshakeMessage --processHandshake --processTlsRecord --readIncomingTls_6 DequeuedMessageType: ServerHelloDone OK to ServerHelloDone! No client certificate required by the server. Encrypted pre-master secret with server certificate RSA public key is OK. Sending ClientKeyExchange... Sent ClientKeyExchange message. Sending ChangeCipherSpec... Sent ChangeCipherSpec message. Derived keys. Installed new outgoing security params. Sending FINISHED message.. algorithm: arc4 keyLength: 128 Sent FINISHED message.. readIncomingTls_changeCipherSpec2: processTlsRecord: processChangeCipherSpec: ccsProtocolType: 1 --processChangeCipherSpec --processTlsRecord --readIncomingTls_changeCipherSpec2 readIncomingTls_handshakeFinished2: processTlsRecord: processHandshake: handshakeMessageType: HandshakeFinished handshakeMessageLen: 0xc processHandshakeMessage: MessageType: HandshakeFinished FinishedMsgLen: 12 Queueing Finished message. --processHandshakeMessage --processHandshake --processTlsRecord --readIncomingTls_handshakeFinished2 Dequeue the FINISHED message... Dequeued Finished message. Handshake completed successfully. Secure Channel Established. Connected --httpConnect connectTime1: Elapsed time: 234 millisec sendRequestGetResponse_1: sendRequest: Not auto-adding cookies. --sendRequest sendRequestTime: Elapsed time: 16 millisec ---- Reading HTTP Response ---- readResponse2_4: Finished reading 204 header-only response. readResponseTime: Elapsed time: 62 millisec --readResponse2_4 processResponse_3: responseStatus: 204 --processResponse_3 --sendRequestGetResponse_1 totalTime: Elapsed time: 312 millisec Success. --SynchronousRequest --ChilkatLog

Http Log

---- Sending ----
HEAD /v1/MossoCloudFS_56e9ae2f-a3f9-4d5b-a211-406d4b093bad/IssueArchive-1-2013-4%20%20%20%20 HTTP/1.1
Host: storage.clouddrive.com
X-Auth-Token: 89f16511-5448-4431-9b63-000ba33d8910

---- Received ---- HTTP/1.1 204 No Content Content-Length: 0 X-Container-Object-Count: 0 Accept-Ranges: bytes X-Timestamp: 1367264681.90137 X-Container-Bytes-Used: 0 Content-Type: text/plain; charset=utf-8 X-Trans-Id: tx463fc6cd19274bd8ae41231a23259a60 Date: Wed, 01 May 2013 18:33:39 GMT

asked Apr 29 '13 at 16:54

emartinson's gravatar image

emartinson
148162030

edited May 01 '13 at 14:41

Thanks! I'll have a look..

(May 02 '13 at 09:28) chilkat ♦♦

link

answered May 03 '13 at 21:25

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Thanks Matt, that did the trick.

(May 06 '13 at 18:30) emartinson

My guess is that you're setting the HttpRequest.Path property equal to a string that ends in 4 SPACE chars. This would explain the problem. Verify the exact string use to set oReq.Path.

In other words, this line of code is probably the problem:

.Path = RS_StorageURL & "/" & Container

I suspect Container is a string that ends in 4 SPACE chars.

link

answered Apr 30 '13 at 10:52

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

That is what I thought. You can see my debug.print statement, the length is 21 before and after the trim statement. I have tried adding the trim to the path method. ".Path = Trim(RS_StorageURL & "/" & Container)". Also, if I debug.print .path there are no additional spaces.

(Apr 30 '13 at 12:53) emartinson

I tried the same, but I'm not able to reproduce the problem. Please post the oHttp.LastErrorText after calling SynchronousRequest. If it shows to be an older version that you are using, please test with the latest version.

(Apr 30 '13 at 13:04) chilkat ♦♦

Erik, I still suspect that somehow you're passing a path that ends in 4 SPACE chars (although I admit I could be wrong..) I added additional logging in the LastErrorText. Please download this new build: http://www.chilkatsoft.com/preRelease/ChilkatHttp.zip

(Apr 30 '13 at 20:39) chilkat ♦♦

Get the LastErrorText in two places:

1) The oReq.LastErrorText after setting the Path property. (This is the LastErrorText on the oReq object, not the HTTP object) This should show us the exact string received for the Path.

2) The oHttp.LastErrorText after calling SynchronousRequest.

(Apr 30 '13 at 20:41) chilkat ♦♦

Erik, I found the problem -- and it only affects the ActiveX implementation. I'll have a fix this weekend.

link

answered May 03 '13 at 16:37

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×186
×35
×8

Asked: Apr 29 '13 at 16:54

Seen: 1,169 times

Last updated: May 06 '13 at 18:30

powered by OSQA