Gopinath K
656e936f49
add multipart formdata for PUT requests. ( #1351 )
...
* httplib.h
add multipart formdata for PUT in addition to POST as some REST
APIs use that.
Factor the boundary checking code into a helper and use it from
both Post() and Put().
* test/test.cc
add test cases for the above.
2022-08-04 20:42:13 -04:00
yhirose
d92c314466
Release v0.11.1
2022-08-02 19:44:25 -04:00
Changbin Park
362d064afa
UNIX domain socket support ( #1346 )
...
* Add support UNIX domain socket
* `set_address_family(AF_UNIX)` is required
* add unittest for UNIX domain socket
* add support UNIX domain socket with abstract address
Abstract address of AF_UNIX begins with null(0x00) which can't be
delivered via .c_str() method.
* add unittest for UNIX domain socket with abstract address
Co-authored-by: Changbin Park <changbin.park@ahnlab.com>
2022-08-01 06:57:25 -04:00
Rockybilly
0b541ffebc
Add get_socket_fd method to Client and ClientImpl, add according unit… ( #1341 )
...
* Add get_socket_fd method to Client and ClientImpl, add according unit test
* Change name get_socket_fd to get_socket
* Change name get_socket to socket
Co-authored-by: ata.yardimci <ata.yardimci@erstream.com>
2022-07-31 08:27:38 -04:00
yhirose
106be19c3e
Issue 49512: cpp-httplib:server_fuzzer: Timeout in server_fuzzer
2022-07-30 23:27:29 -04:00
yhirose
25d72bf881
Release v0.11.0
2022-07-29 20:45:55 -04:00
Mehmet İbrahimoğlu
9d5b5297cc
ssize_t redefinition on Windows - int/int64 vs long/long long ( #1337 )
...
* ssize_t redefinition on Windows - int/int64 vs long/long long
* Define ssize_t as __int64 for _WIN64, not long long
Co-authored-by: iamttaM <9880090+oculusbytes@users.noreply.github.com>
2022-07-29 20:42:31 -04:00
Mehmet İbrahimoğlu
462884bebb
With SSL enabled and NOMINMAX not defined, there is a conflict with 'max', which this fixes ( #1334 )
...
Co-authored-by: iamttaM <9880090+oculusbytes@users.noreply.github.com>
2022-07-27 08:16:06 -04:00
yhirose
f0eb55b327
Changed to use const std::string & as much as possible instead of const char * ( #1331 )
...
* Changed to use `const std::string &` as much as possible instead of `const char *`
* Fix problems on Windows
2022-07-22 22:44:33 -04:00
yhirose
916b2a8fd3
Merge branch 'use_exception_ptr' of https://github.com/kuguma/cpp-httplib into kuguma-use_exception_ptr
2022-07-15 17:19:39 -04:00
yhirose
37bb3c6a77
No longer support VS 2013 and older #1325 ( #1326 )
...
* Fixed a warning
* No longer support VS 2013 and older (Fix #1325 )
2022-07-14 20:57:41 -04:00
Kai Aoki
d4ab2fa0e6
fix double ref and case of exceptions that are not std::exception
2022-07-15 01:45:10 +09:00
Kai Aoki
72d3f4896a
Update httplib.h
...
use std::exception_ptr
2022-07-12 00:10:57 +09:00
yhirose
5e6f973b99
Release v0.10.9
2022-07-08 17:40:05 -04:00
yhirose
127a64d5a0
Skip preamble and epilogue in multipart/form-data ( Fix #1317 ) ( #1320 )
...
* fix: skip MIME preamble (#1317 )
* Skip epilogue in multipart/form-data
Co-authored-by: Gavin1937 <71205842+Gavin1937@users.noreply.github.com>
2022-07-08 17:26:50 -04:00
yhirose
caa31aafda
Accept large data transfer over SSL ( Fix #1261 , Close #1312 )
2022-07-02 07:50:33 -04:00
yhirose
dae318495f
Revert "Accept large data transfer over SSL ( #1261 )"
...
This reverts commit 307b729549 .
2022-07-02 07:18:59 -04:00
Andrea Pappacoda
305a7abcb9
fix: update CPPHTTPLIB_VERSION to 0.10.8 ( #1305 )
2022-06-08 16:44:10 -04:00
yhirose
219d13b718
Fix #1303
2022-06-07 09:52:08 -04:00
conghuawang
df20c27696
resolve http server can't send file large than 2GB ( Fix #1290 ) ( #1294 )
...
* resolve problem: http server can't send file large than 2GB.
add unit test for http server send large file.
add /bigobj compile option to msvc x64.
* disable unit test "ServerLargeContentTest" due to out-of-memory on GitHub Actions.
2022-05-27 11:56:20 -04:00
yhirose
a5a62768c0
Fix #1292 ( #1296 )
2022-05-27 11:54:43 -04:00
yhirose
4001637beb
Added CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH
2022-05-26 10:16:32 -04:00
Martín Córdova
47044c05a8
Fix compile error with MINGW-64 GCC-12.1.0 ( #1283 )
2022-05-24 07:16:54 -04:00
yhirose
9452c0a4b6
Release v0.10.7
2022-04-28 10:21:14 -04:00
Yoshiki Matsuda
307b729549
Accept large data transfer over SSL ( #1261 )
...
* Add large data transfer test
* Replace `SSL_read` and `SSL_write` with `ex` functions
* Reflect review comment
* Fix return value of `SSLSocketStream::read/write`
* Fix return value in the case of `SSL_ERROR_ZERO_RETURN`
* Disable `LargeDataTransfer` test due to OoM in CI
2022-04-27 21:08:39 -04:00
mylogin
696239d6e1
Link Windows crypto libs only when CPPHTTPLIB_OPENSSL_SUPPORT is set ( #1254 )
2022-04-20 22:04:55 -04:00
yhirose
d87abeecf0
Release v0.10.6
2022-04-17 17:34:48 -04:00
yhirose
4e28e4f741
Fix #1251
2022-04-17 11:53:41 -04:00
yhirose
d05c343602
Release v0.10.5
2022-04-16 21:02:30 -04:00
yhirose
33f67386fe
Fix #1249
2022-04-16 08:54:56 -04:00
yhirose
56d8168dc4
clangformat
2022-04-16 08:52:55 -04:00
greenfish
5d87cc0558
resolve compiler warnings ( #1246 )
...
* resolve compiler warnings
- check `WSAStartup` return.
- `const` is not suitable for `std::move`.
* resolve compiler warnings
- bool startup => bool is_valid_.
- remove `const` not removed.
2022-04-14 11:46:10 -04:00
yhirose
cb41947eb4
Fix #1235 ( #1243 )
...
* Fix #1235
* fix BindIPAddress error (#1242 )
* Code cleanup
* Added a unit test
* Commented out 'SSLClientTest.SetInterfaceWithINET6'
* Fixed incorrect return value from if2ip
* Removed if_nametoindex call
Co-authored-by: Kotarou <2918558+CyberKoo@users.noreply.github.com>
2022-04-13 21:32:46 -04:00
Kotarou
0857eba17b
replace deprecated OpenSSL functions with evp functions ( #1241 )
2022-04-11 13:40:58 -04:00
Andrea Pappacoda
bf0760fde4
fix: update user agent ( #1218 )
2022-03-18 18:12:51 -04:00
yhirose
a1df576e4f
Fix #1212
2022-03-16 22:00:40 -04:00
yhirose
7fb0254794
Fix #1215
2022-03-16 12:50:13 -04:00
yhirose
c82d1e52cc
Fix #1214
2022-03-16 10:56:33 -04:00
yhirose
e12fe4cbbb
Performance improvement
2022-02-27 14:30:49 -05:00
Sebastien Blanchet
8191fd8e6c
Add optional private key password to SSLServer ctor ( #1205 )
2022-02-27 14:16:15 -05:00
yhirose
d73395e1dc
Release v0.10.3
2022-02-22 10:21:27 -05:00
au-ee
64d001162b
CPPHTTPLIB_NO_DEFAULT_USER_AGENT skips default user agent ( #1201 )
2022-02-22 09:39:26 -05:00
yhirose
bb00a23116
Apply clangformat
2022-02-09 17:16:47 -05:00
Rockybilly
7f43f0f3ff
User-Agent update cpp-httplib/0.10.2 ( #1181 )
2022-01-28 12:27:27 -05:00
Gregor Jasny
87e03dd1ce
Report connection timeout as separate event ( #1171 )
2022-01-26 17:32:40 -05:00
yhirose
e5cacb465d
Fix #1172 ( #1173 )
...
This change is based on RFC7230, § 3.5 'Message Parsing Robustness': "Although the line terminator for the start-line and header fields is the sequence CRLF, a recipient MAY recognize a single LF as a line terminator and ignore any preceding CR."
2022-01-26 13:34:23 -05:00
yhirose
b61f36579c
Fix #1166
2022-01-20 15:24:09 -05:00
yhirose
65a8f4cf44
Added hosted_at. ( Resolve #1113 )
2021-12-31 15:35:52 -05:00
yhirose
27d128bbb4
Fix problems in #1154
2021-12-31 14:55:40 -05:00
yhirose
070f9bec58
Code cleanup
2021-12-31 13:27:47 -05:00
c00c
f817032513
fix socket option setting for windows ( #1154 )
...
* fix socket option setting for windows
* misc
Co-authored-by: zhangsen <zhangsen@cyberkl.com>
2021-12-31 10:07:59 -05:00
yhirose
17abe221c0
Fix is_file problem on Windows ( #1153 )
2021-12-30 14:54:57 -05:00
vitaly-ivanov
4a7a81e039
Work around silly Win defines to support BoringSSL ( #1148 )
...
* Work around silly Win defines to support BoringSSL
* changes wrapped into ifdef(_WIN32) just in case
2021-12-30 11:08:51 -05:00
yhirose
37fd4eb643
Code cleanup
2021-12-26 07:53:56 -05:00
yhirose
865b0e4c03
Resolve #1145
2021-12-26 07:53:06 -05:00
yhirose
b324921c1a
Release v0.10.1
2021-12-24 21:01:06 -05:00
yhirose
63f72caf30
Fix "Issue 42689 in oss-fuzz: cpp-httplib:server_fuzzer: Timeout in server_fuzzer"
2021-12-24 20:58:09 -05:00
yhirose
99ac17b90a
Fix #1140
2021-12-23 23:19:14 -05:00
yhirose
4b0ed9ee88
Release v0.10.0
2021-12-21 18:15:41 -05:00
yhirose
3b35279b16
Added SSLServer::ssl_context()
2021-12-18 00:21:41 -05:00
yhirose
27deb44df5
Update SSL related code
2021-12-18 00:15:38 -05:00
yhirose
24a3ef949b
Performance improvement for multipart form data file upload.
2021-12-18 00:15:10 -05:00
yhirose
793ae9855e
Fix #1041 ( #1132 )
...
* Fix #1041
* Fixed problem with is_socket_alive
* Adjust the way to check if the sockt is still alive.
* Revert "Adjust the way to check if the sockt is still alive."
This reverts commit 6c673b21e5 .
* Adjust is_socket_alive according to the code review
2021-12-16 21:06:17 -05:00
yhirose
cec6288a99
Resolve #1131
2021-12-14 07:58:21 -05:00
yhirose
9639578c2a
Release v0.9.10
2021-12-11 19:26:22 -05:00
yhirose
743ecbd365
Issue1121 ( #1122 )
...
* Fixed test/Makefile problem when cleaning *.pem files
* Fix #1121
2021-12-11 19:07:12 -05:00
yhirose
ddff782133
Release v0.9.9
2021-11-26 20:46:38 -05:00
yhirose
3051152103
Fix #1102 ( #1108 )
2021-11-26 20:44:58 -05:00
yhirose
06026bb47d
Code formating
2021-11-23 10:53:05 -05:00
yhirose
226388ae27
Resolve #1100
2021-11-23 10:47:30 -05:00
Scott Graham
ea7548b4cc
Remove stray ; causing warning with -Wextra-semi ( #1099 )
2021-11-22 07:16:07 -05:00
Rodolphe
c7486ead96
accept protobuf encoding ( #1096 )
...
Co-authored-by: rodolphe <rodolphe@zen.ly>
2021-11-17 13:14:31 -05:00
yhirose
ec56dfa35e
Fix #1085 ( #1091 )
2021-11-15 14:37:10 -05:00
zhenyolka
4f8fcdbaf7
Allow to specify server IP address ( #1067 )
...
* Allow to specify server IP address
* Reimplement in set_hostname_addr_map
* Add tests for set_hostname_addr_map
* Fix tests after implement set_hostname_addr_map
* SpecifyServerIPAddressTest.RealHostname typo
2021-10-16 15:05:55 -04:00
CarlosLeeGit
b80aa7fee3
support custom ssl ctx configuration for SSLServer ( #1073 )
2021-10-15 07:13:16 -04:00
yhirose
d17ac3bb40
Fix "Issue 39922 in oss-fuzz: cpp-httplib:server_fuzzer: Timeout in server_fuzzer"
2021-10-14 08:55:29 -04:00
yhirose
c7554ccac2
Fix #1069 ( #1070 )
2021-10-09 20:35:58 -04:00
estshorter
3da42fd1e8
Avoid min/max macro expansion on Windows ( #1057 )
2021-09-25 08:53:15 -04:00
yhirose
503aa61325
Fix problem with an empty parameter in set_base_dir
2021-09-20 17:40:05 -04:00
Zizheng Tai
e1efa337a2
Make Client move-constructible ( #1051 )
2021-09-16 14:05:42 -04:00
yhirose
3c522386e9
Fix "Issue 38551 in oss-fuzz: cpp-httplib:server_fuzzer: Timeout in server_fuzze"
2021-09-12 19:24:48 -04:00
yhirose
c202aa9ce9
Read buffer support. ( Fix #1023 ) ( #1046 )
2021-09-12 00:26:02 -04:00
yhirose
4e05368086
Fix #1054
2021-09-11 14:13:49 -04:00
yhirose
e1afe74fe2
Fix #1037
2021-09-10 22:42:14 -04:00
Gregor Jasny
415edc237c
Set error variable for failed write_data ( #1036 )
2021-09-05 16:15:46 -04:00
yhirose
ab477b5631
Fix "Issue 37742 in oss-fuzz: cpp-httplib:server_fuzzer: Timeout in server_fuzzer"
2021-09-02 22:57:57 -04:00
yhirose
0823d5c7f2
Fixed #1031
2021-08-30 17:16:31 -04:00
yhirose
4297500928
Fix #1024
2021-08-17 09:28:17 -04:00
Thomas Behn
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
Joel Rosdahl
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
Joel Rosdahl
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
yosh-matsuda
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
xxrl
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
Gregor Jasny
ea2f69a0d7
Add httplib::Error to std::string function ( #999 )
...
Fixes : #978
2021-07-19 21:17:44 -04:00
yhirose
e3750d9ddf
Simplefied server APIs
2021-07-17 18:09:30 -04:00
yhirose
c1eee3012e
Fix #998
2021-07-17 17:18:56 -04:00
yhirose
06bfa7e08b
Fix #979
2021-07-14 22:49:49 -04:00
yhirose
3d83cbb872
Improve string compare performance
2021-07-12 23:51:56 -04:00
yhirose
8a803b30f6
Fix #990
2021-07-12 23:46:25 -04:00
yhirose
80be649de7
Fix #961
2021-06-26 18:26:33 -04:00
Gregor Jasny
6b9ffc8bec
Remove dead code ( #965 )
2021-06-18 07:20:34 -04:00
Simon Edlund
d903053faf
Update httplib.h ( #964 )
...
operator""_ replaced by operator""_t
2021-06-17 10:57:25 -04:00
yhirose
676f1b5a26
Updated the user agent string
2021-06-14 08:43:12 -04:00
Baruch Nissenbaum
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
yhirose
fc9b223acc
Updated copyright year
2021-06-11 14:45:35 -04:00
CncGpp
ba824089d7
Fix code err code 401 when the password is empty in base_auth. ( #958 )
2021-06-11 14:39:33 -04:00
yhirose
5a43bb8149
Implemented #946 in a different way
2021-06-02 13:45:47 -04:00
yhirose
0104614656
Code refactoring
2021-06-02 08:11:31 -04:00
yhirose
77a77f6d2d
Added set_default_headers on Server
2021-05-23 19:06:28 -04:00
Mathias Laurin
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.
2021-05-22 20:15:20 -04:00
yhirose
ba34ea4ee8
Fix #944
2021-05-22 19:24:50 -04:00
Baruch Nissenbaum
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
yhirose
75fdb06696
Added a missing member in copy_settings.
2021-05-15 09:14:44 -04:00
Alex Hornung
e00ad37580
Add option to bypass URL encode of path ( #934 )
2021-05-15 08:48:25 -04:00
Vincent Stumpf
5cfb70c2b4
Fix some shadowed variable warnings ( #935 )
2021-05-15 08:46:16 -04:00
Alessio Pollero
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
Aswin Raj Kharel
c58b00580e
reserving before encoding ( #912 )
2021-04-24 16:19:14 -04:00
Ken Schalk
7c60e69c33
Remove redunant call to close_socket ( #911 )
2021-04-23 17:07:19 -04:00
yhirose
73e0729f63
Change sink.write() to return boolean
2021-04-22 07:14:08 -04:00
yhirose
21c529229c
Fixed timeout issues
2021-04-22 07:14:08 -04:00
yhirose
63643e6386
Code format
2021-04-13 20:52:49 -04:00
yhirose
6cc2edce99
Added set_address_family
2021-04-13 20:49:52 -04:00
yhirose
d122ff3ca8
Code formatting
2021-04-13 12:38:45 -04:00
James Young
14c6d526b4
Use newer version-flexible TLS/SSL method ( #904 )
2021-04-13 09:11:38 -04:00
Philipp Hasper
28e07bca16
Fixed minor code smells ( #901 )
2021-04-09 14:55:21 -04:00
yhirose
faa5f1d802
Additional changes for #889
2021-04-05 16:13:41 -04:00
yhirose
9d3365df54
Fix #889
2021-04-05 11:40:53 -04:00
yhirose
6ff84d34d1
Another simpler implementation of #890 ( #891 )
2021-04-02 18:25:04 -04:00
yhirose
b845425cd0
Fix #878
2021-03-16 19:42:44 -04:00
yhirose
89519c88e2
Fix #874
2021-03-10 15:57:56 -05:00
yhirose
ff813bf99d
Fix #863
2021-02-17 15:36:56 -05:00
yhirose
cf475bcb50
Fix #860
2021-02-12 12:21:43 -05:00
yhirose
b7566f6961
Resolve #852
2021-02-02 22:09:35 -05:00
Nikolas
0542fdb8e4
Add exception handler ( #845 )
...
* Add exception handler
* revert content reader changes
* Add test for and fix exception handler
* Fix warning in test
* Readd exception test, improve readme note, don't rethrow errors, remove exception handler response
2021-01-28 17:19:11 -05:00
yhirose
88411a1f52
Fix #846
2021-01-27 14:35:32 +00:00
yhirose
68d1281759
Resolve #839
2021-01-23 13:33:27 -05:00
yhirose
0308d60cb2
Resolve #831 ( #835 )
2021-01-23 12:23:06 -05:00
yhirose
59f5fdbb33
Resolve #840
2021-01-23 11:43:01 -05:00
Anonymous
13184f5f80
Return Server& from handler setters ( #836 )
...
* Update httplib.h
* Update httplib.h
* Update httplib.h
* Update httplib.h
2021-01-22 09:20:21 -05:00
Eric Lee
8d9a477edb
No content check ( #823 )
...
* No content check
* unit test for no content
* fixing merge conflict break
* oops during manual merge conflict
2021-01-13 17:51:40 -05:00
yhirose
f008fe4539
Added middleware support ( #816 )
2021-01-07 18:40:52 -05:00
yhirose
ddf41d29ef
Added const *char and size_t interface
2021-01-06 22:39:58 -05:00
yhirose
3f88a46c4a
Code format
2020-12-31 18:14:28 -05:00
yhirose
242706ea34
Fix #820
2020-12-31 18:14:05 -05:00
yhirose
a9f5f8683f
Fixed warnings on Visual C++
2020-12-31 11:35:11 -05:00
yhirose
60c2213893
Fix #817
2020-12-31 10:58:44 -05:00
yhirose
eb2d28bca2
Code cleanup
2020-12-31 10:37:06 -05:00
yhirose
2c07ec4600
Code cleanup
2020-12-29 09:39:19 -05:00
yhirose
871d8d67b0
Made Request paramater const in handle_file_request
2020-12-28 22:03:44 -05:00
yhirose
e9c6c6e609
Code format
2020-12-19 20:14:53 -05:00
yhirose
40db42108f
Fixed problem with invalid requests including spaces in URL path
2020-12-19 12:03:08 -05:00
Jeremie Rahm
d0bd4afb0b
Ensure socket is closed after processing in SSLServer ( #804 )
2020-12-18 19:29:36 -05:00
Yuri Santos
78ea786abd
[PR] Special function to encode query params ( #801 )
...
* Special function to encode query params
* Fix #include <iomanip>
* Added unescaped charsets to encode_query_param
* Unit tests for encode_query_param
2020-12-18 17:51:11 -05:00
Anonymous
0cff3245df
Extend built-in extension MIME mapping ( #799 )
...
* Update README.md
* Update httplib.h
* Update httplib.h
* Update httplib.h
* Update httplib.h
* Remove duplicate cases
Someone left a bunch of duplicate cases, idiot, couldn't have been me.
* Reformat
Modify spacing and whatnot
* Update README.md
2020-12-18 09:32:19 -05:00
yhirose
0e3925db3f
Fixed build error
2020-12-18 00:07:48 +00:00
yhirose
c9a13d214b
Changed not to use string_view
2020-12-17 18:48:27 -05:00
yhirose
0954af2d4c
Use user-defined literals for file extention match
2020-12-17 18:27:04 -05:00
yhirose
7c1c952f5a
Don't allow invalid status code format (It sould be a three-digit code.)
2020-12-15 20:25:24 -05:00
yhirose
c1264bfedc
Fix problem with mp4 w/ Range header
2020-12-14 22:41:05 -05:00
yhirose
eb240ad2e5
Code cleanup
2020-12-03 16:03:12 -05:00
yhirose
88c961f37e
Removed std::atomic<Error> error_
2020-12-01 15:17:34 +00:00
yhirose
5dd605d3a2
Fix #762
2020-11-30 21:49:31 -05:00
yhirose
615867322d
Fixed build errors and apply clangformat
2020-11-29 12:29:18 -05:00
David Wu
02d3cd5909
Fix multiple threading bugs including #699 and #697
2020-11-29 12:29:15 -05:00
yhirose
a5c239c174
Fix #765
2020-11-21 16:35:31 -05:00
yhirose
c2afc5ca44
Added chunked content provider support on client
2020-11-21 08:46:50 -05:00
Unkorunk
b21dc8cbe0
Fix incorrect content_encoding for Brotli ( #763 )
2020-11-19 12:39:20 -05:00
372046933
e1133a2dcb
std::tolower is undefined if the argument's value is neither representable as unsigned char nor equal to EOF ( #761 )
...
Co-authored-by: taoxu <taoxu@bilibili.com>
2020-11-19 09:21:40 -05:00
yhirose
95d0b073bd
Fix #754
2020-11-15 08:13:08 -05:00
vawen
9c7d841b37
Fix : #746 Compile error under VS2015 ( #747 )
...
Co-authored-by: jigarcia@vaxtor.es <jigarcia@vaxtor.es>
2020-11-10 08:41:53 -05:00
yhirose
f086bf5310
Fix #738
2020-11-08 18:16:23 -05:00
yhirose
6adf130bf3
Fix #739
2020-11-07 21:54:47 -05:00
yhirose
eb4b7c70a9
Fix #737
2020-11-07 09:33:22 -05:00
yhirose
84661ea6ed
Refactoring
2020-11-05 07:06:53 -05:00
yhirose
041122908c
Fix problem with invalid range
2020-11-05 00:20:59 -05:00
yhirose
726c64cf10
Code format
2020-11-05 00:20:59 -05:00
Omkar Jadhav
72b81badad
Fix issues reported by oss-fuzz ( #729 )
...
* Fix oss-fuzz issue #26529
* Add test for oss-fuzz issue #26598
* Fix oss-fuzz issue #26632
* Revert change and add new test cases
2020-11-03 11:36:02 -05:00
Daniel Ottiger
6e1879dfae
ssl-verify-host: fix verifying ip addresses containing zero's ( #732 )
...
* ssl-verify-host: fix verifying ip addresses containing zero's
If the subject alternate name contained an ip address with an zero
(like 10.42.0.1) it could not successfully verify.
It is because in c++ strings are null-terminated
and therefore strlen(name) would return a wrong result.
As I can not see why we can not trust the length returned by openssl,
lets drop this check.
* ssl-verify-host: add test case
lets try to validate against 127.0.0.1
Co-authored-by: Daniel Ottiger <daniel.ottiger@ch.schindler.com>
2020-11-02 20:27:34 -05:00
miketsts
eb1d2e04bc
SSL_connect and SSL_accept in non-blocking mode ( #728 )
...
SSL connection is performed in two steps:
First, a regular socket connection is established.
Then, SSL_connect/SSL_accept is called to establish SSL handshake.
If a network problem occurs during the second stage, SSL_connect on
the client may hang indefinitely.
The non-blocking mode solves this problem.
Co-authored-by: Michael Tseitlin <michael.tseitlin@concertio.com>
2020-11-02 17:05:08 -05:00
yhirose
c909ffa758
Fix #731
2020-11-01 21:03:47 -05:00
yhirose
8b1b31ac20
Fix #723
2020-10-27 20:32:19 -04:00
yhirose
953600c177
Fixed compiler error for old compiler.
2020-10-27 12:23:37 -04:00
yhirose
536e7eb7f2
Revert "Fix #697 ". (It broke unit test...)
...
This reverts commit 6d66721ba1 .
2020-10-25 20:22:39 -04:00
yhirose
6d66721ba1
Fix #697
2020-10-25 16:55:54 -04:00
yhirose
3b29cd0bdc
Fix #698
2020-10-25 12:14:54 -04:00
yhirose
109b624dfe
Fix #708 ( #713 )
...
* Fix #708
* Rename ContentReceiver2 to ContentReceiverWithProgress
2020-10-22 11:48:43 -04:00
yhirose
a50b7591ca
Fix #714
2020-10-21 13:02:33 -04:00
yhirose
bf8fc11b53
Code cleanup
2020-10-20 21:24:47 -04:00
Omkar Jadhav
bc4a613b6d
Fix suffix-byte-range issue ( #711 )
2020-10-20 11:11:27 -04:00
yhirose
4bb001351c
Fix #705
2020-10-19 22:13:24 -04:00
yhirose
e155ba44bb
Fix #706
2020-10-19 15:23:35 -04:00
Muchamad Arifin Dwi P
a4a9637738
Fix #700 null pointer exception ( #702 )
2020-10-16 20:44:14 -04:00
Snape3058
cc5147ad72
Replace shared_ptr with unique_ptr for better performance ( #695 )
...
* Backport std::make_unique from C++14.
* Replace shared_ptr with unique_ptr for better performance.
Co-authored-by: Ella <maxutong16@otcaix.iscas.ac.cn>
2020-10-15 08:09:11 -04:00
Andrew Gasparovic
fffbf1a669
Use move semantics instead of copy for functions ( #692 )
...
* Use move semantics instead of copy for functions
In some cases, a few more copies could be prevented by changing function definitions to accept parameters by const-ref, rather than by value, but I didn't want to change public signatures.
* Fix two use-after-move errors
2020-10-11 19:00:36 -04:00
lightvector
d37bc0fb4d
Allow client to specify boundary and use more entropy by default ( #691 ) ( #694 )
2020-10-11 15:34:54 -04:00
Andrew Gasparovic
6d60dc8839
Add cache_control parameter to set_mount_point ( #688 )
...
* Add `cache_control` parameter to `set_mount_point`
Specifies the Cache-Control header value to return when specified. For example:
```
svr.set_mount_point("/assets", "public/assets", "public, max-age=604800, immutable");
```
* Add default for cache_control
Default to "no-cache", which is implicitly what is happening today.
* Change set_mount_point to accept Headers
* Don't use C++17 destructuring
2020-10-10 20:46:08 -04:00
Wang Gao
b713a3a651
fix MSVC2015 error: std::tolower to ::lower ( #689 )
2020-10-10 12:02:50 -04:00
yhirose
09fdf4eacd
Fix #685
2020-10-08 21:37:42 -04:00
Omkar Jadhav
143b2dd15a
Fix memory leak due caused due to X509_STORE ( #671 )
...
* Fix memory leak due caused due to X509_STORE
* Add test for repro and address sanitizer to compiler flags
* Add comment
* Sync
* Associate ca_store with ssl context within set_ca_cert_store()
* Split SlowPost test
* Fix #674
Co-authored-by: yhirose <yuji.hirose.bug@gmail.com>
2020-10-02 13:17:37 -04:00
yhirose
e2c4e9d95c
Fix #674
2020-09-29 19:22:28 -04:00
yhirose
cc14855ba0
Fix #661
2020-09-26 04:50:09 -04:00
yhirose
56c418745f
Fixed conction close problem with HTTP 1.0 client
2020-09-25 20:58:49 -04:00
yhirose
4ce9911837
Add <sstream>
2020-09-25 18:17:32 -04:00
yhirose
a2f4e29a7b
Add set_keep_alive_timeout
2020-09-25 17:57:33 -04:00
mi01
b8cf739d27
Add cctype header ( #656 )
2020-09-16 16:32:49 -04:00
yhirose
7b55ecdc59
Fixed #650
2020-09-12 16:11:14 -04:00
tmahring
e9575bcb78
don't replace plus with space in headers ( #649 )
...
* don't replace plus with space in headers
* fixed forward handling with changed header parsing
* add test for boundaries containing plus chars
2020-09-10 20:27:01 -04:00
Jonas Minnberg
308aeb187b
Undefined if2ip() also on Android since getifaddrs() does not exist. ( #648 )
...
Co-authored-by: Jonas Minnberg <jonas@minnberg.se>
2020-09-10 07:52:01 -04:00
Ivan Fefer
3da4a0ac69
Add compression buffer size customization ( #644 )
...
* add compression buffer size customization and small brotli refactor
* allocat brotli buffer once
* add init to brotli decoder buffer
2020-09-08 12:18:14 -04:00
yhirose
9d12b3f20e
Fixed warnings and refactoring
2020-09-03 20:33:30 -04:00
Omkar Jadhav
852a374748
Fix server crash caused due to regex complexity while matching headers. ( #632 )
...
* Fix parsing to parse query string with single space char.
When passed ' ' as a query string, the server crashes cause of illegal memory access done in httplib::detail::split. Have added checks to make sure the split function has a valid string with length > 0.
* Fix parsing to parse query string with single space char.
* Fix server crash caused due to regex complexity while matching headers.
While parsing content-type header in multipart form request the server crashes due to the exhaustion of max iterations performed while matching the input string with content-type regex.
Have removed the regex which might use backtracking while matching and replaced it with manual string processing. Have added tests as well.
* Remove magic number
Co-authored-by: Ivan Fefer <fefer.ivan@gmail.com>
Co-authored-by: yhirose <yhirose@users.noreply.github.com>
Co-authored-by: Ivan Fefer <fefer.ivan@gmail.com>
2020-09-03 13:17:52 -04:00
Ivan Fefer
3b5bab3308
Fix gzip_decompressor in case of one chunk being exactly equal to buffer size ( #636 )
...
* add larget chunks test
* revert test
* Fix gzip decoder in case of chunk being equal to buffer size
* add test
2020-09-03 12:20:02 -04:00
yhirose
69e75f4a67
Fix #635 . HTTPS request stucked with proxy ( #637 )
2020-09-03 12:17:53 -04:00
Omkar Jadhav
b0fd4befb1
Fix query parsing issues ( #629 )
...
* Fix parsing to parse query string with single space char.
When passed ' ' as a query string, the server crashes cause of illegal memory access done in httplib::detail::split. Have added checks to make sure the split function has a valid string with length > 0.
* Fix parsing to parse query string with single space char.
2020-08-28 09:43:28 -04:00
yhirose
3e80666a74
Fix #628
2020-08-27 19:45:28 -04:00
yhirose
16df0ef37e
Code cleanup
2020-08-26 12:18:49 -04:00
Ivan Fefer
f1a2ac5108
Avoid copying of content provider if possible ( #627 )
2020-08-26 08:56:51 -04:00
yhirose
e5903635e2
Fix #619
2020-08-22 12:54:43 -04:00
yhirose
510b4eaaae
Fix #613
2020-08-17 13:40:06 -04:00
yhirose
e5dd410256
Added set_content_provider without content length
2020-08-15 05:53:49 -04:00
yhirose
951e46929e
Fix #609
2020-08-14 15:01:09 -04:00
yhirose
c8adac30f4
Fix #564 again
2020-08-13 08:07:25 -04:00
R Edgar
649b1d2172
Fix nullptr_t issue ( #605 )
...
Clang complains that `nullptr_t` should be `std::nullptr_t
2020-08-09 16:45:53 -04:00
yhirose
dc5f9ba164
Better error handling on client ( #601 )
2020-08-08 20:50:24 -04:00
yhirose
04002d57bd
Added set_default_headers ( Fix #600 )
2020-08-03 22:05:37 -04:00
yhirose
38a7706c8b
Removed old Keep-Alive functions
2020-08-03 22:04:40 -04:00
PixlRainbow
5f76cb01c7
fix #592 -- add check for static-linked OpenSSL ( #595 )
2020-08-01 08:10:42 -04:00
yhirose
4f84eeb298
Bearer Token auth support. Fix #484
2020-07-31 12:37:14 -04:00
yhirose
a5b4cfadb9
Brotli suport on server. Fix #578
2020-07-31 10:23:57 -04:00
yhirose
3e906a9b8c
Fix #591
2020-07-30 18:26:18 -04:00
yhirose
110393eadb
Class name change
2020-07-30 17:27:07 -04:00
ThePiso
e130cf3a3b
The piso patch 1 ( #590 )
...
* Update httplib.h
When you disconnect and reconnect from the network, your network stack rewrites and updates /etc/resolv.conf accordingly. This configuration file is needed by the DNS resolver in the C library. The C library reads the DNS configuration from /etc/resolv.conf the first time, and caches it. It doesn't check, with every lookup, if the contents of /etc/resolv.conf have changed.
the solution is to add a call to res_init(), defined in resolv.h
* Update httplib.h
2020-07-30 10:11:02 -04:00
yhirose
8a348f17fd
Resolved #192
2020-07-30 01:47:54 -04:00
yhirose
797d1f27e8
Fix #357
2020-07-29 23:12:05 -04:00
yhirose
6cce7951fc
Fixed build error on non Windows environments with OpenSSL
2020-07-27 22:34:35 -04:00
yhirose
e9058e5639
Fixed build error on Windows with OpenSSL
2020-07-27 22:32:31 -04:00
yhirose
2538a85486
Fix #581
2020-07-27 22:07:04 -04:00
yhirose
12540fe8d3
Brotli support on client
2020-07-25 20:44:02 -04:00
yhirose
90da199aba
Disable compression when content-type is text/event-stream
2020-07-25 10:46:52 -04:00
yhirose
9ca1fa8b18
Fix #576
2020-07-25 09:37:57 -04:00
yhirose
72ce293fed
Removed set_timeout_sec and left set_base_dir
2020-07-20 17:15:16 -04:00
yhirose
b476b55771
Fix #557
2020-07-20 17:04:50 -04:00
yhirose
5ddaf949d0
Fixed build error on Windows
2020-07-19 18:32:28 -04:00
yhirose
457a5a7501
Added compressor class
2020-07-19 17:44:45 -04:00
Daniel Ottiger
2ce080c2cb
include <wincrypt.h> as otherwise CertOpenSystemStoreW can not be found ( #568 )
...
- visual studio 2019, version 16.6.3
- 64 bit target
2020-07-15 10:17:18 -04:00
yhirose
6ad25b6cf0
Fix #566
2020-07-12 20:41:02 -04:00
yhirose
3dff60eb16
Fix #565
2020-07-10 08:18:28 -04:00
yhirose
5038314b21
Fix #564
2020-07-08 13:56:06 -04:00
yhirose
6e1297cab0
Fix #150 ( #556 )
2020-07-07 18:55:46 -04:00
yhirose
7de743c962
Code format
2020-07-04 00:11:32 -04:00
Umiade
964fb5e5ca
Fix: regex can't match when proxy was set to some web debugger(e.g. Fiddler) ( #553 )
...
Co-authored-by: Umiade <hanyuchao@corp.netease.com>
2020-07-03 07:17:04 -04:00
yhirose
c4f3f9529b
Fix #534 ( #546 )
2020-07-02 21:57:50 -04:00
Ilya Tsybulsky
887def9490
Fix logger never called when write_content_with_provider returns false ( #549 )
2020-07-01 17:09:43 -04:00
Ilya Tsybulsky
bad6b2d22f
fix-the-code-won't compile-with-sdl-checks-on ( #550 )
2020-07-01 17:09:19 -04:00
rundong08
3d47a51430
Fixed comparison of integers of different signs. ( #544 )
2020-06-29 21:19:56 -04:00
yhirose
ce502a73e1
Fix #531
2020-06-22 14:56:18 -04:00
yhirose
6b22409217
Code format
2020-06-18 23:33:07 -04:00
yhirose
969cccd52a
Use && for parameter of boundary
2020-06-18 23:32:09 -04:00
yhirose
4a9c048bbc
Fixed problem with set_socket_options
2020-06-18 23:31:41 -04:00
yhirose
bfabbec8c7
Fix #528
2020-06-18 12:20:01 -04:00
yhirose
3e9c06cf79
Fixed #527
2020-06-18 12:18:43 -04:00
yhirose
29677540ae
Removed unnecessary yeid.
2020-06-16 21:33:10 -04:00
yhirose
71fcfeb912
Removed unnecessary code
2020-06-16 21:21:03 -04:00
yhirose
c7d22e451f
Fixed timeout calculation bugs
2020-06-16 21:20:47 -04:00
yhirose
42f9f9107f
Updated version in the User Agent string
2020-06-16 17:53:15 -04:00
yhirose
7cd25fbd63
Fix #499
2020-06-16 17:46:23 -04:00
yhirose
3dfb4ecac2
Fix #522
2020-06-15 23:09:46 -04:00
yhirose
144114f316
Fixed warnings on Windows
2020-06-13 23:20:21 -04:00
yhirose
0743d78c9b
Fixed ClientStop test error.
2020-06-14 03:01:41 +00:00
yhirose
e022b8b80b
Refactoring to make it ready for KeepAlive connection on Client
2020-06-13 21:42:23 -04:00
yhirose
f80b6bd980
Added Endpoint structure in Client
2020-06-13 01:26:57 -04:00
yhirose
5af7222217
Fixed Client::stop problem with more than one requests on threads
2020-06-12 11:04:37 -04:00
yhirose
24bdb736f0
Fix #506
2020-06-09 19:58:01 -04:00
yhirose
d0dc200633
Code format
2020-06-09 19:17:58 -04:00
Nicolas Schneider
919a51091f
replace usage of [[deprecated]] with CPPHTTPLIB_DEPRECATED ( #513 )
2020-06-03 13:12:31 -04:00
Nicolas Schneider
05e8b22989
fix cast warning ( #512 )
2020-06-03 07:44:16 -04:00
Nicolas Schneider
00dcd6b004
check for [[deprecated]] support via feature test macro ( #511 )
...
The [[deprecated]] specifier is a C++14 feature, so it might not always
be available on a C++11 compiler.
2020-06-03 07:43:56 -04:00
yhirose
a42c6b99d3
Code cleanup
2020-06-02 19:06:16 -04:00
Wang Gao
812cb5bc3d
fix get value function ( #509 )
2020-06-02 19:05:04 -04:00
yhirose
aea60feb85
Code cleanup
2020-06-01 13:22:02 -04:00
yhirose
b3a4045300
Fix #503
2020-05-28 19:19:18 -04:00
yhirose
d9fe3fa020
Fix #504
2020-05-28 17:08:05 -04:00
yhirose
d8612ac02d
Fixed build error...
2020-05-28 12:51:52 -04:00
yhirose
83ee6007da
Fix #500
2020-05-28 12:06:11 -04:00
yhirose
3eaa769a2d
Fix #481 , #483 , #487
2020-05-26 18:34:32 -04:00
yhirose
b91540514d
Fix #494
2020-05-25 10:50:24 -04:00
yhirose
ab563ff52c
Fix #496
2020-05-25 10:38:47 -04:00
yhirose
be7962f140
Fix #489
2020-05-24 15:18:34 -04:00
yhirose
630f3465a9
Deprecated set_timeout_sec, added set_connection_timeout.
2020-05-23 18:00:24 -04:00
yhirose
9af1a4a08f
Fixed problem with stop on windows
2020-05-23 13:49:49 -04:00
yhirose
0654e5dab4
Changed CPPHTTPLIB_IDLE_INTERVAL_USECOND to 0
2020-05-23 08:44:03 -04:00
yhirose
62e036f253
Fixed #488 again
2020-05-22 18:24:01 -04:00
yhirose
f0adfb2e0c
Fix #488
2020-05-22 12:18:07 -04:00
yhirose
139c816c16
Fixed the location of Client2
2020-05-19 21:02:58 -04:00
yhirose
29fd136afd
Code cleanup and format
2020-05-16 17:35:04 -04:00
yhirose
f5598237b2
Fixed many redirects problem on Proxy
2020-05-16 17:34:03 -04:00
Daniel Ottiger
01058659ab
make write timeout configurable (like the read timeout already is) ( #477 )
...
In case we want to send a lot of data,
and the receiver is slower than the sender.
This will first fill up the receivers queues and after this
eventually also the senders queues,
until the socket is temporarily unable to accept more data to send.
select_write is done with an timeout of zero,
which makes the select call used always return immediately:
(see http://man7.org/linux/man-pages/man2/select.2.html )
This means that every marginal unavailability will make it return false
for is_writable and therefore httplib will immediately abort the transfer.
Therefore make this values configurable in the same way
as the read timeout already is.
Set the default write timeout to 5 seconds,
the same default value used for the read timeout.
2020-05-16 17:31:46 -04:00
yhirose
b9a9df4d73
Fixed problem with writing large data
2020-05-15 22:21:58 -04:00
yhirose
25aa3ca982
Added std::ostream os in DataSink.
2020-05-15 21:26:13 -04:00
yhirose
f4c5d94d74
Updated version in the User Agent string
2020-05-14 18:07:02 -04:00