Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/bitcoin/network/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <bitcoin/network/define.hpp>
#include <bitcoin/network/messages/messages.hpp>

#define BC_HTTP_SERVER_NAME "libbitcoin/4.0"

namespace libbitcoin {
namespace network {

Expand Down Expand Up @@ -67,7 +69,7 @@ struct BCT_API settings
using tcp_server::tcp_server;

/// Sent via responses if configured .
std::string server{ "libbitcoin/4.0" };
std::string server{ BC_HTTP_SERVER_NAME };

/// Validated against hosts/origins if configured.
config::endpoints hosts{};
Expand Down
3 changes: 2 additions & 1 deletion src/net/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <bitcoin/network/define.hpp>
#include <bitcoin/network/log/log.hpp>
#include <bitcoin/network/messages/messages.hpp>
#include <bitcoin/network/settings.hpp>

namespace libbitcoin {
namespace network {
Expand Down Expand Up @@ -890,7 +891,7 @@ code socket::set_websocket(const http::request& request) NOEXCEPT
[](http::fields& header) NOEXCEPT
{
// Customize the response header.
header.set(http::field::server, "libbitcoin/4.0");
header.set(http::field::server, BC_HTTP_SERVER_NAME);
}
});

Expand Down
4 changes: 2 additions & 2 deletions test/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ BOOST_AUTO_TEST_CASE(settings__http_server__defaults__expected)
BOOST_REQUIRE(instance.expiration() == minutes(60));

// http_server
BOOST_REQUIRE_EQUAL(instance.server, "libbitcoin/4.0");
BOOST_REQUIRE_EQUAL(instance.server, BC_HTTP_SERVER_NAME);
BOOST_REQUIRE(instance.hosts.empty());
BOOST_REQUIRE(instance.origins.empty());
BOOST_REQUIRE(instance.host_names().empty());
Expand All @@ -369,7 +369,7 @@ BOOST_AUTO_TEST_CASE(settings__websocket_server__defaults__expected)
BOOST_REQUIRE(instance.expiration() == minutes(60));

// http_server
BOOST_REQUIRE_EQUAL(instance.server, "libbitcoin/4.0");
BOOST_REQUIRE_EQUAL(instance.server, BC_HTTP_SERVER_NAME);
BOOST_REQUIRE(instance.hosts.empty());
BOOST_REQUIRE(instance.origins.empty());
BOOST_REQUIRE(instance.host_names().empty());
Expand Down
Loading