1
0
mirror of synced 2025-04-19 00:24:02 +03:00

982 Commits

Author SHA1 Message Date
yhirose
9e4aed482e Fix style error 2025-04-06 09:02:25 -04:00
yhirose
65d6316d65 Fix #2113 2025-04-05 22:40:08 -04:00
Piotr
dbc4af819a
Fix compilation error on windows (#2118)
afunix.h uses types declared in winsock2.h, and so has to be included
after it. Including afunix.h first will result in a somewhat unhelpful
compilation error:

error C3646: 'sun_family': unknown override specifier

Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@docker.com>
2025-03-25 08:36:20 -04:00
yhirose
7dbf5471ce Fix the style error and comment 2025-03-24 19:16:48 -04:00
Piotr
72b35befb2
Add AF_UNIX support on windows (#2115)
Signed-off-by: Piotr Stankiewicz <piotr.stankiewicz@docker.com>
2025-03-24 19:14:24 -04:00
Jean-Francois Simoneau
65ce51aed7
Fix start_time shadow variable (#2114) 2025-03-18 19:17:47 -04:00
yhirose
787a34ad7f Release v0.20.0 2025-03-16 21:24:53 -04:00
yhirose
7a212cfe40 clang-format 2025-03-16 21:22:53 -04:00
yhirose
87a5ae64a4 Fix #2097 2025-03-16 20:57:17 -04:00
yhirose
33acccb346 Fix #2109 2025-03-16 20:36:15 -04:00
davidalo
c765584e6b
Add zstd support (#2088)
* Add zstd support

* Add zstd to CI tests

* Use use zstd cmake target instead of ZSTD. Use cmake variable for found packages

* Add missing comment for HTTPLIB_REQUIRE_ZSTD

* Fix test.yaml rebase error

* Use zstd::libzstd target

* Add include and library paths to ZSTD args

* Run clang-format

* Add zstd to httplibConfig.cmake.in
2025-03-16 15:51:53 -04:00
Florian Albrechtskirchinger
2eaa2ea64f
Make random_string() thread-safe (#2110)
By making the random engine thread_local, each thread now has its own
independent random sequence, ensuring safe concurrent access.
Additionally, using an immediately invoked lambda expression to
initialize the engine eliminates the need for separate static seed
variables.
2025-03-13 12:44:43 -04:00
Florian Albrechtskirchinger
a8d6172250
Avoid static std::string (#2103)
Replace static std::string objects with constexpr character arrays and
use compile-time string length calculations.
2025-03-12 12:12:54 -04:00
Florian Albrechtskirchinger
2f39723d08
Wrap poll()/WSAPoll() in a function and build compiled library on Windows (#2107)
* Wrap poll()/WSAPoll() in a function

Instead of using a macro for poll() on Windows, which breaks when the
implementation is compiled separately, add a detail::poll_wrapper()
function that dispatches to either ::poll() or ::WSAPoll().

* Build compiled library on Windows
2025-03-12 12:12:03 -04:00
Florian Albrechtskirchinger
a9ba0a4dff
Remove SSLInit (#2102)
Quote: "As of version 1.1.0 OpenSSL will automatically allocate all
resources that it needs so no explicit initialisation is required."
2025-03-12 12:10:02 -04:00
yhirose
48084d55f2 Fix #2096 2025-03-10 23:31:51 -04:00
Florian Albrechtskirchinger
85b5cdd78d
Move detail::read_file() to test/test.cc (#2092)
The unit test code is the only user of the function.

read_file() now throws an exception if the file isn't found.
2025-03-06 11:58:55 -05:00
yhirose
71ba7e7b1b
Fix #2068 (#2080)
* Fix #2068

* Add unit test
2025-02-20 23:45:21 -05:00
Florian Albrechtskirchinger
22d90c29b4
Remove select() and use poll() (#2078)
* Revert "Fix typo in meson.build (#2070)"

This reverts commit 5c0135fa5d7e059f5dd4c3a1a8a2d767d30ac491.

* Revert "build(meson): automatically use poll or select as needed (#2067)"

This reverts commit 2b5d1eea8d7e9f881ac4be04ce31df782b26b6a9.

* Revert "Make poll() the default (#2065)"

This reverts commit 6e73a63153e936e753211a5608acf336fb848a37.

* Remove select() and use poll()
2025-02-20 18:51:35 -05:00
Florian Albrechtskirchinger
550f728165
Refactor streams: rename is_* to wait_* for clarity (#2069)
- Replace is_readable() with wait_readable() and is_writable() with
  wait_writable() in the Stream interface.
- Implement a new is_readable() function with semantics that more
  closely reflect its name. It returns immediately whether data is
  available for reading, without waiting.
- Update call sites of is_writable(), removing redundant checks.
2025-02-20 12:56:39 -05:00
yhirose
ada97046a2 Fix misspelled words 2025-02-18 05:54:22 -05:00
Florian Albrechtskirchinger
6e73a63153
Make poll() the default (#2065)
* Make poll() the default

select() can still be enabled by defining CPPHTTPLIB_USE_SELECT.

* Run tests with select() and poll()
2025-02-18 05:23:23 -05:00
Uros Gaber
cdc223019a
server_certificate_verifier extended to reuse built-in verifier (#2064)
* server_certificate_verifier extended to reuse built-in verifier

* code cleanup and SSLVerifierResponse enum clarification as per @falbrechtskirchinger comment

* cleanup

* clang-format

* change local var verification_status_ declaration to auto

* change local var verification_status_ to verification_status

* clang-format

* clang-format

---------

Co-authored-by: UrosG <uros@ub330.net>
2025-02-17 17:24:41 -05:00
Florian Albrechtskirchinger
2996cecee0
Fix code inconsistently formatted and re-format (#2063)
* Fix code inconsistently formatted by clang-format

* Run clang-format
2025-02-17 12:14:02 -05:00
Florian Albrechtskirchinger
32bf5c9c09
Simplify SSL shutdown (#2059) 2025-02-16 17:38:41 -05:00
Florian Albrechtskirchinger
985cd9f6a2
Fix compilation failures with include <windows.h> (#2057) 2025-02-16 08:39:29 -05:00
Florian Albrechtskirchinger
233f0fb1b8
Refactor setting socket options (#2053)
Add detail::set_socket_opt() and detail::set_socket_opt_time() to avoid
repetition of platform-specific code.
2025-02-14 22:40:24 -05:00
yhirose
03cf43ebaa
Release v0.19.0 2025-02-14 14:42:29 -05:00
Brett Profitt
a268d65c4f
Fix check for URI length to prevent incorrect HTTP 414 errors (#2046) 2025-02-10 21:46:38 -05:00
Florian Albrechtskirchinger
b397c768e4
Unify select_read() and select_write() (#2047) 2025-02-10 18:15:19 -05:00
yhirose
8e22a7676a Remome 'global timeout' to 'max timeout' 2025-02-10 18:07:30 -05:00
yhirose
8a7c536ad5
Fix #2034 (#2048)
* Fix #2034

* Fix build error

* Adjust threshold

* Add temporary debug prints

* Adjust threshhold

* Another threshold adjustment for macOS on GitHub Actions CI...

* Performance improvement by avoiding unnecessary chrono access

* More performance improvement to avoid unnecessary chrono access
2025-02-10 06:51:07 -05:00
yhirose
5814e121df Release v0.18.7 2025-02-08 15:53:35 -05:00
Florian Albrechtskirchinger
7adbccbaf7
Refine when content is expected (#2044)
Consider Content-Length and Transfer-Encoding headers when determining
whether to expect content. Don't handle the HTTP/2 connection preface
pseudo-method PRI.

Fixes #2028.
2025-02-08 15:51:52 -05:00
yhirose
eb30f15363 Release v0.18.6 2025-02-05 19:14:20 -05:00
yhirose
4941d5b56b
Fix #2033 (#2039) 2025-02-05 12:46:33 -05:00
Florian Albrechtskirchinger
9bbb4741b4
Run clang-format (#2037) 2025-02-02 22:32:33 -05:00
alex-cornford
60a1f00618
Support building httplib.h on OpenVMS x86 systems (#2031)
Modify for OpenVMS x86 C++. Make tests on OpenVMS currently not supported due to no cmake support.
Changes tested on OpenVMS clang C++ and Fedora & GCC
2025-01-28 18:44:22 -05:00
Baiyies
d69f144a99
Update httplib.h (#2030)
fix 'max'
2025-01-26 08:50:10 -05:00
yhirose
929dfbd348 Update copyright year 2025-01-20 00:32:10 -05:00
yhirose
3779800322 Release v0.18.5 2025-01-17 17:38:03 -05:00
yhirose
986a20fb7d
Resolve #2017 (#2022)
* Resolve #2017

* Fix warning

* Update README
2025-01-17 17:37:07 -05:00
yhirose
8311e1105f Fix Windows build problem 2025-01-16 23:26:04 -05:00
yhirose
ba6845925d Fix #2014 2025-01-16 23:10:58 -05:00
yhirose
343a0fc073 Fix #2011 2025-01-16 21:38:45 -05:00
yhirose
54f8a4d0f3 Release v0.18.4 2025-01-16 01:00:25 -05:00
yhirose
9c36aae4b7 Fix HTTP Response Splitting Vulnerability 2025-01-16 00:04:33 -05:00
yhirose
b766025a83 clangformat 2025-01-16 00:03:10 -05:00
sinnren
d647f484a4
fix:set_file_content with range request return 416. (#2010)
Co-authored-by: fenlog <bakurise@qq.com>
2024-12-24 09:38:59 -05:00
Sergey Bobrenok
8794792baa
Treat out-of-range last_pos as the end of the content (#2009)
RFC-9110 '14.1.2. Byte Ranges':
A client can limit the number of bytes requested without knowing the
size of the selected representation. If the last-pos value is absent,
or if the value is greater than or equal to the current length of the
representation data, the byte range is interpreted as the remainder of
the representation (i.e., the server replaces the value of last-pos
with a value that is one less than the current length of the selected
representation).

https://www.rfc-editor.org/rfc/rfc9110.html#section-14.1.2-6
2024-12-23 13:14:36 -05:00