Archived Forum Post

Index of archived forum posts

Question:

ChilkatHTTP.Ptext PUT received as get at server

Apr 03 '17 at 21:39

Calling http.PText('PUT',url,json,'utf-8','application/json',0,0); but received as GET at server. any setting I missed?

ChilkatLog:
  PText:
    DllDate: Mar 20 2017
    ChilkatVersion: 9.5.0.66
    UnlockPrefix: Anything for 30-day trial
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    binaryRequest:
      fullRequest:
        a_synchronousRequest:
          generateRequestHeader:
            httpRequestGenStartLine:
              genStartLine:
                startLine: PUT /rest/vouchers/preRedeemVoucher HTTP/1.1
              --genStartLine
            --httpRequestGenStartLine
            addCookies:
              Not auto-adding cookies.
              sendCookies: 1
              cookieDir: 
            --addCookies
          --generateRequestHeader
          fullHttpRequest:
            domain: kh.payallz.com
            port: 80
            ssl: 0
            openHttpConnection:
              Opening connection directly to HTTP server.
              httpHostname: kh.payallz.com
              httpPort: 80
              ssl: 0
              HTTP connection succeeded.
            --openHttpConnection
            connectTime: Elapsed time: 40 millisec
            sendRequestHeader:
              sendHeaderElapsedMs: 0
            --sendRequestHeader
            sendRequestBody:
              sendBodyElapsedMs: 0
            --sendRequestBody
            statusCode: 301
            statusText: Moved Permanently
          --fullHttpRequest
          getRedirectUrl:
            Location: https://kh.payallz.com/rest/vouchers/preRedeemVoucher
            newLocation:
              url: http://kh.payallz.com/rest/vouchers/preRedeemVoucher
              location: https://kh.payallz.com/rest/vouchers/preRedeemVoucher
              newUrlFinal: https://kh.payallz.com/rest/vouchers/preRedeemVoucher
            --newLocation
          --getRedirectUrl
          redirectCount: 1
          generateRequestHeader:
            httpRequestGenStartLine:
              genStartLine:
                startLine: GET /rest/vouchers/preRedeemVoucher HTTP/1.1
              --genStartLine
            --httpRequestGenStartLine
            addCookies:
              Not auto-adding cookies.
              sendCookies: 1
              cookieDir: 
            --addCookies
          --generateRequestHeader
          fullHttpRequest:
            domain: kh.payallz.com
            port: 443
            ssl: 1
            openHttpConnection:
              Using existing connection.
            --openHttpConnection
            connectTime: Elapsed time: 0 millisec
            sendRequestHeader:
              sendHeaderElapsedMs: 0
            --sendRequestHeader
            statusCode: 403
            statusText: 
          --fullHttpRequest
          success: 1
        --a_synchronousRequest
        success: 1
      --fullRequest
      responseStatus: 403
      Failed.
    --binaryRequest
    Failed.
  --PText
--ChilkatLog

Answer

I found this is the documentation for the ChilkatHTTP object:

RedirectVerb As String

Indicates the HTTP verb, such as GET, POST, PUT, etc. to be used for a redirect when the FollowRedirects property is set to 1. The default value of this property is "GET". This will produce the same behavior as a web browser (such as FireFox). If this property is set to the empty string, then it will cause the same verb as the original HTTP request to be used.

Note: Prior to version 9.5.0.44, the default value of this property was the empty string.

If you try setting the RedirectVerb property to "" does the call work as expected?


Answer

I also notice that the redirect is likely happening because you are first trying to go to an HTTP address, but the system is forcing you over to s lightly different address over HTTPS...you might also want to try going directly to https://kh.payallz.com/rest/vouchers/preRedeemVoucher instead of http://kh.payallz.com/rest/vouchers/preRedeemVoucher to see if that avoids the redirect entirely.


Answer

See the online reference documentation for the Http.RedirectVerb property...