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;
}
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 += "/";
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;