Commit Graph

962 Commits

Author SHA1 Message Date
Peter Boström
0cc1ca9a8d
Remove extra semicolon (#1963)
This fixes a -Wc++98-compat-extra-semi instance.
2024-10-15 00:09:04 -04:00
yhirose
3701195033 Merge branch 'master' of github.com:yhirose/cpp-httplib 2024-10-14 21:32:28 -04:00
Peter Boström
f884a56258
Remove space between operator"" and _t (#1962)
This should fix a -Wdeprecated-literal-operator instance since this is
deprecated as a result of CWG2521 (iiuc C++23).
2024-10-14 21:32:13 -04:00
yhirose
d79633ff52 clangformat 2024-10-11 14:49:46 -04:00
yhirose
e0ebc431dc Fix #1959 2024-10-11 13:43:01 -04:00
yhirose
e64379c3d7 Release v0.18.0 2024-09-12 12:28:35 -04:00
Jean-Francois Simoneau
932b1cbc32
Fix shadow parameter warning (#1936) 2024-09-12 12:02:25 -04:00
yhirose
de36ea7755 Fix #1933 on Linux and macOS 2024-09-09 23:07:27 -04:00
yhirose
9f8db2c230 Fix #1933 2024-09-09 22:22:56 -04:00
yhirose
3f00e1b321 Revert "Changed set_file_content to accept only a regular file path."
This reverts commit 7ab9c119ef.
2024-09-09 20:03:47 -04:00
yhirose
7ab9c119ef Changed set_file_content to accept only a regular file path. 2024-09-09 19:59:18 -04:00
yhirose
3f2922b3fa Fix #1929 2024-09-09 19:25:52 -04:00
yhirose
e612154694
Issue1431 (#1926)
* Renamed enable_server_host_verification to enable_server_hostname_verification and added Error::SSLServerHostnameVerification

* Add some Open SSL function calls

* Code cleanup

* Fix #1431
2024-09-08 22:45:47 -04:00
yhirose
82fcbe3901 Code cleanup 2024-09-08 20:10:35 -04:00
yhirose
dbd2465b56 Add some Open SSL function calls 2024-09-08 20:10:17 -04:00
yhirose
ea79494b29 Renamed enable_server_host_verification to enable_server_hostname_verification and added Error::SSLServerHostnameVerification 2024-09-08 20:08:52 -04:00
yhirose
a79c56d06b Fix #1796 2024-09-08 09:26:19 -04:00
yhirose
4c27f9c6ef Made default server and client read/write timeout settings separately 2024-09-07 21:06:23 -04:00
yhirose
d173a37d17 Increased CPPHTTPLIB_READ_TIMEOUT_SECOND to 300 from 5 2024-09-07 16:10:54 -04:00
yhirose
7fd346a2ca Fix #1379 2024-09-07 16:07:45 -04:00
yhirose
3e86d93d13 clangformat 2024-09-07 10:16:03 -04:00
yhirose
f6e4e2d0f3 Code cleanup 2024-09-07 10:15:22 -04:00
yhirose
8415bf0823 Resolve #1906 2024-09-07 00:05:41 -04:00
orbea
327ff263f5
httplib.h: support LibreSSL (#1922) 2024-09-06 22:19:53 -04:00
yhirose
61c418048d Release v0.17.3 2024-09-06 19:58:02 -04:00
yhirose
9720ef8c34 Code cleanup 2024-09-06 19:48:25 -04:00
yhirose
978a4f6345
Fix KeepAliveTest.SSLClientReconnectionPost problem (#1921) 2024-09-06 13:58:24 -04:00
bgs99
80fb03628b
Only match path params that span full path segment (#1919)
* Only match path params that span full path segment

* Fix C++11 build
2024-09-06 08:48:51 -04:00
laowai9189
2480c0342c
‘constexpr’ error (#1918)
httplib.h: In member function ‘constexpr size_t httplib::detail::case_ignore_hash::operator()(const string&) const’:
httplib.h:359:30: error: call to non-‘constexpr’ function ‘const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::data() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
  359 |     return hash_core(key.data(), key.size(), 0);
2024-09-06 07:23:29 -04:00
yhirose
cb74e4191b Performance imporovement for Keep-Alive 2024-09-06 00:03:43 -04:00
yhirose
969a9f99d5 Adjust sleep 2024-09-05 22:54:28 -04:00
yhirose
c099b42ba3 Removed write_format 2024-09-05 22:17:56 -04:00
yhirose
953e4f3841 Adjust sleep duration 2024-09-05 17:45:09 -04:00
yhirose
12c829f6d3 Fix #1389 and #1907 2024-09-05 17:44:32 -04:00
yhirose
ef63f97afe Release v0.17.2 2024-09-05 12:57:26 -04:00
yhirose
bda74db01d Fix fuzzing test error 2024-09-05 12:50:05 -04:00
yhirose
9ff3ff9446 Fixed build error 2024-09-05 12:27:50 -04:00
yhirose
b4989130da Peformance improvement by removing tolower function call 2024-09-05 12:09:38 -04:00
yhirose
4fc0303bda clangformat 2024-09-05 12:07:35 -04:00
yhirose
3d9cc51851 Fixed build error on Windows due to max macro in windows.h 2024-09-05 12:02:40 -04:00
yhirose
ee4eb8deaa Merge branch 'fix-100-continue' of github.com:solarispika/cpp-httplib into solarispika-fix-100-continue 2024-09-04 08:45:48 -04:00
Sung, Po Han
7196ac8a07 Fix incorrect handling of Expect: 100-continue
Fix #1808
2024-09-04 17:50:42 +08:00
yhirose
c88b09bc6b Release v0.17.1 2024-09-03 21:20:57 -04:00
yhirose
4e6055f084 Fix problem with Abstract Namespace Unix Domain 2024-09-03 20:56:16 -04:00
yhirose
975cf0dae5 Fix #1908 2024-09-03 18:00:12 -04:00
yhirose
4854a694cd Use IPPROTO_IP 2024-09-03 17:29:28 -04:00
yhirose
b1f8e986bf
Fix #1908 (#1910)
* Fix #1908

* Code format
2024-09-03 00:47:39 -04:00
yhirose
c5ee208775 Fix build error on Mac and Linux 2024-09-02 23:04:38 -04:00
yhirose
2514ebc20f Fix #1848 2024-09-02 20:38:01 -04:00
yhirose
4f9c6540b2 Fixed warning 2024-09-02 20:33:33 -04:00
mol123
21c9a6a1ff
Windows: simplify conditional compilation and fix call to CreateFileMappingW. (#1909) 2024-09-02 18:01:05 -04:00
yhirose
7f6d413ddd Release v0.17.0 2024-09-01 07:53:56 -04:00
yhirose
88277139e7
Added set_ipv6_v6only method (#1905)
* Added `set_ipv6_v6only` method

* Adjust the place where socket_options is called
2024-09-01 07:52:24 -04:00
yhirose
6cdd3493a1 Fix #1788 2024-09-01 01:55:27 -04:00
yhirose
9c91b6f4a6 Fix #1645 2024-09-01 00:11:07 -04:00
yhirose
d82c82db2c Add sleep in handle_EINTR 2024-08-31 17:19:52 -04:00
yhirose
da0c6579fa Breaking Change! get_header_ methods on Request and Response now take a default value. 2024-08-31 17:07:48 -04:00
yhirose
048edec9ed Changed CPPHTTPLIB_KEEPALIVE_MAX_COUNT to 100 2024-08-26 21:10:38 -04:00
yhirose
af56b7ec0b Release v0.16.3 2024-08-17 09:53:26 -04:00
yhirose
390f2c41f6
Fix #1878 (#1893)
* Fix #1878
2024-08-08 22:07:46 -04:00
yhirose
c5c54b31e2 Release v0.16.2 2024-08-08 11:48:50 -04:00
Mark Mentovai
69c84c9597
BoringSSL compatibility fixes (#1892)
This patch is necessary to build cpp-httplib in Crashpad, itself in
Chromium, using BoringSSL. Details at [1].

The fixes include:
 - Library version check: tolerate BoringSSL as an alternative to
   OpenSSL 3.
 - Don’t call `OPENSSL_thread_stop`, which is not in BoringSSL.
 - Use `SSL_get_peer_certificate` (deprecated in OpenSSL 3), the old
   name for `SSL_get1_peer_certificate`, because the new name is not in
   BoringSSL.
 - Call `SSL_set_tlsext_host_name` directly instead of making an
   `SSL_ctrl` call that BoringSSL does not support. The feared
   -Wold-style-cast warning that occurs when buidling with OpenSSL is
   not triggered in BoringSSL.

[1] 1a62a01825
2024-08-08 11:47:56 -04:00
yhirose
ae63b89cbf Use SOCK_CLOEXEC instead of __linux__ 2024-08-06 17:31:55 -04:00
yhirose
ff038f98b7 Merge branch 'thread-safe-cloexec' of github.com:kdombroski/cpp-httplib into kdombroski-thread-safe-cloexec 2024-08-06 17:22:43 -04:00
yhirose
e00fd06355 Release v0.16.1 2024-08-06 17:04:22 -04:00
yhirose
521529d24d
Fix #1481 (with content provider) (#1527)
* Fix #1481 (with content provider)

* Improve shutdown performance

* Make shutdown action more stable

* Move some tests up

* Simplified

* Simplified
2024-08-06 13:43:00 -04:00
yhirose
ed0719f2bc Code format 2024-08-06 07:20:05 -04:00
hanslivingstone
6a848b1a16
Require a minimum of TLS 1.2 (#1889)
TLS 1. is deprecated: https://www.ietf.org/rfc/rfc8996.html
2024-07-30 17:18:33 -04:00
mol123
c8bcaf8a91
Fix build when targeting Windows 7 as platform. (#1869)
* Fix build when targeting Windows 7 as platform.

This change makes more of the code introduced in
https://github.com/yhirose/cpp-httplib/pull/1775
conditional on feature macros.

`CreateFile2`, `CreateFileMappingFromApp` and `MapViewOfFileFromApp` are
available only starting from Windows 8.

 * https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfile2
 * https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-createfilemappingfromapp
 * https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffilefromapp

* Update feature macros used and use `GetFileSizeEx` conditionally.
2024-07-02 10:58:40 -04:00
Hlado
8cd0ed0509
Added move assignment operator to Client class. (#1873) 2024-06-30 11:17:00 -04:00
Daniel Ludwig
388a8c007c
Fix build on Windows with no WINAPI_PARTITION_APP support (#1865) 2024-06-24 15:13:37 -04:00
Zhenlin Huang
9e4f93d87e
Allow hex for ipv6 literal addr in redirect (#1859)
Co-authored-by: jaredhuang <jaredhuang@tencent.com>
2024-06-17 11:44:51 -04:00
Rainer Schielke
c1a09daf15
avoid memory leaks if linked with static openssl libs (#1857)
* New function SSLServer::update_certs. Allows to update certificates while server is running

* New function SSLServer::update_certs. Added unit test

* avoid memory leaks if linked with static openssl libs

---------

Co-authored-by: CEU\schielke <Rainer.Schielke@heidelberg.com>
2024-06-14 15:40:03 -04:00
yhirose
8438df4a95 Release v0.16.0 2024-06-11 18:20:47 -04:00
Rainer Schielke
d44031615d
New function SSLServer::update_certs. Allows to update certificates while server is running (#1827)
* New function SSLServer::update_certs. Allows to update certificates while server is running

* New function SSLServer::update_certs. Added unit test

---------

Co-authored-by: CEU\schielke <Rainer.Schielke@heidelberg.com>
2024-06-03 09:37:40 -04:00
Sean Quinn
98cc1ec344
Allow hex for ip6 literal addr, fix #1800 (#1830)
* Allow hex for ip6 literal addr, fix #1800

* Add UT for ipv6 + Universal client implementation

* add /n at EOF
2024-05-26 08:57:07 -04:00
Pavel P
05f9f83240
Avoid unreferenced formal parameter warning in get_range_offset_and_length (#1838)
Release builds result in the following warning because `content_length` param was used only inside asserts:

1> cpp-httplib\httplib.h(4933,45): warning C4100: 'content_length': unreferenced formal parameter
2024-05-17 09:56:06 +09:00
Karen Dombroski
fb739dbaec threadsafe accept on windows, linux
* Windows has WSAAccept() which will create sockets inheriting flags from
  the server socket

* Linux has accept4() which has a flags argument supporting SOCK_CLOEXEC
2024-05-01 21:58:58 +12:00
Karen Dombroski
50fce538c6 threadsafe CLOEXEC on platforms that support it
SOCK_CLOEXEC is a flag available on some platforms to enable creation of
sockets with CLOEXEC already set
2024-05-01 21:46:50 +12:00
Jiwoo Park
3b6597bba9
Fix query parsing when value has = characters (#1822)
* Implement string divider to replace splitter

* Divide query string in half

* Add a test case for query values containing the '=' character

* Add test cases for string divider

* Fix warnings
2024-04-21 19:17:14 -04:00
rndm13
2bc550b2f0
Added progress to POST, PUT, PATCH and DELETE requests (#1821)
* Added progress to POST, PUT, PATCH, DELETE requests

* Added tests for post, put, patch, delete progress/cancellation

* fix accidental infinite recursion in delete

---------

Co-authored-by: rndm <rndm@localhost.localdomain>
2024-04-21 19:13:41 -04:00
Kent
560854a961
Apply range header base on response status code (#1806)
* Enable ignoring range header to generate customized response

* Apply range header base on response status code
2024-04-11 23:28:21 -04:00
yhirose
07288888ad Code cleanup 2024-04-11 22:26:30 -04:00
yhirose
34d392cf3d Merge branch 'fix' of github.com:HerrCai0907/cpp-httplib into HerrCai0907-fix 2024-04-11 22:22:58 -04:00
yhirose
825c3fbbb1 Removed excess usage of std::move 2024-04-11 21:21:27 -04:00
Rusty Conover
00bdf73ec6
fix: increase default receive buffer to 16kb (#1814)
Since TLS packets have a maximum size of 16kb it makes
sense to fully accommodate them on reads.

Co-authored-by: Rusty Conover <rusty@Juno.local>
2024-04-09 16:59:07 -04:00
Jiwoo Park
f44ab9b3da
Fix range parser when parsing too many ranges (#1812)
* Implement range parser without std::regex

* Add test cases for invalid ranges
2024-04-07 10:06:16 -04:00
yhirose
548dfff0ae Fix #1793 2024-03-09 22:26:17 -05:00
Congcong Cai
4dd2f3d03d fix ambiguous for HandlerWithResponse and Handler in set_error_handler
using lambda expression as Handler in set_error_handler will cause ambiguous.
Template forwarding can forward HandlerWithResponse to the correct overloading function
2024-03-07 19:07:39 +08:00
Jiwoo Park
c5a0673c93
Use final keyword for devirtualization (#1779) 2024-02-17 09:17:15 -05:00
Sergey
ad40bd6a00
Implement file mapping for UWP apps (#1775)
Fixes #1773.
2024-02-08 22:59:34 -05:00
yhirose
5c00bbf36b Release v0.15.3 2024-02-05 22:12:43 -05:00
yhirose
9d6f5372a3 Fix #1772 2024-02-05 22:11:53 -05:00
yhirose
80c0cc445e Release v0.15.2 2024-02-02 23:29:30 -05:00
yhirose
762024b890 Fix #1768 2024-02-02 23:17:32 -05:00
yhirose
82a90a2325 Update year 2024-01-29 08:53:01 -05:00
yhirose
b7cac4f4b8 Release v0.15.1 2024-01-29 07:40:56 -05:00
yhirose
e323374d2a Fix #1766 2024-01-28 17:43:51 -05:00
Jiwoo Park
ffc294d37e
Reduce object copy (#1767) 2024-01-28 08:18:29 -05:00
yhirose
fceada9ef4 Changed to return 416 for a request with an invalid range 2024-01-28 08:13:19 -05:00