Archived Forum PostQuestion:
Hey I am trying to login a site using PostUrlEncoded but when auth fails i get a null response instead i should get error status.
here is code: httpresponse =httpc.PostUrlEncoded("https://www.xyz.com/resource/UserSessionResource/create/", request);
httpresponse is always null when a 401 is given by the server
this is fiddler request http://prntscr.com/3tchgi
Last Error
ChilkatLog:
PostUrlEncoded:
DllDate: Jun 10 2014
ChilkatVersion: 9.5.0.40
UnlockPrefix: THEBACHttp
Username: AKII:Aki
Architecture: Little Endian; 64-bit
Language: .NET 4.5 / x64
VerboseLogging: 0
url: https://www.pinterest.com/resource/UserSessionResource/create/
httpRequest:
httpVersion: 1.1
verb: GET
path: /
contentType: application/x-www-form-urlencoded; charset=UTF-8
charset: windows-1252
sendCharset: 0
mimeHeader: Cache-Control: no-cache
Pragma: no-cache
Accept: application/json, text/javascript, /; q=0.01
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0
X-Requested-With: XMLHttpRequest
Referer: https://www.pinterest.com/login/
X-APP-VERSION: f2e5001
X-CSRFToken: DwGGvlXmTp3pgpytSrNJfxecuDOnbOcD
X-NEW-APP: 1
requestParams:
requestItem:
name: source_url
value: /login/
--requestItem
requestItem:
name: data
value: {"options":{"username_or_email":"Rosemary_they4993@sharklasers.com","password":"bvhz1A_835"},"context":{}}
--requestItem
requestItem:
name: module_path
value: App()>LoginPage()>Login()>Button(class_name=primary, text=Log In, type=submit, size=large)
--requestItem
--requestParams
--httpRequest
fullRequest:
a_synchronousRequest:
generateRequest:
httpRequestGenStartLine:
genStartLine:
startLine: POST /resource/UserSessionResource/create/ HTTP/1.1
--genStartLine
--httpRequestGenStartLine
addCookies:
Auto-adding any accumulated cookies.
CookieDir: memory
CookieDomain: www.pinterest.com
CookiePath: /resource/UserSessionResource/create/
LoadCookieJar:
Path: /resource/UserSessionResource/create/
GetDomainCookiesXml:
CookieDir: memory
Domain: www.pinterest.com
HashKey: pinterest_com.xml
--GetDomainCookiesXml
--LoadCookieJar
AddingCookie: csrftoken=DwGGvlXmTp3pgpytSrNJfxecuDOnbOcD; _pinterest_sess="eJwLNC4yME339nMtzy9NtbQI89Y3czP2Tg9zDY60tY8vycxNtfUNCSz3rXI09qtKLvcNtLVVK04tLs5MsfXMSq7wDfHL8suKNI3M8sr1cwGqc8nI8AsBqjXyNPYPCa30Cw819QtJNvFMt7UFAF8dItQ="
--addCookies
--generateRequest
fullHttpRequest:
domain: www.pinterest.com
port: 443
ssl: 1
openHttpConnection:
Opening connection through an HTTP proxy.
proxyDomain: 127.0.0.1
proxyPort: 8888
httpHostname: www.pinterest.com
httpPort: 443
ssl: 1
socket2Connect:
httpProxyConnect:
proxyHostname: 127.0.0.1
proxyPort: 8888
No proxy authentication method specified.
connectRequest: CONNECT www.pinterest.com:443 HTTP/1.1
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Host: www.pinterest.com
connectResponseHeader: HTTP/1.1 200 Connection Established
FiddlerGateway: Direct
StartTime: 13:18:23.825
Connection: close
firstLine: HTTP/1.1 200 Connection Established
--httpProxyConnect
checkServerCert:
Not verifying server certificate...
Set the RequireSslCertVerify property to enable verification.
--checkServerCert
Secure Channel Established.
--socket2Connect
connectElapsedMs: 328
HTTP connection succeeded.
--openHttpConnection
connectTime: Elapsed time: 328 millisec
sendRequestHeader:
sendHeaderElapsedMs: 0
--sendRequestHeader
sendRequestBody:
sendBodyElapsedMs: 0
--sendRequestBody
statusCode: 401
statusText: UNAUTHORIZED
readResponseBody:
contentLength: 280
--readResponseBody
checkUngzipResponse:
decompressing GZIP response...
--checkUngzipResponse
--fullHttpRequest
computeAuthorization:
No useful WWW-Authenticate response header was found.
--computeAuthorization
computeAuthorization failed (2).
success: 0
--a_synchronousRequest
--fullRequest
Failed.
--PostUrlEncoded
--ChilkatLog
Response is null http://prntscr.com/3tyytg
This was a problem in older versions of Chilkat but should not be an issue in the latest version.
This has since been fixed. Any Chilkat HTTP method that returns an HTTP response object should return the object if any valid HTTP response was received, regardless of the success/failure of the HTTP response code. You'll need a pre-release because this was the first change after the v9.5.0.44 release.