Fix #1251
This commit is contained in:
parent
80a55cedeb
commit
4e28e4f741
@ -60,10 +60,10 @@
|
|||||||
]]
|
]]
|
||||||
cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
|
||||||
|
|
||||||
# Get the user agent and use it as a version
|
# Get the CPPHTTPLIB_VERSION value and use it as a version
|
||||||
# This gets the string with the user agent from the header.
|
# This gets the string with the CPPHTTPLIB_VERSION value from the header.
|
||||||
# This is so the maintainer doesn't actually need to update this manually.
|
# This is so the maintainer doesn't actually need to update this manually.
|
||||||
file(STRINGS httplib.h _raw_version_string REGEX "User\-Agent.*cpp\-httplib/([0-9]+\.?)+")
|
file(STRINGS httplib.h _raw_version_string REGEX "CPPHTTPLIB_VERSION \"([0-9]+\\.[0-9]+\\.[0-9]+)\"")
|
||||||
|
|
||||||
# Needed since git tags have "v" prefixing them.
|
# Needed since git tags have "v" prefixing them.
|
||||||
# Also used if the fallback to user agent string is being used.
|
# Also used if the fallback to user agent string is being used.
|
||||||
|
@ -8,9 +8,7 @@
|
|||||||
#ifndef CPPHTTPLIB_HTTPLIB_H
|
#ifndef CPPHTTPLIB_HTTPLIB_H
|
||||||
#define CPPHTTPLIB_HTTPLIB_H
|
#define CPPHTTPLIB_HTTPLIB_H
|
||||||
|
|
||||||
#define CPPHTTPLIB_VERSION_MAJOR 0
|
#define CPPHTTPLIB_VERSION "0.10.5"
|
||||||
#define CPPHTTPLIB_VERSION_MINOR 10
|
|
||||||
#define CPPHTTPLIB_VERSION_PATCH 5
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configuration
|
* Configuration
|
||||||
@ -6198,9 +6196,7 @@ inline bool ClientImpl::write_request(Stream &strm, Request &req,
|
|||||||
|
|
||||||
#ifndef CPPHTTPLIB_NO_DEFAULT_USER_AGENT
|
#ifndef CPPHTTPLIB_NO_DEFAULT_USER_AGENT
|
||||||
if (!req.has_header("User-Agent")) {
|
if (!req.has_header("User-Agent")) {
|
||||||
auto agent = "cpp-httplib/" + std::to_string(CPPHTTPLIB_VERSION_MAJOR) +
|
auto agent = std::string("cpp-httplib/") + CPPHTTPLIB_VERSION;
|
||||||
"." + std::to_string(CPPHTTPLIB_VERSION_MINOR) + "." +
|
|
||||||
std::to_string(CPPHTTPLIB_VERSION_PATCH);
|
|
||||||
req.headers.emplace("User-Agent", agent);
|
req.headers.emplace("User-Agent", agent);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user