1
0
mirror of synced 2025-06-12 07:41:53 +03:00
Commit Graph

1159 Commits

Author SHA1 Message Date
0823d5c7f2 Fixed #1031 2021-08-30 17:16:31 -04:00
1cc6930363 Append '_Online' suffix to Unit test names that access external servers v0.9.3 2021-08-23 13:02:19 -04:00
4297500928 Fix #1024 2021-08-17 09:28:17 -04:00
a58f042614 Don't define INVALID_SOCKET if it has been defined already (i.e. by libpcap) (#1021)
Co-authored-by: Thomas Behn <Thomas.Behn@meinberg.de>
2021-08-10 08:29:27 -04:00
469c6bc2b6 Fix #1017 2021-08-02 15:44:50 -04:00
887074efd2 Add test of httplib.h split into .h + .cc (#1015)
In order to test the split version (.h + .cc via split.py):

- Added a test_split program in the test directory whose main purpose is
  to verify that it works to compile and link the test case code against
  the split httplib.h version.
- Moved types needed for test cases to the “header part” of httplib.h.
  Also added forward declarations of functions needed by test cases.
- Added an include_httplib.cc file which is linked together with test.cc
  to verify that inline keywords have not been forgotten.

The changes to httplib.h just move code around (or add forward
declarations), with one exception: detail::split and
detail::process_client_socket have been converted to non-template
functions (taking an std::function instead of using a type parameter for
the function) and forward-declared instead. This avoids having to move
the templates to the “header part”.
2021-07-31 09:53:30 -04:00
9c2c15ca45 Add missing template method implementations (#1013)
When using the split version of httplib.h the templated implementation
of e.g. Client::set_connection_timeout ends up in httplib.cc and
therefore results in a linker error since the needed template
specialization has not been instantiated. Fix this by moving the
implementation of template methods into the part that ends up in
httplib.h after the split.

Fixes #1008.
2021-07-30 10:05:49 -04:00
1b3b098329 Avoid hardcoded ports in RedirectToDifferentPort.Redirect test (#1012)
The RedirectToDifferentPort.Redirect test assumes that port 8080 and
8081 are available on localhost. They aren’t on my system so the test
fails. Improve this by binding to available ports instead of hardcoded
ones.
2021-07-30 10:04:02 -04:00
6f7075e3aa Improve split script (#1011)
- Added shebang and made the script executable.
- Added help text.
- Added -o/--out argument for specifying output directory.
- Added -e/--extension argument for specifying file extension of the
  implementation file.
- Made the script find httplib.h next to split.py instead of the current
  working directory. This makes it possible to call the script from
  another directory.
- Simplified code structure slightly.
- Improved variable naming to follow Python conventions.
2021-07-30 10:03:05 -04:00
ccbddd8842 Allow LargeRandomData test only on Windows v0.9.2 2021-07-22 22:17:31 -04:00
879dd261c2 Fix gzip compression/decompression over 4 GiB data size (#1002)
* Fix gzip compression/decompression over 4 GiB data size

* Add gzip test for large random data
2021-07-22 22:07:40 -04:00
52f5eb5980 [Fix] ca_cert_path/ce_cert_store lose (#1004)
When redirect from http to https, user setting for ca_cert will lose

issue: #1003
2021-07-22 21:41:41 -04:00
ea2f69a0d7 Add httplib::Error to std::string function (#999)
Fixes: #978
2021-07-19 21:17:44 -04:00
9f2064a8ed Fix remaining test warnings (#1001)
* Use portable way to encode ESC

'\e' is a GNU extension

* Use length specifier for size_t
2021-07-19 21:17:18 -04:00
e3750d9ddf Simplefied server APIs 2021-07-17 18:09:30 -04:00
c1eee3012e Fix #998 2021-07-17 17:18:56 -04:00
6b08babbd2 Use googletest 1.11.0 (#1000)
* Update googletest to version 1.11.0

* Fix test warnings
2021-07-17 13:21:03 -04:00
215b81342e Added a test case for #996 v0.9.1 2021-07-15 08:24:06 -04:00
06bfa7e08b Fix #979 2021-07-14 22:49:49 -04:00
3d83cbb872 Improve string compare performance 2021-07-12 23:51:56 -04:00
8a803b30f6 Fix #990 2021-07-12 23:46:25 -04:00
80be649de7 Fix #961 2021-06-26 18:26:33 -04:00
9648f950f5 Updated README 2021-06-18 08:45:50 -04:00
6b9ffc8bec Remove dead code (#965) 2021-06-18 07:20:34 -04:00
d903053faf Update httplib.h (#964)
operator""_ replaced by operator""_t
2021-06-17 10:57:25 -04:00
676f1b5a26 Updated the user agent string 2021-06-14 08:43:12 -04:00
b8dec12f15 Limit SSL_ERROR_WANT_READ retries to 1 sec (#957)
retry with 1ms delays to prevent CPU hoggin
2021-06-14 08:41:20 -04:00
fc9b223acc Updated copyright year v0.9.0 2021-06-11 14:45:35 -04:00
ba824089d7 Fix code err code 401 when the password is empty in base_auth. (#958) 2021-06-11 14:39:33 -04:00
1a2faf09e0 Add header-only Meson support (#955)
* Add header-only Meson support
This allows users to call `dependency('httplib')` and have the include
directory automatically configured

* Rename `httplib` to `cpp-httplib`
2021-06-05 16:45:00 -04:00
5a43bb8149 Implemented #946 in a different way 2021-06-02 13:45:47 -04:00
0104614656 Code refactoring 2021-06-02 08:11:31 -04:00
77a77f6d2d Added set_default_headers on Server 2021-05-23 19:06:28 -04:00
089b9daa1c Fix virtual call in ClientImpl::~ClientImpl() (#942)
* Fix virtual call in ClientImpl::~ClientImpl()

This fixes a warning in clang tidy:

> Call to virtual method 'ClientImpl::shutdown_ssl' during
> destruction bypasses virtual dispatch

ClientImpl::~ClientImpl() calls lock_socket_and_shutdown_and_close()
that itself calls shutdown_ssl().  However, shutdown_ssl() is virtual
and C++ does not perform virtual dispatch in destructors, which results
in the wrong overload being called.

This change adds a non-virtual shutdown_ssl_impl() function that is
called from ~SSLClient().  We also inline sock_socket_and_shutdown_and_close()
and removes the virtual call in ~ClientImpl().

* Inline and remove lock_socket_and_shutdown_and_close()

The function only has one caller.
v0.8.9
2021-05-22 20:15:20 -04:00
ba34ea4ee8 Fix #944 2021-05-22 19:24:50 -04:00
2917b8a005 Explicit cast from size_t to uInt (#941)
* Explicit cast from size_t to uInt

* static_cast<uInt> instead of C style cast
2021-05-19 18:03:59 -04:00
dcf24d45a2 fix ssesvr use of deleted function (#938) 2021-05-18 23:19:15 -04:00
75fdb06696 Added a missing member in copy_settings. 2021-05-15 09:14:44 -04:00
e00ad37580 Add option to bypass URL encode of path (#934) 2021-05-15 08:48:25 -04:00
5cfb70c2b4 Fix some shadowed variable warnings (#935) 2021-05-15 08:46:16 -04:00
2a70c45697 Fix client.cc code, since res.error() without operator overloading… (#921)
* Fix client.cc code, since res.error() without operator overloading causing error in Xcode

* Add unit test to check new error to string with operator overloading

* Add inline as requested in code review comment
2021-05-01 13:29:23 -04:00
c58b00580e reserving before encoding (#912) 2021-04-24 16:19:14 -04:00
7c60e69c33 Remove redunant call to close_socket (#911) v0.8.8 2021-04-23 17:07:19 -04:00
33e94891ee Updated test.cc 2021-04-22 08:04:46 -04:00
73e0729f63 Change sink.write() to return boolean 2021-04-22 07:14:08 -04:00
21c529229c Fixed timeout issues 2021-04-22 07:14:08 -04:00
63643e6386 Code format v0.8.7 2021-04-13 20:52:49 -04:00
6cc2edce99 Added set_address_family 2021-04-13 20:49:52 -04:00
d122ff3ca8 Code formatting 2021-04-13 12:38:45 -04:00
14c6d526b4 Use newer version-flexible TLS/SSL method (#904) 2021-04-13 09:11:38 -04:00