mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
9d48bbe32a
|
@ -210,13 +210,21 @@ Handler::status_e RestBatchHandler::execute() {
|
|||
return Handler::HANDLER_FAILED;
|
||||
}
|
||||
|
||||
HttpResponsePart* partResponse = dynamic_cast<HttpResponsePart*>(handler->getResponse());
|
||||
if (partResponse == 0) {
|
||||
delete handler;
|
||||
generateError(HttpResponse::BAD, TRI_ERROR_INTERNAL, "an error occured during part request processing");
|
||||
|
||||
return Handler::HANDLER_FAILED;
|
||||
}
|
||||
|
||||
// append the boundary for this subpart
|
||||
_response->body().appendText(boundary + "\r\n");
|
||||
|
||||
// append the response header
|
||||
handler->getResponse()->writeHeader(&_response->body());
|
||||
partResponse->writeHeader(&_response->body());
|
||||
// append the response body
|
||||
_response->body().appendText(handler->getResponse()->body());
|
||||
_response->body().appendText(partResponse->body());
|
||||
_response->body().appendText("\r\n");
|
||||
|
||||
delete handler;
|
||||
|
|
|
@ -376,15 +376,12 @@ namespace triagens {
|
|||
// MERSENNE
|
||||
struct UniformIntegerMersenne : public UniformIntegerImpl {
|
||||
int32_t random (int32_t left, int32_t right) {
|
||||
RandMT randomGenerator((uint32_t) time(NULL));
|
||||
RandMT randomGenerator((uint32_t) RandomHelper::RandomDevice::getSeed());
|
||||
|
||||
int32_t result = ((int32_t) randomGenerator.randomMT()) + left;
|
||||
|
||||
if (result > right) {
|
||||
result %= right;
|
||||
result += left;
|
||||
}
|
||||
const int32_t range = right - left + 1;
|
||||
int32_t result = ((int32_t) randomGenerator.randomMT());
|
||||
|
||||
result = (int32_t) abs(result % range) + left;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -79,7 +79,7 @@ HttpResponsePart::~HttpResponsePart () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HttpResponsePart::writeHeader (StringBuffer* output) {
|
||||
output->appendText("HTTP/1.1 ");
|
||||
output->appendText("X-Arango-status: ");
|
||||
output->appendText(responseString(_code));
|
||||
output->appendText("\r\n");
|
||||
|
||||
|
@ -108,7 +108,12 @@ void HttpResponsePart::writeHeader (StringBuffer* output) {
|
|||
}
|
||||
|
||||
char const* value = begin->_value;
|
||||
|
||||
|
||||
if (! TRI_EqualString(key, "content-type")) {
|
||||
// for all headers but content-type, we'll add the prefix "X-Arango-"
|
||||
output->appendText("X-Arango-");
|
||||
}
|
||||
|
||||
output->appendText(key);
|
||||
output->appendText(": ");
|
||||
output->appendText(value);
|
||||
|
@ -116,16 +121,16 @@ void HttpResponsePart::writeHeader (StringBuffer* output) {
|
|||
}
|
||||
|
||||
if (seenTransferEncoding && transferEncoding == "chunked") {
|
||||
output->appendText("transfer-encoding: chunked\r\n\r\n");
|
||||
output->appendText("X-Arango-transfer-encoding: chunked\r\n\r\n");
|
||||
}
|
||||
else {
|
||||
if (seenTransferEncoding) {
|
||||
output->appendText("transfer-encoding: ");
|
||||
output->appendText("X-Arango-transfer-encoding: ");
|
||||
output->appendText(transferEncoding);
|
||||
output->appendText("\r\n");
|
||||
}
|
||||
|
||||
output->appendText("content-length: ");
|
||||
output->appendText("X-Arango-content-length: ");
|
||||
|
||||
if (_isHeadResponse) {
|
||||
output->appendInteger(_bodySize);
|
||||
|
|
Loading…
Reference in New Issue