1
0
Fork 0

Add more traps for the windows bug of empty URLs

This commit is contained in:
Willi Goesgens 2015-03-27 11:14:36 +01:00
parent 9bc7ec23c6
commit 6a9f213340
3 changed files with 30 additions and 4 deletions

View File

@ -196,7 +196,22 @@ namespace triagens {
executeSingleRequest();
}
else {
executeBatchRequest(numOps);
try {
executeBatchRequest(numOps);
}
catch (triagens::basics::Exception const& ex) {
LOG_FATAL_AND_EXIT("Caught exception during test execution: %d %s",
ex.code(), ex.message());
}
catch (std::bad_alloc const&) {
LOG_FATAL_AND_EXIT("Caught OOM exception during test execution!");
}
catch (std::exception const& ex) {
LOG_FATAL_AND_EXIT("Caught STD exception during test execution: %s", ex.what());
}
catch (...) {
LOG_FATAL_AND_EXIT("Caught unknown exception during test execution!");
}
}
_operationsCounter->done(_batchSize > 0 ? _batchSize : 1);
}
@ -264,10 +279,17 @@ namespace triagens {
bool mustFree = false;
const char* payload = _operation->payload(&payloadLength, _threadNumber, threadCounter, globalCounter, &mustFree);
const rest::HttpRequest::HttpRequestType type = _operation->type(_threadNumber, threadCounter, globalCounter);
if (url.empty()) {
LOG_WARNING("URL is empty!");
}
// headline, e.g. POST /... HTTP/1.1
rest::HttpRequest::appendMethod(type, &batchPayload);
size_t oldLength = batchPayload.length();
batchPayload.appendText(url);
if (batchPayload.length() == oldLength) {
LOG_WARNING("URL nonempty empty, but nothing appended!");
}
batchPayload.appendText(" HTTP/1.1\r\n", 11);
batchPayload.appendText("\r\n", 2);

View File

@ -478,13 +478,13 @@ struct RandomShapesTest : public BenchmarkOperation {
const size_t mod = globalCounter % 3;
if (mod == 0) {
return std::string("/_api/document?collection=" + Collection);
return std::string("/_api/document?collection=") + Collection;
}
else {
size_t keyId = (size_t) (globalCounter / 3);
const std::string key = "testkey" + StringUtils::itoa(keyId);
return std::string("/_api/document/" + Collection + "/" + key);
return std::string("/_api/document/") + Collection + std::string("/") + key;
}
}

View File

@ -38,6 +38,7 @@
#define ARANGODB_BASICS_STRING_BUFFER_H 1
#include "Basics/Common.h"
#include "Basics/Exceptions.h"
#include "Basics/string-buffer.h"
#include "Zip/zip.h"
@ -511,7 +512,10 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
StringBuffer& appendText (std::string const& str) {
TRI_AppendString2StringBuffer(&_buffer, str.c_str(), str.length());
int res = TRI_AppendString2StringBuffer(&_buffer, str.c_str(), str.length());
if (res != TRI_ERROR_NO_ERROR) {
THROW_ARANGO_EXCEPTION(res);
}
return *this;
}