Skip to content

Commit

Permalink
Add Amazon SimpleDB simulator.
Browse files Browse the repository at this point in the history
Will be used for safe account locking of Amazon S3 stores.

Build now requires Boost::PropertyTree.
  • Loading branch information
qris committed Nov 29, 2015
1 parent 6cb2ccd commit a4fc33f
Show file tree
Hide file tree
Showing 8 changed files with 1,035 additions and 85 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ addons:
- libwww-perl
- xsltproc
- zlib1g-dev
- libboost-dev

before_script:
- ccache -s
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/m4/boxbackup_tests.m4
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ else
have_regex_support=no
fi

# Check for Boost PropertyTree (XML and JSON support for lib/httpserver)
AC_CHECK_HEADER([boost/property_tree/ptree.hpp],,
[AC_MSG_ERROR([[cannot find Boost::PropertyTree, try installing libboost-dev]])])

### Checks for typedefs, structures, and compiler characteristics.

AC_CHECK_TYPES([u_int8_t, u_int16_t, u_int32_t, u_int64_t])
Expand Down
3 changes: 3 additions & 0 deletions lib/httpserver/HTTPException.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ WrongContentLength 16 There was too much or not enough data in the request con
ParameterNotFound 17 An expected parameter was not found in the request.
DuplicateParameter 18 A parameter was unexpectedly duplicated in the request.
AuthenticationFailed 19 The request could not be authenticated.
S3SimulatorError 20 An unspecified error occurred in the S3Simulator.
ConditionalPutConflict 21 Conditional PutAttributes request failed because the current attribute values did not match.
ConditionalPutNotFound 22 Conditional PutAttributes request failed because the expected attribute values were not found.
1 change: 1 addition & 0 deletions lib/httpserver/HTTPResponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const char *HTTPResponse::ResponseCodeToString(int ResponseCode)
case Code_Unauthorized: return "401 Unauthorized"; break;
case Code_Forbidden: return "403 Forbidden"; break;
case Code_NotFound: return "404 Not Found"; break;
case Code_Conflict: return "409 Conflict"; break;
case Code_InternalServerError: return "500 Internal Server Error"; break;
case Code_NotImplemented: return "501 Not Implemented"; break;
default:
Expand Down
11 changes: 11 additions & 0 deletions lib/httpserver/HTTPResponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class HTTPResponse : public CollectInBufferStream
Code_Unauthorized = 401,
Code_Forbidden = 403,
Code_NotFound = 404,
Code_Conflict = 409,
Code_InternalServerError = 500,
Code_NotImplemented = 501
};
Expand Down Expand Up @@ -133,6 +134,16 @@ class HTTPResponse : public CollectInBufferStream
mHeaders.SetContentLength(GetSize());
}

// Clear all state for reading again
void Reset()
{
CollectInBufferStream::Reset();
mHeaders = HTTPHeaders();
mResponseCode = HTTPResponse::Code_NoContent;
mResponseIsDynamicContent = true;
mpStreamToSendTo = NULL;
}

private:
int mResponseCode;
bool mResponseIsDynamicContent;
Expand Down
Loading

0 comments on commit a4fc33f

Please sign in to comment.