@@ -5,7 +5,7 @@ cpp-httplib
5
5
6
6
A C++11 single-file header-only cross platform HTTP/HTTPS library.
7
7
8
- It's extremely easy to setup . Just include the ** httplib.h** file in your code!
8
+ It's extremely easy to set up . Just include the ** httplib.h** file in your code!
9
9
10
10
> [ !IMPORTANT]
11
11
> This library uses 'blocking' socket I/O. If you are looking for a library with 'non-blocking' socket I/O, this is not the one that you want.
@@ -187,7 +187,7 @@ svr.set_file_extension_and_mimetype_mapping("cpp", "text/x-c");
187
187
svr.set_file_extension_and_mimetype_mapping(" hh" , " text/x-h" );
188
188
```
189
189
190
- The followings are built-in mappings:
190
+ The following are built-in mappings:
191
191
192
192
| Extension | MIME Type | Extension | MIME Type |
193
193
| :--------- | :-------------------------- | :--------- | :-------------------------- |
@@ -201,7 +201,7 @@ The followings are built-in mappings:
201
201
| bmp | image/bmp | 7z | application/x-7z-compressed |
202
202
| gif | image/gif | atom | application/atom+xml |
203
203
| png | image/png | pdf | application/pdf |
204
- | svg | image/svg+xml | mjs, js | application /javascript |
204
+ | svg | image/svg+xml | mjs, js | text /javascript |
205
205
| webp | image/webp | json | application/json |
206
206
| ico | image/x-icon | rss | application/rss+xml |
207
207
| tif | image/tiff | tar | application/x-tar |
@@ -451,7 +451,7 @@ svr.set_expect_100_continue_handler([](const Request &req, Response &res) {
451
451
### Keep-Alive connection
452
452
453
453
``` cpp
454
- svr.set_keep_alive_max_count(2 ); // Default is 5
454
+ svr.set_keep_alive_max_count(2 ); // Default is 100
455
455
svr.set_keep_alive_timeout(10 ); // Default is 5
456
456
```
457
457
@@ -578,9 +578,11 @@ enum Error {
578
578
SSLConnection,
579
579
SSLLoadingCerts,
580
580
SSLServerVerification,
581
+ SSLServerHostnameVerification,
581
582
UnsupportedMultipartBoundaryChars,
582
583
Compression,
583
584
ConnectionTimeout,
585
+ ProxyConnection,
584
586
};
585
587
```
586
588
@@ -672,7 +674,7 @@ cli.set_read_timeout(5, 0); // 5 seconds
672
674
cli.set_write_timeout(5 , 0 ); // 5 seconds
673
675
674
676
// This method works the same as curl's `--max-time` option
675
- svr .set_max_timeout(5000 ); // 5 seconds
677
+ cli .set_max_timeout(5000 ); // 5 seconds
676
678
```
677
679
678
680
### Receive content with a content receiver
@@ -846,6 +848,7 @@ The server can apply compression to the following MIME type contents:
846
848
* application/javascript
847
849
* application/json
848
850
* application/xml
851
+ * application/protobuf
849
852
* application/xhtml+xml
850
853
851
854
### Zlib Support
@@ -857,13 +860,18 @@ The server can apply compression to the following MIME type contents:
857
860
Brotli compression is available with ` CPPHTTPLIB_BROTLI_SUPPORT ` . Necessary libraries should be linked.
858
861
Please see https://github.com/google/brotli for more detail.
859
862
863
+ ### Zstd Support
864
+
865
+ Zstd compression is available with ` CPPHTTPLIB_ZSTD_SUPPORT ` . Necessary libraries should be linked.
866
+ Please see https://github.com/facebook/zstd for more detail.
867
+
860
868
### Default ` Accept-Encoding ` value
861
869
862
870
The default ` Accept-Encoding ` value contains all possible compression types. So, the following two examples are same.
863
871
864
872
``` c++
865
873
res = cli.Get(" /resource/foo" );
866
- res = cli.Get(" /resource/foo" , {{"Accept-Encoding", "gzip, deflate, br "}});
874
+ res = cli.Get(" /resource/foo" , {{"Accept-Encoding", "br, gzip, deflate, zstd "}});
867
875
```
868
876
869
877
If we don't want a response without compression, we have to set `Accept-Encoding` to an empty string. This behavior is similar to curl.
@@ -903,7 +911,7 @@ httplib::Client cli("./my-socket.sock");
903
911
cli.set_address_family(AF_UNIX);
904
912
```
905
913
906
- "my-socket.sock" can be a relative path or an absolute path. You application must have the appropriate permissions for the path. You can also use an abstract socket address on Linux. To use an abstract socket address, prepend a null byte ('\x00') to the path.
914
+ "my-socket.sock" can be a relative path or an absolute path. Your application must have the appropriate permissions for the path. You can also use an abstract socket address on Linux. To use an abstract socket address, prepend a null byte ('\x00') to the path.
907
915
908
916
909
917
Split httplib.h into .h and .cc
0 commit comments