diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-03-01 15:51:55 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-03-01 17:41:27 +0000 |
commit | 96537cd4654df65bcde3f2ccde053800210a9d33 (patch) | |
tree | c060577979d007fb6b39f679a4a1b732420a53f0 /tools | |
parent | fe04156def447076e56a78fe1722c64ca7fcda4f (diff) |
Teach INetURLObject about RFC 7230 URLs with no path but query
While RFC 2616 "Hypertext Transfer Protocol -- HTTP/1.1" defined
> http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]
RFC 7230 "Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing"
defines
> http-URI = "http:" "//" authority path-abempty [ "?" query ]
> [ "#" fragment ]
Change-Id: I83b1baa404d28bf3b28b1db812f8930bbc1aaf90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148064
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qa/cppunit/test_urlobj.cxx | 4 | ||||
-rw-r--r-- | tools/source/fsys/urlobj.cxx | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx index 404f5c5a6ed1..fb0c96f846a5 100644 --- a/tools/qa/cppunit/test_urlobj.cxx +++ b/tools/qa/cppunit/test_urlobj.cxx @@ -96,9 +96,9 @@ namespace tools_urlobj CPPUNIT_ASSERT_EQUAL(OUString("/"), url.GetURLPath()); } { - // This is an invalid http URL per RFC 2616: + // This is a valid http URL per RFC 7230: INetURLObject url(u"http://example.com?query"); - CPPUNIT_ASSERT(url.HasError()); + CPPUNIT_ASSERT(!url.HasError()); } { INetURLObject url(u"http://example.com#fragment"); diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 764bb28ef623..417618acbc94 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -2985,7 +2985,8 @@ bool INetURLObject::parsePath(INetProtocol eScheme, case INetProtocol::Https: case INetProtocol::Smb: case INetProtocol::Cmis: - if (pPos < pEnd && *pPos != '/' && *pPos != nFragmentDelimiter) + if (pPos < pEnd && *pPos != '/' && *pPos != nQueryDelimiter + && *pPos != nFragmentDelimiter) goto failed; while (pPos < pEnd && *pPos != nQueryDelimiter && *pPos != nFragmentDelimiter) |