8000 Bug fix/fixes 0609 by jsteemann · Pull Request #3227 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Bug fix/fixes 0609 #3227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
c080632
do not use V8 variant of AQL functions in early optimization stage wh…
jsteemann Sep 6, 2017
358356c
added missing space in warning message
jsteemann Sep 6, 2017
b23b85f
make line-counting more efficient
jsteemann Sep 6, 2017
512f549
removed unused includes
jsteemann Sep 6, 2017
b6ebf9d
remove duplicate V8 context number control variables
jsteemann Sep 6, 2017
03ed4f8
warn when more than 90% of max mappings are in use
jsteemann Sep 6, 2017
efb3a17
added C++ variant of replication catchup
jsteemann Sep 6, 2017
cdfc90c
speed up test
jsteemann Sep 6, 2017
a6d1923
speed up test
jsteemann Sep 6, 2017
2b72b90
speed up test
jsteemann Sep 7, 2017
db9bb73
make ctor explicit
jsteemann Sep 7, 2017
7965c94
V8 macro cleanup, StringBuffer optimizations
jsteemann Sep 7, 2017
d2bbd0d
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 7, 2017
4fe6779
fix a deadlock
jsteemann Sep 7, 2017
e57e2ef
added `--log.role` option
jsteemann Sep 7, 2017
7a0151e
updated CHANGELOG
jsteemann Sep 7, 2017
024327a
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 7, 2017
92f398f
removed useless vector for authentication...
jsteemann Sep 7, 2017
cd03efb
removed non-existing scheduler.threads option from config
jsteemann Sep 7, 2017
9bc0bab
removed several occurrences of TRI_CORE_MEM_ZONE
jsteemann Sep 7, 2017
17be850
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 7, 2017
967f0e0
jslint
jsteemann Sep 7, 2017
e13bbd5
fix include order
jsteemann Sep 7, 2017
90b5915
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 7, 2017
86e29db
remove JavaScript-based replication remainders
jsteemann Sep 7, 2017
5c4aa5a
use correct database
jsteemann Sep 7, 2017
44fdadb
some fixes for replication
jsteemann Sep 7, 2017
d2f86e8
removed useless __FILE__, __LINE__ invocations
jsteemann Sep 8, 2017
f0cd8a2
micro optimizations
jsteemann Sep 8, 2017
2d3dc23
joyful colorized logs
jsteemann Sep 8, 2017
88bccfe
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 8, 2017
fbc66bd
fix typo
jsteemann Sep 8, 2017
95f13a6
port some of the non-yet-ready cluster optimization rules
jsteemann Sep 8, 2017
3bda7d0
updated CHANGELOG
jsteemann Sep 8, 2017
6140c3e
allow a priority V8 context
jsteemann Sep 8, 2017
a163c3f
use functions to generate V8 strings, so we can add error reporting t…
jsteemann Sep 8, 2017
3620043
fix assertion failure
jsteemann Sep 11, 2017
229b90d
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 11, 2017
5b217e7
updated CHANGELOG
jsteemann Sep 12, 2017
fff754c
updated CHANGELOG
jsteemann Sep 12, 2017
e3a1931
remove TRI_CORE_MEM_ZONE
jsteemann Sep 12, 2017
a6f674b
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 12, 2017
63c24f1
try to fix Windows errors & warnings
jsteemann Sep 12, 2017
f8a4832
cleanup
jsteemann Sep 12, 2017
ce160c7
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 12, 2017
aae4846
removed memory zones altogether
jsteemann Sep 13, 2017
6f1086c
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 13, 2017
4e7ba81
Merge branch 'devel' of https://github.com/arangodb/arangodb into bug…
jsteemann Sep 13, 2017
ecd866f
fix Visual Studio warnings
jsteemann Sep 13, 2017
f2ffc27
fix MSVC compile error
jsteemann Sep 13, 2017
ca29268
micro optimizations
jsteemann Sep 13, 2017
55a8c65
try to fix compile error
jsteemann Sep 13, 2017
125d126
revert some potential performance improvements. does not compile ever…
jsteemann Sep 13, 2017
f4e86b9
wait dynamically
jsteemann Sep 13, 2017
a556dcb
exclude system collections from collection tests
jsteemann Sep 13, 2017
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
Prev Previous commit
Next Next commit
removed useless vector for authentication...
there has only been a single auth value so far
  • Loading branch information
jsteemann committed Sep 7, 2017
commit 92f398f8c3e24fecf08d20189c60e77da7c8517b
42 changes: 14 additions & 28 deletions lib/SimpleHttpClient/SimpleHttpClient.cpp
10000
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ SimpleHttpClient::SimpleHttpClient(
std::unique_ptr<GeneralClientConnection>& connection,
SimpleHttpClientParams const& params)
: SimpleHttpClient(connection.get(), params) {
_deleteConnectionOnDestruction = true;
connection.release();
_deleteConnectionOnDestruction = true;
connection.release();
}

SimpleHttpClient::~SimpleHttpClient() {
Expand Down Expand Up @@ -530,28 +530,10 @@ void SimpleHttpClient::setRequest(
}

// do basic authorization
if (!_params._pathToBasicAuth.empty()) {
std::string foundPrefix;
std::string foundValue;
auto i = _params._pathToBasicAuth.begin();

for (; i != _params._pathToBasicAuth.end(); ++i) {
std::string& f = i->first;

if (l->compare(0, f.size(), f) == 0) {
// f is prefix of l
if (f.length() > foundPrefix.length()) {
foundPrefix = f;
foundValue = i->second;
}
}
}

if (!foundValue.empty()) {
_writeBuffer.appendText(TRI_CHAR_LENGTH_PAIR("Authorization: Basic "));
_writeBuffer.appendText(foundValue);
_writeBuffer.appendText(TRI_CHAR_LENGTH_PAIR("\r\n"));
}
if (!_params._basicAuth.empty()) {
_writeBuffer.appendText(TRI_CHAR_LENGTH_PAIR("Authorization: Basic "));
_writeBuffer.appendText(_params._basicAuth);
_writeBuffer.appendText(TRI_CHAR_LENGTH_PAIR("\r\n"));
}
if (!_params._jwt.empty()) {
_writeBuffer.appendText(TRI_CHAR_LENGTH_PAIR("Authorization: bearer "));
Expand Down Expand Up @@ -677,7 +659,9 @@ void SimpleHttpClient::processHeader() {
// found content-length header in response
else if (_result->hasContentLength() && _result->getContentLength() > 0) {
if (_result->getContentLength() > _params._maxPacketSize) {
setErrorMessage("Content-Length > max packet size found", true);
std::string errorMessage("ignoring HTTP response with 'Content-Length' bigger than max packet size (");
errorMessage += std::to_string(_result->getContentLength()) + " > " + std::to_string(_params._maxPacketSize) + ")";
setErrorMessage(errorMessage, true);

// reset connection
this->close();
Expand Down Expand Up @@ -801,7 +785,7 @@ void SimpleHttpClient::processChunkedHeader() {

// empty lines are an error
if (line[0] == '\r' || line.empty()) {
setErrorMessage("found invalid content-length", true);
setErrorMessage("found invalid Content-Length", true);
// reset connection
this->close();
_state = DEAD;
Expand All @@ -814,7 +798,7 @@ void SimpleHttpClient::processChunkedHeader() {
try {
contentLength = static_cast<uint32_t>(std::stol(line, nullptr, 16));
} catch (...) {
setErrorMessage("found invalid content-length", true);
setErrorMessage("found invalid Content-Length", true);
// reset connection
this->close();
_state = DEAD;
Expand All @@ -824,7 +808,9 @@ void SimpleHttpClient::processChunkedHeader() {

// failed: too many bytes
if (contentLength > _params._maxPacketSize) {
setErrorMessage("Content-Length > max packet size found!", true);
std::string errorMessage("ignoring HTTP response with 'Content-Length' bigger than max packet size (");
errorMessage += std::to_string(contentLength) + " > " + std::to_string(_params._maxPacketSize) + ")";
setErrorMessage(errorMessage, true);
// reset connection
this->close();
_state = DEAD;
Expand Down
11 changes: 5 additions & 6 deletions lib/SimpleHttpClient/SimpleHttpClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ struct SimpleHttpClientParams {
/// @brief sets username and password
////////////////////////////////////////////////////////////////////////////////

void setUserNamePassword(std::string const& prefix,
void setUserNamePassword(char const* prefix,
std::string const& username,
std::string const& password) {
std::string value =
arangodb::basics::StringUtils::encodeBase64(username + ":" + password);

_pathToBasicAuth.push_back(std::make_pair(prefix, value));
TRI_ASSERT(prefix != nullptr);
TRI_ASSERT(strcmp(prefix, "/") == 0);
_basicAuth = arangodb::basics::StringUtils::encodeBase64(username + ":" + password);
}

//////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -144,7 +143,7 @@ struct SimpleHttpClientParams {

size_t _maxPacketSize = SimpleHttpClientParams::MaxPacketSize;

std::vector<std::pair<std::string, std::string>> _pathToBasicAuth;
std::string _basicAuth;

std::string _jwt = "";

Expand Down
0