Skip to content

Commit dabaa51

Browse files
committed
Updated README
1 parent a1cfc0f commit dabaa51

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ svr.set_logger([](const auto& req, const auto& res) {
7474

7575
```cpp
7676
svr.set_error_handler([](const auto& req, auto& res) {
77-
const char* fmt = "<p>Error Status: <span style='color:red;'>%d</span></p>";
77+
auto fmt = "<p>Error Status: <span style='color:red;'>%d</span></p>";
7878
char buf[BUFSIZ];
7979
snprintf(buf, sizeof(buf), fmt, res.status);
8080
res.set_content(buf, "text/html");
@@ -325,23 +325,30 @@ This feature was contributed by [underscorediscovery](https://github.com/yhirose
325325

326326
### Authentication
327327

328-
NOTE: OpenSSL is required for Digest Authentication, since cpp-httplib uses message digest functions in OpenSSL.
328+
```cpp
329+
// Basic Authentication
330+
cli.set_basic_auth("user", "pass");
331+
332+
// Digest Authentication
333+
cli.set_digest_auth("user", "pass");
334+
```
335+
336+
NOTE: OpenSSL is required for Digest Authentication.
337+
338+
### Proxy server support
329339

330340
```cpp
331-
httplib::Client cli("httplib.org");
332-
cli.set_auth("user", "pass");
341+
cli.set_proxy("host", port);
333342

334-
// Basic
335-
auto res = cli.Get("/basic-auth/user/pass");
336-
// res->status should be 200
337-
// res->body should be "{\n \"authenticated\": true, \n \"user\": \"user\"\n}\n".
343+
// Basic Authentication
344+
cli.set_proxy_basic_auth("user", "pass");
338345

339-
// Digest
340-
res = cli.Get("/digest-auth/auth/user/pass/SHA-256");
341-
// res->status should be 200
342-
// res->body should be "{\n \"authenticated\": true, \n \"user\": \"user\"\n}\n".
346+
// Digest Authentication
347+
cli.set_proxy_digest_auth("user", "pass");
343348
```
344349

350+
NOTE: OpenSSL is required for Digest Authentication.
351+
345352
### Range
346353

347354
```cpp

0 commit comments

Comments
 (0)