Skip to content

Commit

Permalink
added cookie support
Browse files Browse the repository at this point in the history
  • Loading branch information
hack-tramp authored Jun 23, 2021
1 parent 9ef51a2 commit df02a9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wnetwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,12 @@ wrap::Response wrap::httpsreq(wrap::req request) {
{
c = tolower(c);
}
//cookies are dealt with on the spot
if (fieldname == "set-cookie") {
std::string cval = token.substr(token.find(":") + 1);
std::string cookie_url = scheme + "://" + host;//ignoring path for now
InternetSetCookieA(&cookie_url[0], NULL, &cval[0]);
}
output.header.insert(std::pair<std::string, std::string>(fieldname, token.substr(token.find(":") + 1)) );
}
s.erase(0, pos + delimiter.length());
Expand Down
4 changes: 4 additions & 0 deletions wnetwrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ fix: accept gzip data... see this async wrapper that does it: https://www.codepr
fix: HttpOpenRequestA and HttpSendRequestA seem to work passing utf-8 params even though the docs recommend always using the W commands
notes
- cookies currently only set for url without path (domain only)
- no cookie url encoding
- session cookies not preserved
- in url only query params, not host / path is url encoded
- due to MS bug timeout is done via worker thread, this means it cant be increased beyond MS default
also timeouts might cause memory leaks, are all threads, pointers, structs, vars etc deleted/freed?
Expand Down

0 comments on commit df02a9d

Please sign in to comment.