Joel Rosdahl 2 years ago
parent
commit
9f7ae0737a
6 changed files with 23 additions and 23 deletions
  1. 1 1
      CMakeLists.txt
  2. 10 10
      httplib.h
  3. 1 1
      httplibConfig.cmake.in
  4. 1 1
      test/fuzzing/standalone_fuzz_target_runner.cpp
  5. 9 9
      test/test.cc
  6. 1 1
      test/test_proxy.cc

+ 1 - 1
CMakeLists.txt

@@ -79,7 +79,7 @@ set(_HTTPLIB_OPENSSL_MIN_VER "1.1.1")
 # Allow for a build to require OpenSSL to pass, instead of just being optional
 option(HTTPLIB_REQUIRE_OPENSSL "Requires OpenSSL to be found & linked, or fails build." OFF)
 option(HTTPLIB_REQUIRE_ZLIB "Requires ZLIB to be found & linked, or fails build." OFF)
-# Allow for a build to casually enable OpenSSL/ZLIB support, but silenty continue if not found.
+# Allow for a build to casually enable OpenSSL/ZLIB support, but silently continue if not found.
 # Make these options so their automatic use can be specifically disabled (as needed)
 option(HTTPLIB_USE_OPENSSL_IF_AVAILABLE "Uses OpenSSL (if available) to enable HTTPS support." ON)
 option(HTTPLIB_USE_ZLIB_IF_AVAILABLE "Uses ZLIB (if available) to enable Zlib compression support." ON)

+ 10 - 10
httplib.h

@@ -800,7 +800,7 @@ private:
                                      ContentReceiver multipart_receiver);
   bool read_content_core(Stream &strm, Request &req, Response &res,
                          ContentReceiver receiver,
-                         MultipartContentHeader mulitpart_header,
+                         MultipartContentHeader multipart_header,
                          ContentReceiver multipart_receiver);
 
   virtual bool process_and_close_socket(socket_t sock);
@@ -1150,7 +1150,7 @@ protected:
 
   void copy_settings(const ClientImpl &rhs);
 
-  // Socket endoint information
+  // Socket endpoint information
   const std::string host_;
   const int port_;
   const std::string host_and_port_;
@@ -5542,7 +5542,7 @@ inline bool Server::read_content_with_content_receiver(
 
 inline bool Server::read_content_core(Stream &strm, Request &req, Response &res,
                                       ContentReceiver receiver,
-                                      MultipartContentHeader mulitpart_header,
+                                      MultipartContentHeader multipart_header,
                                       ContentReceiver multipart_receiver) {
   detail::MultipartFormDataParser multipart_form_data_parser;
   ContentReceiverWithProgress out;
@@ -5562,14 +5562,14 @@ inline bool Server::read_content_core(Stream &strm, Request &req, Response &res,
       while (pos < n) {
         auto read_size = (std::min)<size_t>(1, n - pos);
         auto ret = multipart_form_data_parser.parse(
-            buf + pos, read_size, multipart_receiver, mulitpart_header);
+            buf + pos, read_size, multipart_receiver, multipart_header);
         if (!ret) { return false; }
         pos += read_size;
       }
       return true;
       */
       return multipart_form_data_parser.parse(buf, n, multipart_receiver,
-                                              mulitpart_header);
+                                              multipart_header);
     };
   } else {
     out = [receiver](const char *buf, size_t n, uint64_t /*off*/,
@@ -6512,7 +6512,7 @@ inline bool ClientImpl::write_content_with_provider(Stream &strm,
   auto is_shutting_down = []() { return false; };
 
   if (req.is_chunked_content_provider_) {
-    // TODO: Brotli suport
+    // TODO: Brotli support
     std::unique_ptr<detail::compressor> compressor;
 #ifdef CPPHTTPLIB_ZLIB_SUPPORT
     if (compress_) {
@@ -7399,7 +7399,7 @@ inline void ClientImpl::stop() {
     return;
   }
 
-  // Otherwise, sitll holding the mutex, we can shut everything down ourselves
+  // Otherwise, still holding the mutex, we can shut everything down ourselves
   shutdown_ssl(socket_, true);
   shutdown_socket(socket_);
   close_socket(socket_);
@@ -8142,7 +8142,7 @@ SSLClient::verify_host_with_subject_alt_name(X509 *server_cert) const {
 
   if (alt_names) {
     auto dsn_matched = false;
-    auto ip_mached = false;
+    auto ip_matched = false;
 
     auto count = sk_GENERAL_NAME_num(alt_names);
 
@@ -8158,14 +8158,14 @@ SSLClient::verify_host_with_subject_alt_name(X509 *server_cert) const {
         case GEN_IPADD:
           if (!memcmp(&addr6, name, addr_len) ||
               !memcmp(&addr, name, addr_len)) {
-            ip_mached = true;
+            ip_matched = true;
           }
           break;
         }
       }
     }
 
-    if (dsn_matched || ip_mached) { ret = true; }
+    if (dsn_matched || ip_matched) { ret = true; }
   }
 
   GENERAL_NAMES_free((STACK_OF(GENERAL_NAME) *)alt_names);

+ 1 - 1
httplibConfig.cmake.in

@@ -54,7 +54,7 @@ if(NOT DEFINED httplib_FOUND OR httplib_FOUND)
 	include("${CMAKE_CURRENT_LIST_DIR}/httplibTargets.cmake")
 endif()
 
-# Ouputs a "found httplib /usr/include/httplib.h" message when using find_package(httplib)
+# Outputs a "found httplib /usr/include/httplib.h" message when using find_package(httplib)
 include(FindPackageMessage)
 if(TARGET httplib::httplib)
 	set(HTTPLIB_FOUND TRUE)

+ 1 - 1
test/fuzzing/standalone_fuzz_target_runner.cpp

@@ -11,7 +11,7 @@
 #include <vector>
 
 // Forward declare the "fuzz target" interface.
-// We deliberately keep this inteface simple and header-free.
+// We deliberately keep this interface simple and header-free.
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
 
 // It reads all files passed as parameters and feeds their contents

+ 9 - 9
test/test.cc

@@ -46,7 +46,7 @@ MultipartFormData &get_file_value(MultipartFormDataItems &files,
   return *it;
 #else
   if (it != files.end()) { return *it; }
-  throw std::runtime_error("invalid mulitpart form data name error");
+  throw std::runtime_error("invalid multipart form data name error");
 #endif
 }
 
@@ -779,7 +779,7 @@ TEST(DigestAuthTest, FromHTTPWatch_Online) {
     }
 
     // NOTE: Until httpbin.org fixes issue #46, the following test is commented
-    // out. Plese see https://httpbin.org/digest-auth/auth/hello/world
+    // out. Please see https://httpbin.org/digest-auth/auth/hello/world
     // cli.set_digest_auth("bad", "world");
     // for (auto path : paths) {
     //   auto res = cli.Get(path.c_str());
@@ -1778,7 +1778,7 @@ protected:
                   EXPECT_EQ(text_value.size(), 1);
                   auto &text = text_value[0];
                   EXPECT_TRUE(text.filename.empty());
-                  EXPECT_EQ("defalut text", text.content);
+                  EXPECT_EQ("default text", text.content);
               }
               {
                 const auto &text1_values = req.get_file_values("multi_text1");
@@ -2647,7 +2647,7 @@ TEST_F(ServerTest, MultipartFormData) {
 
 TEST_F(ServerTest, MultipartFormDataMultiFileValues) {
   MultipartFormDataItems items = {
-    {"text", "defalut text", "", ""},
+    {"text", "default text", "", ""},
 
     {"multi_text1", "aaaaa", "", ""},
     {"multi_text1", "bbbbb", "", ""},
@@ -3185,7 +3185,7 @@ TEST(GzipDecompressor, ChunkedDecompression) {
   {
     httplib::detail::gzip_decompressor decompressor;
 
-    // Chunk size is chosen specificaly to have a decompressed chunk size equal
+    // Chunk size is chosen specifically to have a decompressed chunk size equal
     // to 16384 bytes 16384 bytes is the size of decompressor output buffer
     size_t chunk_size = 130;
     for (size_t chunk_begin = 0; chunk_begin < compressed_data.size();
@@ -3334,7 +3334,7 @@ TEST_F(ServerTest, PostContentReceiver) {
   ASSERT_EQ("content", res->body);
 }
 
-TEST_F(ServerTest, PostMulitpartFilsContentReceiver) {
+TEST_F(ServerTest, PostMultipartFileContentReceiver) {
   MultipartFormDataItems items = {
       {"text1", "text default", "", ""},
       {"text2", "aωb", "", ""},
@@ -3349,7 +3349,7 @@ TEST_F(ServerTest, PostMulitpartFilsContentReceiver) {
   EXPECT_EQ(200, res->status);
 }
 
-TEST_F(ServerTest, PostMulitpartPlusBoundary) {
+TEST_F(ServerTest, PostMultipartPlusBoundary) {
   MultipartFormDataItems items = {
       {"text1", "text default", "", ""},
       {"text2", "aωb", "", ""},
@@ -3765,10 +3765,10 @@ TEST(ServerRequestParsingTest, ReadHeadersRegexComplexity2) {
       "&&&%%%");
 }
 
-TEST(ServerRequestParsingTest, ExcessiveWhitespaceInUnparseableHeaderLine) {
+TEST(ServerRequestParsingTest, ExcessiveWhitespaceInUnparsableHeaderLine) {
   // Make sure this doesn't crash the server.
   // In a previous version of the header line regex, the "\r" rendered the line
-  // unparseable and the regex engine repeatedly backtracked, trying to look for
+  // unparsable and the regex engine repeatedly backtracked, trying to look for
   // a new position where the leading white space ended and the field value
   // began.
   // The crash occurs with libc++ but not libstdc++.

+ 1 - 1
test/test_proxy.cc

@@ -193,7 +193,7 @@ void DigestAuthTestFromHTTPWatch(T& cli) {
     }
 
     // NOTE: Until httpbin.org fixes issue #46, the following test is commented
-    // out. Plese see https://httpbin.org/digest-auth/auth/hello/world
+    // out. Please see https://httpbin.org/digest-auth/auth/hello/world
     // cli.set_digest_auth("bad", "world");
     // for (auto path : paths) {
     //   auto res = cli.Get(path.c_str());