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