bool AnyAddress();
wxString Hostname();
+ wxString OrigHostname() { return m_origHostname; }
unsigned short Service();
virtual int Type() { return wxSockAddress::IPV4; }
- virtual wxSockAddress *Clone() const { return new wxIPV4address(*this); }
+ virtual wxSockAddress *Clone() const;
+
+private:
+ wxString m_origHostname;
};
#ifdef ENABLE_IPV6
if (!addr->Service(wxT("http")))
addr->Service(80);
-
+
SetHeader(wxT("Host"), host);
return TRUE;
wxIPV4address *ipv4addr = wxDynamicCast(&addr, wxIPV4address);
if (ipv4addr)
- SetHeader(wxT("Host"), ipv4addr->Hostname());
+ SetHeader(wxT("Host"), ipv4addr->OrigHostname());
return TRUE;
}
wxLogWarning( _("Trying to solve a NULL hostname: giving up") );
return FALSE;
}
-
+ m_origHostname = name;
return (GAddress_INET_SetHostName(m_address, name.mb_str()) == GSOCK_NOERROR);
}
bool wxIPV4address::Hostname(unsigned long addr)
{
- return (GAddress_INET_SetHostAddress(m_address, addr) == GSOCK_NOERROR);
+ bool rv = (GAddress_INET_SetHostAddress(m_address, addr) == GSOCK_NOERROR);
+ if (rv)
+ m_origHostname = Hostname();
+ else
+ m_origHostname = "";
+ return rv;
}
bool wxIPV4address::Service(const wxString& name)
return GAddress_INET_GetPort(m_address);
}
+wxSockAddress *wxIPV4address::Clone() const
+{
+ wxIPV4address *addr = new wxIPV4address(*this);
+ addr->m_origHostname = m_origHostname;
+ return addr;
+}
+
#if 0
// ---------------------------------------------------------------------------
// wxIPV6address