Skip to content

Commit ada9704

Browse files
committed
Fix misspelled words
1 parent 6e73a63 commit ada9704

File tree

2 files changed

+35
-39
lines changed

2 files changed

+35
-39
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,11 @@ svr.Get("/chunked", [&](const Request& req, Response& res) {
406406

407407
```cpp
408408
svr.Get("/content", [&](const Request &req, Response &res) {
409-
res.set_file_content("./path/to/conent.html");
409+
res.set_file_content("./path/to/content.html");
410410
});
411411

412412
svr.Get("/content", [&](const Request &req, Response &res) {
413-
res.set_file_content("./path/to/conent", "text/html");
413+
res.set_file_content("./path/to/content", "text/html");
414414
});
415415
```
416416

@@ -843,7 +843,7 @@ Please see https://github.com/google/brotli for more detail.
843843

844844
### Default `Accept-Encoding` value
845845

846-
The default `Acdcept-Encoding` value contains all possible compression types. So, the following two examples are same.
846+
The default `Accept-Encoding` value contains all possible compression types. So, the following two examples are same.
847847

848848
```c++
849849
res = cli.Get("/resource/foo");

httplib.h

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ class MatcherBase {
894894
* Captures parameters in request path and stores them in Request::path_params
895895
*
896896
* Capture name is a substring of a pattern from : to /.
897-
* The rest of the pattern is matched agains the request path directly
897+
* The rest of the pattern is matched against the request path directly
898898
* Parameters are captured starting from the next character after
899899
* the end of the last matched static pattern fragment until the next /.
900900
*
@@ -1124,7 +1124,7 @@ class Server {
11241124
virtual bool process_and_close_socket(socket_t sock);
11251125

11261126
std::atomic<bool> is_running_{false};
1127-
std::atomic<bool> is_decommisioned{false};
1127+
std::atomic<bool> is_decommissioned{false};
11281128

11291129
struct MountPointEntry {
11301130
std::string mount_point;
@@ -2586,7 +2586,7 @@ class stream_line_reader {
25862586
char *fixed_buffer_;
25872587
const size_t fixed_buffer_size_;
25882588
size_t fixed_buffer_used_size_ = 0;
2589-
std::string glowable_buffer_;
2589+
std::string growable_buffer_;
25902590
};
25912591

25922592
class mmap {
@@ -3022,18 +3022,18 @@ inline stream_line_reader::stream_line_reader(Stream &strm, char *fixed_buffer,
30223022
fixed_buffer_size_(fixed_buffer_size) {}
30233023

30243024
inline const char *stream_line_reader::ptr() const {
3025-
if (glowable_buffer_.empty()) {
3025+
if (growable_buffer_.empty()) {
30263026
return fixed_buffer_;
30273027
} else {
3028-
return glowable_buffer_.data();
3028+
return growable_buffer_.data();
30293029
}
30303030
}
30313031

30323032
inline size_t stream_line_reader::size() const {
3033-
if (glowable_buffer_.empty()) {
3033+
if (growable_buffer_.empty()) {
30343034
return fixed_buffer_used_size_;
30353035
} else {
3036-
return glowable_buffer_.size();
3036+
return growable_buffer_.size();
30373037
}
30383038
}
30393039

@@ -3044,7 +3044,7 @@ inline bool stream_line_reader::end_with_crlf() const {
30443044

30453045
inline bool stream_line_reader::getline() {
30463046
fixed_buffer_used_size_ = 0;
3047-
glowable_buffer_.clear();
3047+
growable_buffer_.clear();
30483048

30493049
#ifndef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR
30503050
char prev_byte = 0;
@@ -3082,11 +3082,11 @@ inline void stream_line_reader::append(char c) {
30823082
fixed_buffer_[fixed_buffer_used_size_++] = c;
30833083
fixed_buffer_[fixed_buffer_used_size_] = '\0';
30843084
} else {
3085-
if (glowable_buffer_.empty()) {
3085+
if (growable_buffer_.empty()) {
30863086
assert(fixed_buffer_[fixed_buffer_used_size_] == '\0');
3087-
glowable_buffer_.assign(fixed_buffer_, fixed_buffer_used_size_);
3087+
growable_buffer_.assign(fixed_buffer_, fixed_buffer_used_size_);
30883088
}
3089-
glowable_buffer_ += c;
3089+
growable_buffer_ += c;
30903090
}
30913091
}
30923092

@@ -4259,10 +4259,6 @@ inline bool parse_header(const char *beg, const char *end, T fn) {
42594259
if (!key_len) { return false; }
42604260

42614261
auto key = std::string(beg, key_end);
4262-
// auto val = (case_ignore::equal(key, "Location") ||
4263-
// case_ignore::equal(key, "Referer"))
4264-
// ? std::string(p, end)
4265-
// : decode_url(std::string(p, end), false);
42664262
auto val = std::string(p, end);
42674263

42684264
if (!detail::fields::is_field_value(val)) { return false; }
@@ -4401,7 +4397,7 @@ inline bool read_content_chunked(Stream &strm, T &x,
44014397

44024398
assert(chunk_len == 0);
44034399

4404-
// NOTE: In RFC 9112, '7.1 Chunked Transfer Coding' mentiones "The chunked
4400+
// NOTE: In RFC 9112, '7.1 Chunked Transfer Coding' mentions "The chunked
44054401
// transfer coding is complete when a chunk with a chunk-size of zero is
44064402
// received, possibly followed by a trailer section, and finally terminated by
44074403
// an empty line". https://www.rfc-editor.org/rfc/rfc9112.html#section-7.1
@@ -4411,8 +4407,8 @@ inline bool read_content_chunked(Stream &strm, T &x,
44114407
// to be ok whether the final CRLF exists or not in the chunked data.
44124408
// https://www.rfc-editor.org/rfc/rfc9112.html#section-7.1.3
44134409
//
4414-
// According to the reference code in RFC 9112, cpp-htpplib now allows
4415-
// chuncked transfer coding data without the final CRLF.
4410+
// According to the reference code in RFC 9112, cpp-httplib now allows
4411+
// chunked transfer coding data without the final CRLF.
44164412
if (!line_reader.getline()) { return true; }
44174413

44184414
while (strcmp(line_reader.ptr(), "\r\n") != 0) {
@@ -5002,7 +4998,7 @@ class MultipartFormDataParser {
50024998

50034999
it = params.find("filename*");
50045000
if (it != params.end()) {
5005-
// Only allow UTF-8 enconnding...
5001+
// Only allow UTF-8 encoding...
50065002
static const std::regex re_rfc5987_encoding(
50075003
R"~(^UTF-8''(.+?)$)~", std::regex_constants::icase);
50085004

@@ -5249,7 +5245,7 @@ serialize_multipart_formdata(const MultipartFormDataItems &items,
52495245

52505246
inline bool range_error(Request &req, Response &res) {
52515247
if (!req.ranges.empty() && 200 <= res.status && res.status < 300) {
5252-
ssize_t contant_len = static_cast<ssize_t>(
5248+
ssize_t content_len = static_cast<ssize_t>(
52535249
res.content_length_ ? res.content_length_ : res.body.size());
52545250

52555251
ssize_t prev_first_pos = -1;
@@ -5269,12 +5265,12 @@ inline bool range_error(Request &req, Response &res) {
52695265

52705266
if (first_pos == -1 && last_pos == -1) {
52715267
first_pos = 0;
5272-
last_pos = contant_len;
5268+
last_pos = content_len;
52735269
}
52745270

52755271
if (first_pos == -1) {
5276-
first_pos = contant_len - last_pos;
5277-
last_pos = contant_len - 1;
5272+
first_pos = content_len - last_pos;
5273+
last_pos = content_len - 1;
52785274
}
52795275

52805276
// NOTE: RFC-9110 '14.1.2. Byte Ranges':
@@ -5286,13 +5282,13 @@ inline bool range_error(Request &req, Response &res) {
52865282
// with a value that is one less than the current length of the selected
52875283
// representation).
52885284
// https://www.rfc-editor.org/rfc/rfc9110.html#section-14.1.2-6
5289-
if (last_pos == -1 || last_pos >= contant_len) {
5290-
last_pos = contant_len - 1;
5285+
if (last_pos == -1 || last_pos >= content_len) {
5286+
last_pos = content_len - 1;
52915287
}
52925288

52935289
// Range must be within content length
52945290
if (!(0 <= first_pos && first_pos <= last_pos &&
5295-
last_pos <= contant_len - 1)) {
5291+
last_pos <= content_len - 1)) {
52965292
return true;
52975293
}
52985294

@@ -6486,12 +6482,12 @@ inline Server &Server::set_payload_max_length(size_t length) {
64866482
inline bool Server::bind_to_port(const std::string &host, int port,
64876483
int socket_flags) {
64886484
auto ret = bind_internal(host, port, socket_flags);
6489-
if (ret == -1) { is_decommisioned = true; }
6485+
if (ret == -1) { is_decommissioned = true; }
64906486
return ret >= 0;
64916487
}
64926488
inline int Server::bind_to_any_port(const std::string &host, int socket_flags) {
64936489
auto ret = bind_internal(host, 0, socket_flags);
6494-
if (ret == -1) { is_decommisioned = true; }
6490+
if (ret == -1) { is_decommissioned = true; }
64956491
return ret;
64966492
}
64976493

@@ -6505,7 +6501,7 @@ inline bool Server::listen(const std::string &host, int port,
65056501
inline bool Server::is_running() const { return is_running_; }
65066502

65076503
inline void Server::wait_until_ready() const {
6508-
while (!is_running_ && !is_decommisioned) {
6504+
while (!is_running_ && !is_decommissioned) {
65096505
std::this_thread::sleep_for(std::chrono::milliseconds{1});
65106506
}
65116507
}
@@ -6517,10 +6513,10 @@ inline void Server::stop() {
65176513
detail::shutdown_socket(sock);
65186514
detail::close_socket(sock);
65196515
}
6520-
is_decommisioned = false;
6516+
is_decommissioned = false;
65216517
}
65226518

6523-
inline void Server::decommission() { is_decommisioned = true; }
6519+
inline void Server::decommission() { is_decommissioned = true; }
65246520

65256521
inline bool Server::parse_request_line(const char *s, Request &req) const {
65266522
auto len = strlen(s);
@@ -6879,7 +6875,7 @@ Server::create_server_socket(const std::string &host, int port,
68796875

68806876
inline int Server::bind_internal(const std::string &host, int port,
68816877
int socket_flags) {
6882-
if (is_decommisioned) { return -1; }
6878+
if (is_decommissioned) { return -1; }
68836879

68846880
if (!is_valid()) { return -1; }
68856881

@@ -6906,7 +6902,7 @@ inline int Server::bind_internal(const std::string &host, int port,
69066902
}
69076903

69086904
inline bool Server::listen_internal() {
6909-
if (is_decommisioned) { return false; }
6905+
if (is_decommissioned) { return false; }
69106906

69116907
auto ret = true;
69126908
is_running_ = true;
@@ -6930,7 +6926,7 @@ inline bool Server::listen_internal() {
69306926
#endif
69316927

69326928
#if defined _WIN32
6933-
// sockets conneced via WASAccept inherit flags NO_HANDLE_INHERIT,
6929+
// sockets connected via WASAccept inherit flags NO_HANDLE_INHERIT,
69346930
// OVERLAPPED
69356931
socket_t sock = WSAAccept(svr_sock_, nullptr, nullptr, nullptr, 0);
69366932
#elif defined SOCK_CLOEXEC
@@ -6972,7 +6968,7 @@ inline bool Server::listen_internal() {
69726968
task_queue->shutdown();
69736969
}
69746970

6975-
is_decommisioned = !ret;
6971+
is_decommissioned = !ret;
69766972
return ret;
69776973
}
69786974

@@ -7594,7 +7590,7 @@ inline bool ClientImpl::send_(Request &req, Response &res, Error &error) {
75947590
#endif
75957591

75967592
if (!is_alive) {
7597-
// Attempt to avoid sigpipe by shutting down nongracefully if it seems
7593+
// Attempt to avoid sigpipe by shutting down non-gracefully if it seems
75987594
// like the other side has already closed the connection Also, there
75997595
// cannot be any requests in flight from other threads since we locked
76007596
// request_mutex_, so safe to close everything immediately

0 commit comments

Comments
 (0)