login about faq

Hi!

I cant get the response from an "async http request":

task.i = CkHttp::ckSynchronousRequestAsync(http,"testpage.com",80,0,req)

As a synchronous version, its not a problem: resp = CkHttp::ckSynchronousRequest(http,"testpage.com",80,0,req)

Can you please give me an example to get the response from the webserver, not just the status code, if its called asynch?

Thanks Andrew Room

asked Dec 17 '15 at 12:30

andrewroom's gravatar image

andrewroom
262

edited Dec 18 '15 at 03:41


Problem solved! My fault...

I want to get the webserver response by:
Debug "Webserver response:" + CkHttpResponse::ckBodyStr(task)

But it has to be:
Debug "Webserver response:" + CkHttpResponse::ckBodyStr(req)

Just needed 5 hours.

:-)

Andrew Room

link

answered Dec 17 '15 at 15:55

andrewroom's gravatar image

andrewroom
262

edited Dec 17 '15 at 15:57

One more info: The "task" doesnt end successfully (CkTask::ckGetResultBool(task) = 0).

CkTask::ckStatusInt(task) = 7 -> Task finished

Here is the ckLastErrorText:

    ChilkatLog:
    SynchronousRequest:
    DllDate: Nov  2 2015
    ChilkatVersion: 9.5.0.54
    UnlockPrefix: Anything for 30-day trial
    Username: ZOTACWIN80:andreas
    Architecture: Little Endian; 32-bit
    Language: Visual C++ 9.0 (32-bit)
    VerboseLogging: 0
    domain: testpage.com
    port: 80
    ssl: 0
    httpRequest:
      httpVersion: 1.1
      verb: POST
      path: /client/postfile.php
      contentType: multipart/form-data
      charset: windows-1252
      sendCharset: 0
      mimeHeader: Expect: 100-continue
      requestParams:
        requestItem:
          name: fileitem
          fileOnDisk: s:\test2.dll
          numValueBytes: 7618560
        --requestItem
      --requestParams
    --httpRequest
    readTimeout: 20
    connectTimeout: 30
    approxRequestSize: 7618685
    fullRequest:
      a_synchronousRequest:
        generateRequest:
          httpRequestGenStartLine:
            genStartLine:
              startLine: POST /client/postfile.php HTTP/1.1
            --genStartLine
          --httpRequestGenStartLine
          addCookies:
            Not auto-adding cookies.
            sendCookies: 1
            cookieDir: 
          --addCookies
          genMultipartFormData:
            requestParam:
              name: fileitem
              filename: s:\test2.dll
            --requestParam
          --genMultipartFormData
        --generateRequest
        fullHttpRequest:
          domain: testdomain.com
          port: 80
          ssl: 0
          openHttpConnection:
            Opening connection directly to HTTP server.
            httpHostname: testdomain.com
            httpPort: 80
            ssl: 0
            HTTP connection succeeded.
          --openHttpConnection
          connectTime: Elapsed time: 3058 millisec
          sendRequestHeader:
            sendHeaderElapsedMs: 78
          --sendRequestHeader
          expect100Continue:
            statusCode: 100
            statusText: Continue
          --expect100Continue
          sendRequestBody:
            genMultipartFormData:
              requestParam:
                name: fileitem
                filename: s:\test2.dll
              --requestParam
            --genMultipartFormData
            sendBodyElapsedMs: 16021
          --sendRequestBody
          statusCode: 200
          statusText: OK
          readResponseBody:
            contentLength: 10
          --readResponseBody
        --fullHttpRequest
        success: 1
      --a_synchronousRequest
      success: 1
    --fullRequest
    totalTime: Elapsed time: 19735 millisec
    Success.
  --SynchronousRequest
--ChilkatLog

As you can see, "chilkat" gets the expected response back in the error-log: readResponseBody: contentLength: 10

But I cant get the content of the "readResponseBody".

Hope, this helps.

Regards

Andrew Room

link

answered Dec 17 '15 at 14:43

andrewroom's gravatar image

andrewroom
262

edited Dec 17 '15 at 15:10

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
×22
×3

Asked: Dec 17 '15 at 12:30

Seen: 569 times

Last updated: Dec 18 '15 at 03:41

powered by OSQA