Use symbolic constants for HTTP ports and status codes

No real changes, just avoid using raw numbers, which is not very
readable, notably for HTTP_STATUS_PROXY_AUTH_REQ which is not really a
well-known value.
This commit is contained in:
Vadim Zeitlin
2021-01-09 21:04:18 +01:00
parent 5d236edeed
commit 88a3e9c0a3

View File

@@ -208,10 +208,10 @@ void wxWebRequestWinHTTP::CreateResponse()
return; return;
int status = m_response->GetStatus(); int status = m_response->GetStatus();
if ( status == 401 || status == 407) if ( status == HTTP_STATUS_DENIED || status == HTTP_STATUS_PROXY_AUTH_REQ )
{ {
m_authChallenge.reset(new wxWebAuthChallengeWinHTTP( m_authChallenge.reset(new wxWebAuthChallengeWinHTTP(
(status == 407) ? wxWebAuthChallenge::Source_Proxy : wxWebAuthChallenge::Source_Server, *this)); status == HTTP_STATUS_PROXY_AUTH_REQ ? wxWebAuthChallenge::Source_Proxy : wxWebAuthChallenge::Source_Server, *this));
if ( m_authChallenge->Init() ) if ( m_authChallenge->Init() )
SetState(wxWebRequest::State_Unauthorized, m_response->GetStatusText()); SetState(wxWebRequest::State_Unauthorized, m_response->GetStatusText());
else else
@@ -243,7 +243,7 @@ void wxWebRequestWinHTTP::Start()
int port; int port;
if ( !uri.HasPort() ) if ( !uri.HasPort() )
port = isSecure ? 443 : 80; port = isSecure ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT;
else else
port = wxAtoi(uri.GetPort()); port = wxAtoi(uri.GetPort());