'How do I update the domain variable of the CHttpRequest with the redirected domain/url in c++
I have the following code in a cpp program I have been asked to update with new urls: The customer facing url doesnt change but the redirect may so I need to get the program to go to the customer facing url and automatically follow the redirect and download the file, but I get the unable to connect error connection cannot be established error code 12005
CHttpRequest httpRequest(DOWNLOAD_DOMAIN, DOWNLOAD_URL, MINIMUM_NORMAL_DOWNLOAD_SIZE);
but the url redirects to another address and this is not being passed so the download fails.
CHttpRequest::CHttpRequest(const std::wstring& domain, const std::wstring& url, const unsigned int minCorrectSize):
m_url(url),
m_data(NULL),
m_dataSize(0),
m_session(NULL),
m_fileSize(0),
m_connect(NULL),
m_request(NULL),
m_domain(domain),
m_reportedSize(0),
m_hProgressBar(NULL),
m_minCorrectSize(minCorrectSize)
{
}
How do I update the domain variable of the CHttpRequest with the redirected url.
example of the url is -- https://domainname/Download/File/4 the ChttpRequest gives a 302 redirect to a hosted site. https://abcde.blob.core.windows.net/downloads/domainname/filename.zip the redirect
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
