Skip to content

Commit 4e28e4f

Browse files
committed
Fix #1251
1 parent 80a55ce commit 4e28e4f

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
]]
6161
cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR)
6262

63-
# Get the user agent and use it as a version
64-
# This gets the string with the user agent from the header.
63+
# Get the CPPHTTPLIB_VERSION value and use it as a version
64+
# This gets the string with the CPPHTTPLIB_VERSION value from the header.
6565
# This is so the maintainer doesn't actually need to update this manually.
66-
file(STRINGS httplib.h _raw_version_string REGEX "User\-Agent.*cpp\-httplib/([0-9]+\.?)+")
66+
file(STRINGS httplib.h _raw_version_string REGEX "CPPHTTPLIB_VERSION \"([0-9]+\\.[0-9]+\\.[0-9]+)\"")
6767

6868
# Needed since git tags have "v" prefixing them.
6969
# Also used if the fallback to user agent string is being used.

httplib.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
#ifndef CPPHTTPLIB_HTTPLIB_H
99
#define CPPHTTPLIB_HTTPLIB_H
1010

11-
#define CPPHTTPLIB_VERSION_MAJOR 0
12-
#define CPPHTTPLIB_VERSION_MINOR 10
13-
#define CPPHTTPLIB_VERSION_PATCH 5
11+
#define CPPHTTPLIB_VERSION "0.10.5"
1412

1513
/*
1614
* Configuration
@@ -6198,9 +6196,7 @@ inline bool ClientImpl::write_request(Stream &strm, Request &req,
61986196

61996197
#ifndef CPPHTTPLIB_NO_DEFAULT_USER_AGENT
62006198
if (!req.has_header("User-Agent")) {
6201-
auto agent = "cpp-httplib/" + std::to_string(CPPHTTPLIB_VERSION_MAJOR) +
6202-
"." + std::to_string(CPPHTTPLIB_VERSION_MINOR) + "." +
6203-
std::to_string(CPPHTTPLIB_VERSION_PATCH);
6199+
auto agent = std::string("cpp-httplib/") + CPPHTTPLIB_VERSION;
62046200
req.headers.emplace("User-Agent", agent);
62056201
}
62066202
#endif

0 commit comments

Comments
 (0)