David Sommerseth
dde1574596
Reformatting source code to new coding style
...
This is the result after running 'clang-format -i' on all C++ files and
headers, with the defined formatting rules in .clang-format.
Only the openvpn/common/unicode-impl.hpp has been excluded, as that is
mostly a copy of an external project.
Signed-off-by: David Sommerseth <davids@openvpn.net>
2023-01-18 19:24:15 +01:00
David Sommerseth
4996c38ed4
Merge lastest changes from Core v3.7.2
2022-12-14 17:34:29 +01:00
Arne Schwabe
3135d115a0
Replace throw() with noexcept and mark some exception constructors explicit
...
throw() is the same as noexcept(true), which is the same as noexpect.
(https://en.cppreference.com/w/cpp/language/noexcept_spec )
noexpect is more standard nowadays and less likely to create confusion.
Single argument constructors should be marked explicit so they do not
end up being acidentially called.
2022-11-16 17:22:09 +01:00
David Sommerseth
8c94a8f774
copyright: Update to 2022
...
Signed-off-by: David Sommerseth <davids@openvpn.net>
2022-09-29 12:00:26 +02:00
Frank Lichtenheld
b62863336d
openvpn/http: document source and add license text
...
While the link is probably fine for most people
it is not strictly enough to fulfill the license
terms. Since this code is very limited in scope
I decided to add the txt file not in top directory
but rather near the files where it matters.
Add PURL to document where the source came from.
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2022-02-25 15:08:52 +01:00
James Yonan
46e7b3e2ff
URL::Parse: improve support for bracketed hosts such as IPv6 addresses
...
Signed-off-by: James Yonan <james@openvpn.net>
2021-11-24 13:18:35 -07:00
James Yonan
777ff5556f
HTTP::HeaderList: minor performance fix
...
Return std::string() rather than the empty string.
Signed-off-by: James Yonan <james@openvpn.net>
2020-09-02 20:38:10 +02:00
David Sommerseth
492661fd02
Merging release/3.5.5 into master
2020-04-24 17:33:51 +02:00
ybarnovych
34435cbf65
Support optional HTTP Status Code reason
...
In HTTP 1.1 specification reason phrase in HTTP Status becomes optional.
For example, Tomcat 9 doesn't provide it.
See details: https://bz.apache.org/bugzilla/show_bug.cgi?id=60183
We need to make changes in our HTTP response parser accordingly.
Signed-off-by: Yuriy Barnovych yuriy@openvpn.net
2020-03-31 17:14:15 +03:00
David Sommerseth
3fbe0a2701
Update copyrights
...
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-03-18 19:37:32 +01:00
Arne Schwabe
6035e3afed
Replace std::regex with non regex for HTTP redact
...
std::regex fails with CentOS7 and RHEL7.
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-01-29 18:13:28 +01:00
James Yonan
1719681472
Added HTTP::headers_redact() for redacting basic auth creds from Authorization header
...
Before debug logging, HTTP headers should be passed through
HTTP::headers_redact() to prevent the creds from being logged.
Signed-off-by: James Yonan <james@openvpn.net>
2019-11-20 11:14:23 +01:00
James Yonan
02bf235c66
Reverted previous commit: "ReplyParser: added undefined status"
...
Signed-off-by: James Yonan <james@openvpn.net>
2018-12-12 23:26:12 -07:00
James Yonan
18e50ec3f7
ReplyParser: added undefined status
...
Signed-off-by: James Yonan <james@openvpn.net>
2018-08-30 13:00:27 +03:00
Arne Schwabe
2991d38b31
Fix warnings reported by LLVM/Clang
2018-07-05 18:49:10 +02:00
David Sommerseth
16b10559f2
[OVPN3-140] Update company names in copyrights
...
OpenVPN Technologies, Inc. change their name to OpenVPN Inc. during the
autumn of 2017.
Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-12-22 17:59:39 +08:00
David Sommerseth
6caca2c313
[OVPN3-140] Relicense back to AGPLv3
...
This is essentially a revert of commit 04b2a3c9b7
and commit
ef42e59e05
.
Signed-off-by: David Sommerseth <davids@openvpn.net>
2017-12-22 17:59:39 +08:00
James Yonan
1502cf6946
URL::Parse: made is_valid_uri_char() standalone and moved to validate_uri.hpp
...
In validate_uri.hpp, added these new methods:
* HTTP::is_valid_uri_char()
* HTTP::validate_uri()
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:17 +08:00
James Yonan
2dcb18993c
Added HTTP::Status::SwitchingProtocols constant
...
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:17 +08:00
James Yonan
2f57024e8c
HTTP::HeaderList: added get_value_trim_lower() method
...
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:17 +08:00
James Yonan
bee94d2b4c
HTTP::HeaderList: get_value() and get_value_trim() should return std::string instead of const std::string
...
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:17 +08:00
James Yonan
b2cd82a5bf
copyright: updated to 2017.
...
Signed-off-by: James Yonan <james@openvpn.net>
2017-03-18 13:11:09 -06:00
James Yonan
ceef1169af
HTTP Header: minor refactor
...
* added name_match()
* use std::move where appropriate
2017-03-18 12:24:54 -06:00
James Yonan
7ee5768d1d
URL::Parse : added loose_validation flag.
2017-03-18 12:24:54 -06:00
James Yonan
83dbe7dc1e
URL::Parm : added get_num_required() and
...
get_string_required() methods.
2017-03-18 12:24:54 -06:00
James Yonan
260e9436f6
URL::decode() optimization : reserve output string.
2017-03-18 12:24:54 -06:00
James Yonan
791344ba0f
URL::Parm : added get_num(), get_bool(), get_string()
...
methods.
2017-03-18 12:24:54 -06:00
Samuli Seppänen
04b2a3c9b7
Switch from AGPLv3 to GPLv3
...
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
2017-03-16 14:43:55 +02:00
James Yonan
971abda88f
copyright : updated to 2016
2016-09-03 23:29:23 -06:00
James Yonan
54fdda2ef4
URL::parm : added URL::ParmList::get_value_required()
...
method.
2016-08-17 11:34:45 -07:00
James Yonan
f3ed986525
URL::parm : trivial fix to return std::string instead of
...
const std::string.
2016-08-17 11:34:16 -07:00
James Yonan
b88fc41c7b
URL::encode : do a speculative reserve() on return string.
2016-08-17 11:33:19 -07:00
James Yonan
3552263fe4
HTTP : added a simple method parser.
2016-06-09 17:20:04 -06:00
James Yonan
dbe8a991e1
URL : Added URL::encode() method.
2016-06-09 17:18:06 -06:00
James Yonan
7caa2817f0
HTTP parser : change all char variables to unsigned char
...
so as to be more straightforward with unicode.
2016-06-09 17:15:43 -06:00
James Yonan
982f57c0f4
HTTP HeaderList : Added a non-const get() method, so users
...
can modify headers as well as read them.
2016-06-09 16:57:32 -06:00
James Yonan
1ab262d48f
urlparm : added URL::ParmList::request() method (no
...
parameters) to return raw request string.
2016-05-27 23:13:55 -06:00
James Yonan
387c8f04c0
urlencode : removed match_path() and match_prefix() as they
...
are no longer used and are redundant with URL::decode_path().
2016-05-27 23:12:02 -06:00
James Yonan
a6b5e84905
urlparse.hpp : if URI is empty, set to "/".
2015-10-24 18:28:04 -06:00
James Yonan
979f04174f
URL::Parse changes:
...
* Added from_components() static initializer.
* In to_string() method, don't include the port number
in the URL if it is standard, i.e. 80 for http or 443
for https.
* In to_string() method, bracket the host/address if it
contains one of these chars: ':', '/', or '\'.
* Normalize and document the usage where special address
types such as unix domain sockets or windows named pipes
store a tag such as "unix" or "np" as the port component
of an address/port tuple.
2015-10-17 11:49:40 -06:00
James Yonan
b319973fec
Added URL::Parse() class for parsing/validating URLs.
2015-10-15 23:45:00 -07:00
James Yonan
d3071a7477
Added HTTP::WebException for throwing exceptions
...
with specific HTTP status codes.
2015-09-02 12:12:00 -07:00
James Yonan
8d54cbd053
Added URL::Parm and URL::ParmList for parsing URL parameters.
2015-09-02 12:09:53 -07:00
James Yonan
959fce9cae
In HTTP::Status (status.hpp), added 412 PreconditionFailed.
2015-09-02 03:13:57 -07:00
James Yonan
fb753bc008
In HTTP::Request (request.hpp), added at_least_http_1_1()
...
method.
2015-09-02 03:12:42 -07:00
James Yonan
e19ce0506a
In urlencode.hpp decode_path() method, remove leading '/'
...
from URI.
Also added new methods match_path() and match_prefix().
2015-07-04 16:01:03 -06:00
James Yonan
ec2f50fa0f
In HTTP::Status, added 401 Unauthorized.
2015-07-04 16:00:05 -06:00
James Yonan
c9930250d9
Forgot space between "Bad Request" in HTTP status strings.
2015-06-28 00:33:16 -06:00
James Yonan
256c07ff28
Added new source file openvpn/http/urlencode.hpp to deal with
...
URL validation, encoding, and decoding.
2015-06-27 16:36:20 -06:00
James Yonan
6218afd80d
Added 400 Bad Request HTTP status code.
2015-06-27 16:25:24 -06:00