summaryrefslogtreecommitdiff
path: root/lib/httpserver/S3Client.h
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-08-15 10:58:10 +0000
committerChris Wilson <chris+github@qwirx.com>2015-08-15 10:58:10 +0000
commit03c4946547d39d4d3c4f32878c47bbd701c6f690 (patch)
tree43180ec516f6afc81c215bb2cb120e254b0cc1e5 /lib/httpserver/S3Client.h
parentfeade829d345bd6e34f39dfc32498696e6f588a1 (diff)
Add configurable timeouts and HEAD request support to S3 client.
Allow getting the Content-Length of an HTTPResponse object.
Diffstat (limited to 'lib/httpserver/S3Client.h')
-rw-r--r--lib/httpserver/S3Client.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/httpserver/S3Client.h b/lib/httpserver/S3Client.h
index 2d3f71cf..3681213b 100644
--- a/lib/httpserver/S3Client.h
+++ b/lib/httpserver/S3Client.h
@@ -36,7 +36,8 @@ class S3Client
: mpSimulator(pSimulator),
mHostName(rHostName),
mAccessKey(rAccessKey),
- mSecretKey(rSecretKey)
+ mSecretKey(rSecretKey),
+ mNetworkTimeout(30000)
{ }
S3Client(std::string HostName, int Port, const std::string& rAccessKey,
@@ -49,9 +50,11 @@ class S3Client
{ }
HTTPResponse GetObject(const std::string& rObjectURI);
+ HTTPResponse HeadObject(const std::string& rObjectURI);
HTTPResponse PutObject(const std::string& rObjectURI,
IOStream& rStreamToSend, const char* pContentType = NULL);
void CheckResponse(const HTTPResponse& response, const std::string& message) const;
+ int GetNetworkTimeout() const { return mNetworkTimeout; }
private:
HTTPServer* mpSimulator;
@@ -59,6 +62,7 @@ class S3Client
int mPort;
std::auto_ptr<SocketStream> mapClientSocket;
std::string mAccessKey, mSecretKey;
+ int mNetworkTimeout; // milliseconds
HTTPResponse FinishAndSendRequest(HTTPRequest::Method Method,
const std::string& rRequestURI,