Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yungpanz committed Dec 15, 2022
1 parent cdd0da8 commit f0082e5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion wnetwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,19 @@ wrap::Response wrap::httpsreq(wrap::req request) {
}

connectionopened: //used for relative URI redirect where only path (not host) changes
HINTERNET hRequest = HttpOpenRequestA(hConnect, request.Method.c_str(), URI["path"].c_str(), NULL , NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_NO_AUTO_REDIRECT, 0);

// Set flags based on request protocol
DWORD dwFlags = 0;
if (URI["scheme"] == "https")
{
dwFlags = INTERNET_FLAG_SECURE | INTERNET_FLAG_NO_AUTO_REDIRECT;
}
else if (URI["scheme"] == "http")
{
dwFlags = INTERNET_FLAG_NO_AUTO_REDIRECT;
}

HINTERNET hRequest = HttpOpenRequestA(hConnect, request.Method.c_str(), URI["path"].c_str(), NULL, NULL, NULL, dwFlags, 0);

if (hRequest == NULL)
{
Expand Down

0 comments on commit f0082e5

Please sign in to comment.