mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 06:26:02 -07:00
Code cleanup. (Removed unnecessary .c_str()
calls)
This commit is contained in:
parent
20a7f088ce
commit
e2813d9d4d
1 changed files with 8 additions and 8 deletions
16
httplib.h
16
httplib.h
|
@ -3326,7 +3326,7 @@ find_content_type(const std::string &path,
|
|||
auto ext = file_extension(path);
|
||||
|
||||
auto it = user_data.find(ext);
|
||||
if (it != user_data.end()) { return it->second.c_str(); }
|
||||
if (it != user_data.end()) { return it->second; }
|
||||
|
||||
using udl::operator""_t;
|
||||
|
||||
|
@ -6082,7 +6082,7 @@ inline bool Server::handle_file_request(const Request &req, Response &res,
|
|||
|
||||
if (detail::is_file(path)) {
|
||||
for (const auto &kv : entry.headers) {
|
||||
res.set_header(kv.first.c_str(), kv.second);
|
||||
res.set_header(kv.first, kv.second);
|
||||
}
|
||||
|
||||
auto mm = std::make_shared<detail::mmap>(path.c_str());
|
||||
|
@ -6992,7 +6992,7 @@ inline bool ClientImpl::redirect(Request &req, Response &res, Error &error) {
|
|||
} else {
|
||||
if (next_scheme == "https") {
|
||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||
SSLClient cli(next_host.c_str(), next_port);
|
||||
SSLClient cli(next_host, next_port);
|
||||
cli.copy_settings(*this);
|
||||
if (ca_cert_store_) { cli.set_ca_cert_store(ca_cert_store_); }
|
||||
return detail::redirect(cli, req, res, path, location, error);
|
||||
|
@ -7000,7 +7000,7 @@ inline bool ClientImpl::redirect(Request &req, Response &res, Error &error) {
|
|||
return false;
|
||||
#endif
|
||||
} else {
|
||||
ClientImpl cli(next_host.c_str(), next_port);
|
||||
ClientImpl cli(next_host, next_port);
|
||||
cli.copy_settings(*this);
|
||||
return detail::redirect(cli, req, res, path, location, error);
|
||||
}
|
||||
|
@ -7478,7 +7478,7 @@ inline Result ClientImpl::Get(const std::string &path, const Params ¶ms,
|
|||
if (params.empty()) { return Get(path, headers); }
|
||||
|
||||
std::string path_with_query = append_query_params(path, params);
|
||||
return Get(path_with_query.c_str(), headers, progress);
|
||||
return Get(path_with_query, headers, progress);
|
||||
}
|
||||
|
||||
inline Result ClientImpl::Get(const std::string &path, const Params ¶ms,
|
||||
|
@ -7498,7 +7498,7 @@ inline Result ClientImpl::Get(const std::string &path, const Params ¶ms,
|
|||
}
|
||||
|
||||
std::string path_with_query = append_query_params(path, params);
|
||||
return Get(path_with_query.c_str(), headers, response_handler,
|
||||
return Get(path_with_query, headers, response_handler,
|
||||
content_receiver, progress);
|
||||
}
|
||||
|
||||
|
@ -7601,7 +7601,7 @@ inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|||
const auto &content_type =
|
||||
detail::serialize_multipart_formdata_get_content_type(boundary);
|
||||
const auto &body = detail::serialize_multipart_formdata(items, boundary);
|
||||
return Post(path, headers, body, content_type.c_str());
|
||||
return Post(path, headers, body, content_type);
|
||||
}
|
||||
|
||||
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
||||
|
@ -7614,7 +7614,7 @@ inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|||
const auto &content_type =
|
||||
detail::serialize_multipart_formdata_get_content_type(boundary);
|
||||
const auto &body = detail::serialize_multipart_formdata(items, boundary);
|
||||
return Post(path, headers, body, content_type.c_str());
|
||||
return Post(path, headers, body, content_type);
|
||||
}
|
||||
|
||||
inline Result
|
||||
|
|
Loading…
Reference in a new issue