Will cookies be properly processed if I do not spe...
# ktor
a
Will cookies be properly processed if I do not specify
Copy code
install(HttpCookies) {
            storage = AcceptAllCookiesStorage()
        }
on client init? Specifying this causes iOS MPP to crash, but I need cookies! ;/ P.S. Also I cannot extract it from headers directly 'cause it looks like ktor strips the "Set-Cookie" header before 😕
🤔 1
👀 1
e
Hi @Andy Victors, ktor shouldn't strip
Set-Cookie
header. Can you provide the request sample or log?
btw: CookieStorage is fixed in master and can be workarounded by implementing
CookieStorage
interface in place.
a
I've just rechecked with Postman and Postman also does not show cookie header, but after response I see the cookie I need in Postman's cookie list. So I'm going to refresh my understanding of cookie passing & possibly retest.
May be you can still give me hints on this issue. I'm doing simple request using ktor (iOS, ktor follows redirects)
Copy code
GET <https://mydomain.com/vpn/lx/index.html>
Since the URL is being the firewall, I get the login-page back, after one redirect (302). Here is the log from doing the same from browser :
Copy code
Summary
URL: <https://mydomain.com/vpn/lx/index.html>
Status: 200 OK
Source: Network
Address: 87.193.156.22:443

Request
GET /vpn/lx/index.html HTTP/1.1
Cookie: NSC_TASS=aHR0cHM6Ly9sb3MubG94eGVzcy5jb206MTgwODAvbG9zc2VydmljZWFwaS92MS9pbmZvJmNzcmY9ZDIwYzM0MWQ0MTA5MDBjZg%3D%3D
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Host: <http://los.loxxess.com|los.loxxess.com>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15
Accept-Language: en-us
Accept-Encoding: br, gzip, deflate
Connection: keep-alive

Response
HTTP/1.1 200 OK
Content-Type: text/html
Keep-Alive: timeout=15, max=100
Pragma: no-cache
Last-Modified: Tue, 08 Aug 2017 18:00:46 GMT
Content-Encoding: gzip
Expires: 0
Cache-Control: no-cache, no-store, must-revalidate
Date: Tue, 25 Jun 2019 11:47:16 GMT
Content-Length: 1598
Connection: Keep-Alive
ETag: "f94-13ae-55641be1d2f80"
Accept-Ranges: bytes
X-Frame-Options: SAMEORIGIN
ntCoent-Length: 5038
Server: Apache
As you can see, the first response (302/redirect) returned cookie NSC_TASS, which then was used to follow redirect. This all works as expected. Now when doing the same over Ktor with automatic redirect, I get only the last 200 response, which does not contain any cookie header. But that means the cookie is lost for me - that's my problem. Assumingly I have to configure the cookie storage, but that's broken now for iOS, right?
The question is also, are cookies auto-processed and stored by default, without using
storage = AcceptAllCookiesStorage()
?