mirror of https://github.com/Icinga/icinga2.git
Don't sent scheme and hostname in request
This commit is contained in:
parent
a8bac0a42e
commit
de51966f52
|
@ -49,7 +49,7 @@ public:
|
|||
return false;
|
||||
|
||||
pUrl = f.GetUrl();
|
||||
url = pUrl->Format(true);
|
||||
url = pUrl->Format(false, true);
|
||||
wUrl = url;
|
||||
config.Write("url", wUrl);
|
||||
} else {
|
||||
|
|
|
@ -165,7 +165,7 @@ void HttpRequest::AddHeader(const String& key, const String& value)
|
|||
void HttpRequest::FinishHeaders(void)
|
||||
{
|
||||
if (m_State == HttpRequestStart) {
|
||||
String rqline = RequestMethod + " " + RequestUrl->Format() + " HTTP/1." + (ProtocolVersion == HttpVersion10 ? "0" : "1") + "\n";
|
||||
String rqline = RequestMethod + " " + RequestUrl->Format(true) + " HTTP/1." + (ProtocolVersion == HttpVersion10 ? "0" : "1") + "\n";
|
||||
m_Stream->Write(rqline.CStr(), rqline.GetLength());
|
||||
m_State = HttpRequestHeaders;
|
||||
}
|
||||
|
|
|
@ -227,17 +227,19 @@ void Url::SetFragment(const String& fragment) {
|
|||
m_Fragment = fragment;
|
||||
}
|
||||
|
||||
String Url::Format(bool print_credentials) const
|
||||
String Url::Format(bool onlyPathAndQuery, bool printCredentials) const
|
||||
{
|
||||
String url;
|
||||
|
||||
if (!m_Scheme.IsEmpty())
|
||||
url += m_Scheme + ":";
|
||||
if (!onlyPathAndQuery) {
|
||||
if (!m_Scheme.IsEmpty())
|
||||
url += m_Scheme + ":";
|
||||
|
||||
if (print_credentials && !GetAuthority().IsEmpty())
|
||||
url += "//" + GetAuthority();
|
||||
else if (!GetHost().IsEmpty())
|
||||
url += "//" + GetHost() + (!GetPort().IsEmpty() ? ":" + GetPort() : "");
|
||||
if (printCredentials && !GetAuthority().IsEmpty())
|
||||
url += "//" + GetAuthority();
|
||||
else if (!GetHost().IsEmpty())
|
||||
url += "//" + GetHost() + (!GetPort().IsEmpty() ? ":" + GetPort() : "");
|
||||
}
|
||||
|
||||
if (m_Path.empty())
|
||||
url += "/";
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
Url();
|
||||
Url(const String& url);
|
||||
|
||||
String Format(bool print_credentials = false) const;
|
||||
String Format(bool onlyPathAndQuery = false, bool printCredentials = false) const;
|
||||
|
||||
String GetScheme(void) const;
|
||||
String GetAuthority(void) const;
|
||||
|
|
Loading…
Reference in New Issue