Skip to content

Commit df02a9d

Browse files
authored
added cookie support
1 parent 9ef51a2 commit df02a9d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

wnetwrap.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,12 @@ wrap::Response wrap::httpsreq(wrap::req request) {
583583
{
584584
c = tolower(c);
585585
}
586+
//cookies are dealt with on the spot
587+
if (fieldname == "set-cookie") {
588+
std::string cval = token.substr(token.find(":") + 1);
589+
std::string cookie_url = scheme + "://" + host;//ignoring path for now
590+
InternetSetCookieA(&cookie_url[0], NULL, &cval[0]);
591+
}
586592
output.header.insert(std::pair<std::string, std::string>(fieldname, token.substr(token.find(":") + 1)) );
587593
}
588594
s.erase(0, pos + delimiter.length());

wnetwrap.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ fix: accept gzip data... see this async wrapper that does it: https://www.codepr
33
fix: HttpOpenRequestA and HttpSendRequestA seem to work passing utf-8 params even though the docs recommend always using the W commands
44
55
notes
6+
- cookies currently only set for url without path (domain only)
7+
- no cookie url encoding
8+
- session cookies not preserved
9+
610
- in url only query params, not host / path is url encoded
711
- due to MS bug timeout is done via worker thread, this means it cant be increased beyond MS default
812
also timeouts might cause memory leaks, are all threads, pointers, structs, vars etc deleted/freed?

0 commit comments

Comments
 (0)