1
0
Fork 0

added option `--server.hide-product-header`

This commit is contained in:
Jan Steemann 2015-11-10 10:27:59 +01:00
parent 1506a6cd4a
commit e321c9747a
7 changed files with 35 additions and 3 deletions

View File

@ -1,6 +1,10 @@
v2.8.0 (XXXX-XX-XX)
-------------------
* added startup option `--server.hide-product-header` to make the server not send
the HTTP response header `"Server: ArangoDB"` in its HTTP responses. By default,
the option is turned off so the header is still sent as usual.
* added new AQL function `UNSET_RECURSIVE` to recursively unset attritutes from
objects/documents

View File

@ -32,6 +32,10 @@
@startDocuBlock serverDefaultApi
!SUBSECTION Hide Product header
@startDocuBlock serverHideProductHeader
!SUBSECTION Allow method override
@startDocuBlock serverAllowMethod

View File

@ -156,7 +156,7 @@ describe ArangoDB do
# run a HTTP HEAD query on the existing document, with wrong precondition
cmd = "/_api/document/" + did
doc = ArangoDB.log_head("#{prefix}-head-check-documentq", cmd, :header => { :"if-match" => "1" })
doc = ArangoDB.log_head("#{prefix}-head-check-document", cmd, :header => { :"if-match" => "1" })
doc.code.should eq(200)
doc.response.body.should be_nil

View File

@ -601,6 +601,7 @@ void ArangoServer::buildApplicationServer () {
("server.allow-use-database", &ALLOW_USE_DATABASE_IN_REST_ACTIONS, "allow change of database in REST actions, only needed for unittests")
("server.threads", &_dispatcherThreads, "number of threads for basic operations")
("server.additional-threads", &_additionalThreads, "number of threads in additional queues")
("server.hide-product-header", &HttpResponse::HideProductHeader, "do not expose \"Server: ArangoDB\" header in HTTP responses")
("server.foxx-queues", &_foxxQueues, "enable Foxx queues")
("server.foxx-queues-poll-interval", &_foxxQueuesPollInterval, "Foxx queue manager poll interval (in seconds)")
("server.session-timeout", &VocbaseContext::ServerSessionTtl, "timeout of web interface server sessions (in seconds)")

View File

@ -47,6 +47,12 @@ using namespace std;
std::string const HttpResponse::BatchErrorHeader = "X-Arango-Errors";
////////////////////////////////////////////////////////////////////////////////
/// @brief hide header "Server: ArangoDB" in HTTP responses
////////////////////////////////////////////////////////////////////////////////
bool HttpResponse::HideProductHeader = false;
////////////////////////////////////////////////////////////////////////////////
/// @brief http response string
////////////////////////////////////////////////////////////////////////////////
@ -266,7 +272,9 @@ HttpResponse::HttpResponse (HttpResponseCode code,
_bodySize(0),
_freeables() {
if (! HideProductHeader) {
_headers.insert(TRI_CHAR_LENGTH_PAIR("server"), "ArangoDB");
}
_headers.insert(TRI_CHAR_LENGTH_PAIR("connection"), "Keep-Alive");
_headers.insert(TRI_CHAR_LENGTH_PAIR("content-type"), "text/plain; charset=utf-8");
}

View File

@ -453,6 +453,21 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
static std::string const BatchErrorHeader;
////////////////////////////////////////////////////////////////////////////////
/// @brief hide the "Server: ArangoDB" header in HTTP responses
/// @startDocuBlock serverHideProductHeader
/// `--server.hide-product-header`
///
/// If *true*, the server will exclude the HTTP header "Server: ArangoDB" in
/// HTTP responses. If set to *false*, the server will send the header in
/// responses.
///
/// The default is *false*.
/// @endDocuBlock
////////////////////////////////////////////////////////////////////////////////
static bool HideProductHeader;
};
}
}