[Box Backup-commit] COMMIT r3634 - in box/trunk: lib/backupstore lib/common lib/httpserver test/httpserver

subversion at boxbackup.org subversion at boxbackup.org
Sat Aug 29 09:46:22 BST 2015


Author: chris
Date: 2015-08-29 08:46:22 +0000 (Sat, 29 Aug 2015)
New Revision: 3634

Modified:
   box/trunk/lib/backupstore/BackupStoreFile.cpp
   box/trunk/lib/common/CollectInBufferStream.h
   box/trunk/lib/httpserver/HTTPRequest.cpp
   box/trunk/lib/httpserver/HTTPRequest.h
   box/trunk/lib/httpserver/HTTPResponse.cpp
   box/trunk/lib/httpserver/HTTPResponse.h
   box/trunk/lib/httpserver/HTTPServer.cpp
   box/trunk/lib/httpserver/S3Client.cpp
   box/trunk/lib/httpserver/S3Simulator.cpp
   box/trunk/test/httpserver/testhttpserver.cpp
Log:
Whitespace, import order and comment fixes

Modified: box/trunk/lib/backupstore/BackupStoreFile.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreFile.cpp	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/lib/backupstore/BackupStoreFile.cpp	2015-08-29 08:46:22 UTC (rev 3634)
@@ -22,29 +22,30 @@
 	#include <stdio.h>
 #endif
 
+#include "BackupClientFileAttributes.h"
+#include "BackupStoreConstants.h"
+#include "BackupStoreException.h"
 #include "BackupStoreFile.h"
+#include "BackupStoreFileCryptVar.h"
+#include "BackupStoreFileEncodeStream.h"
 #include "BackupStoreFileWire.h"
-#include "BackupStoreFileCryptVar.h"
 #include "BackupStoreFilename.h"
-#include "BackupStoreException.h"
-#include "IOStream.h"
-#include "Guards.h"
-#include "FileModificationTime.h"
-#include "FileStream.h"
-#include "BackupClientFileAttributes.h"
+#include "BackupStoreInfo.h"
 #include "BackupStoreObjectMagic.h"
-#include "Compress.h"
+#include "CipherAES.h"
+#include "CipherBlowfish.h"
 #include "CipherContext.h"
-#include "CipherBlowfish.h"
-#include "CipherAES.h"
-#include "BackupStoreConstants.h"
 #include "CollectInBufferStream.h"
-#include "RollingChecksum.h"
+#include "Compress.h"
+#include "FileModificationTime.h"
+#include "FileStream.h"
+#include "Guards.h"
+#include "IOStream.h"
+#include "Logging.h"
 #include "MD5Digest.h"
+#include "Random.h"
 #include "ReadGatherStream.h"
-#include "Random.h"
-#include "BackupStoreFileEncodeStream.h"
-#include "Logging.h"
+#include "RollingChecksum.h"
 
 #include "MemLeakFindOn.h"
 

Modified: box/trunk/lib/common/CollectInBufferStream.h
===================================================================
--- box/trunk/lib/common/CollectInBufferStream.h	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/lib/common/CollectInBufferStream.h	2015-08-29 08:46:22 UTC (rev 3634)
@@ -54,9 +54,9 @@
 	virtual bool StreamClosed();
 
 	void SetForReading();
-	
+
 	void Reset();
-	
+
 	void *GetBuffer() const;
 	int GetSize() const;
 	bool IsSetForReading() const {return !mInWritePhase;}

Modified: box/trunk/lib/httpserver/HTTPRequest.cpp
===================================================================
--- box/trunk/lib/httpserver/HTTPRequest.cpp	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/lib/httpserver/HTTPRequest.cpp	2015-08-29 08:46:22 UTC (rev 3634)
@@ -137,7 +137,7 @@
 	// Check caller's logic
 	if(mMethod != Method_UNINITIALISED)
 	{
-		THROW_EXCEPTION(HTTPException, RequestAlreadyBeenRead)
+		THROW_EXCEPTION(HTTPException, RequestAlreadyBeenRead);
 	}
 
 	// Read the first line, which is of a different format to the rest of the lines
@@ -152,8 +152,8 @@
 	// Check the method
 	size_t p = 0;	// current position in string
 	p = requestLine.find(' '); // end of first word
-	
-	if (p == std::string::npos)
+
+	if(p == std::string::npos)
 	{
 		// No terminating space, looks bad
 		p = requestLine.size();
@@ -189,7 +189,7 @@
 	{
 		++p;
 	}
-	
+
 	// Check there's a URI following...
 	if(requestLinePtr[p] == '\0')
 	{
@@ -196,7 +196,7 @@
 		// Didn't get the request line, probably end of connection which had been kept alive
 		return false;
 	}
-	
+
 	// Read the URI, unescaping any %XX hex codes
 	while(requestLinePtr[p] != ' ' && requestLinePtr[p] != '\0')
 	{
@@ -227,10 +227,10 @@
 			{
 				code[1] = requestLinePtr[++p];
 			}
-			
+
 			// Convert into a char code
 			long c = ::strtol(code, NULL, 16);
-			
+
 			// Accept it?
 			if(c > 0 && c <= 255)
 			{
@@ -269,7 +269,7 @@
 			{
 				THROW_EXCEPTION(HTTPException, BadRequest)		
 			}
-			
+
 			// Store version
 			mHTTPVersion = (major * HTTPVersion__MajorMultiplier) + minor;
 		}
@@ -279,16 +279,16 @@
 			THROW_EXCEPTION(HTTPException, BadRequest)		
 		}
 	}
-	
+
 	BOX_TRACE("HTTPRequest: method=" << mMethod << ", uri=" <<
 		mRequestURI << ", version=" << mHTTPVersion);
-	
+
 	// If HTTP 1.1 or greater, assume keep-alive
 	if(mHTTPVersion >= HTTPVersion_1_1)
 	{
 		mClientKeepAliveRequested = true;
 	}
-	
+
 	// Decode query string?
 	if((mMethod == Method_GET || mMethod == Method_HEAD) && !mQueryString.empty())
 	{
@@ -296,19 +296,19 @@
 		decoder.DecodeChunk(mQueryString.c_str(), mQueryString.size());
 		decoder.Finish();
 	}
-	
+
 	// Now parse the headers
 	ParseHeaders(rGetLine, Timeout);
-	
+
 	std::string expected;
-	if (GetHeader("Expect", &expected))
+	if(GetHeader("Expect", &expected))
 	{
-		if (expected == "100-continue")
+		if(expected == "100-continue")
 		{
 			mExpectContinue = true;
 		}
 	}
-	
+
 	// Parse form data?
 	if(mMethod == Method_POST && mContentLength >= 0)
 	{
@@ -315,9 +315,9 @@
 		// Too long? Don't allow people to be nasty by sending lots of data
 		if(mContentLength > MAX_CONTENT_SIZE)
 		{
-			THROW_EXCEPTION(HTTPException, POSTContentTooLong)
+			THROW_EXCEPTION(HTTPException, POSTContentTooLong);
 		}
-	
+
 		// Some data in the request to follow, parsing it bit by bit
 		HTTPQueryDecoder decoder(mQuery);
 		// Don't forget any data left in the GetLine object
@@ -362,7 +362,7 @@
 		SetForReading();
 		mpStreamToReadFrom = &(rGetLine.GetUnderlyingStream());
 	}
-	
+
 	return true;
 }
 
@@ -372,7 +372,7 @@
 	
 	CopyStreamTo(rStreamToWriteTo);
 	IOStream::pos_type bytesCopied = GetSize();
-	
+
 	while (bytesCopied < mContentLength)
 	{
 		char buffer[1024];
@@ -471,7 +471,7 @@
 	{
 		oss << i->first << ": " << i->second << "\n";
 	}
-	
+
 	if (ExpectContinue)
 	{
 		oss << "Expect: 100-continue\n";
@@ -487,14 +487,13 @@
 	IOStream* pStreamToSend, HTTPResponse& rResponse)
 {
 	IOStream::pos_type size = pStreamToSend->BytesLeftToRead();
-	
 	if (size != IOStream::SizeOfStreamUnknown)
 	{
 		mContentLength = size;
 	}
-	
+
 	Send(rStreamToSendTo, Timeout, true);
-	
+
 	rResponse.Receive(rStreamToSendTo, Timeout);
 	if (rResponse.GetResponseCode() != 100)
 	{
@@ -501,9 +500,9 @@
 		// bad response, abort now
 		return;
 	}
-	
+
 	pStreamToSend->CopyStreamTo(rStreamToSendTo, Timeout);
-	
+
 	// receive the final response
 	rResponse.Receive(rStreamToSendTo, Timeout);
 }
@@ -528,13 +527,13 @@
 			THROW_EXCEPTION(HTTPException, BadRequest)		
 		}
 
-		std::string currentLine;	
+		std::string currentLine;
 		if(!rGetLine.GetLine(currentLine, false /* no preprocess */, Timeout))
 		{
 			// Timeout
 			THROW_EXCEPTION(HTTPException, RequestReadFailed)
 		}
-		
+
 		// Is this a continuation of the previous line?
 		bool processHeader = haveHeader;
 		if(!currentLine.empty() && (currentLine[0] == ' ' || currentLine[0] == '\t'))
@@ -543,7 +542,7 @@
 			processHeader = false;
 		}
 		//TRACE3("%d:%d:%s\n", processHeader, haveHeader, currentLine.c_str());
-		
+
 		// Parse the header -- this will actually process the header
 		// from the previous run around the loop.
 		if(processHeader)
@@ -564,7 +563,7 @@
 
 			std::string header_name(ToLowerCase(std::string(h,
 				p)));
-			
+
 			if (header_name == "content-length")
 			{
 				// Decode number
@@ -582,7 +581,7 @@
 			{
 				// Store host header
 				mHostName = h + dataStart;
-				
+
 				// Is there a port number to split off?
 				std::string::size_type colon = mHostName.find_first_of(':');
 				if(colon != std::string::npos)
@@ -589,10 +588,10 @@
 				{
 					// There's a port in the string... attempt to turn it into an int
 					mHostPort = ::strtol(mHostName.c_str() + colon + 1, 0, 10);
-					
+
 					// Truncate the string to just the hostname
 					mHostName = mHostName.substr(0, colon);
-					
+
 					BOX_TRACE("Host: header, hostname = " <<
 						"'" << mHostName << "', host "
 						"port = " << mHostPort);
@@ -622,7 +621,7 @@
 				mExtraHeaders.push_back(Header(header_name,
 					h + dataStart));
 			}
-			
+
 			// Unset have header flag, as it's now been processed
 			haveHeader = false;
 		}
@@ -643,7 +642,7 @@
 		{
 			// All done!
 			break;
-		}		
+		}
 	}
 }
 
@@ -662,13 +661,13 @@
 	const char *pos = data;
 	const char *itemStart = pos;
 	std::string name;
-	
+
 	enum
 	{
 		s_NAME, s_VALUE, s_VALUE_QUOTED, s_FIND_NEXT_NAME
 	} state = s_NAME;
 
-	do	
+	do
 	{
 		switch(state)
 		{
@@ -691,7 +690,7 @@
 				}
 			}
 			break;
-		
+
 		case s_VALUE:
 			{
 				if(*pos == ';' || *pos == ',' || *pos == '\0')
@@ -705,7 +704,7 @@
 				}
 			}
 			break;
-		
+
 		case s_VALUE_QUOTED:
 			{
 				if(*pos == '"')
@@ -719,7 +718,7 @@
 				}
 			}
 			break;
-		
+
 		case s_FIND_NEXT_NAME:
 			{
 				// Skip over terminators and white space to get to the next name
@@ -731,7 +730,7 @@
 				}
 			}
 			break;
-		
+
 		default:
 			// Ooops
 			THROW_EXCEPTION(HTTPException, Internal)
@@ -758,7 +757,7 @@
 	{
 		return false;
 	}
-	
+
 	// See if it's there
 	CookieJar_t::const_iterator v(mpCookies->find(std::string(CookieName)));
 	if(v != mpCookies->end())
@@ -767,7 +766,7 @@
 		rValueOut = v->second;
 		return true;
 	}
-	
+
 	return false;
 }
 
@@ -790,7 +789,7 @@
 	{
 		return noCookie;
 	}
-	
+
 	// See if it's there
 	CookieJar_t::const_iterator v(mpCookies->find(std::string(CookieName)));
 	if(v != mpCookies->end())
@@ -798,7 +797,7 @@
 		// Return the value
 		return v->second;
 	}
-	
+
 	return noCookie;
 }
 

Modified: box/trunk/lib/httpserver/HTTPRequest.h
===================================================================
--- box/trunk/lib/httpserver/HTTPRequest.h	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/lib/httpserver/HTTPRequest.h	2015-08-29 08:46:22 UTC (rev 3634)
@@ -3,7 +3,7 @@
 // File
 //		Name:    HTTPRequest.h
 //		Purpose: Request object for HTTP connections
-//		Created: 26/3/04
+//		Created: 26/3/2004
 //
 // --------------------------------------------------------------------------
 
@@ -23,8 +23,12 @@
 //
 // Class
 //		Name:    HTTPRequest
-//		Purpose: Request object for HTTP connections
-//		Created: 26/3/04
+//		Purpose: Request object for HTTP connections. Although it
+//			 inherits from CollectInBufferStream, not all of the
+//			 request data is held in memory, only the beginning.
+//			 Use ReadContent() to write it all (including the
+//			 buffered beginning) to another stream, e.g. a file.
+//		Created: 26/3/2004
 //
 // --------------------------------------------------------------------------
 class HTTPRequest : public CollectInBufferStream

Modified: box/trunk/lib/httpserver/HTTPResponse.cpp
===================================================================
--- box/trunk/lib/httpserver/HTTPResponse.cpp	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/lib/httpserver/HTTPResponse.cpp	2015-08-29 08:46:22 UTC (rev 3634)
@@ -138,8 +138,7 @@
 // Function
 //		Name:    HTTPResponse::Send(IOStream &, bool)
 //		Purpose: Build the response, and send via the stream.
-//			 Optionally omitting the content.
-//		Created: 26/3/04
+//		Created: 26/3/2004
 //
 // --------------------------------------------------------------------------
 void HTTPResponse::Send(bool OmitContent)
@@ -184,6 +183,7 @@
 			// static is allowed to be cached for a day
 			header += "\r\nCache-Control: max-age=86400";
 		}
+
 		if(mKeepAlive)
 		{
 			header += "\r\nConnection: keep-alive\r\n\r\n";
@@ -192,6 +192,7 @@
 		{
 			header += "\r\nConnection: close\r\n\r\n";
 		}
+
 		// NOTE: header ends with blank line in all cases
 
 		// Write to stream

Modified: box/trunk/lib/httpserver/HTTPResponse.h
===================================================================
--- box/trunk/lib/httpserver/HTTPResponse.h	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/lib/httpserver/HTTPResponse.h	2015-08-29 08:46:22 UTC (rev 3634)
@@ -129,7 +129,7 @@
 	};
 
 	static const char *ResponseCodeToString(int ResponseCode);
-	
+
 	void WriteStringDefang(const char *String, unsigned int StringLen);
 	void WriteStringDefang(const std::string &rString) {WriteStringDefang(rString.c_str(), rString.size());}
 
@@ -167,7 +167,7 @@
 	std::vector<Header> mExtraHeaders;
 	int64_t mContentLength; // only used when reading response from stream
 	IOStream* mpStreamToSendTo; // nonzero only when constructed with a stream
-	
+
 	static std::string msDefaultURIPrefix;
 
 	void ParseHeaders(IOStreamGetLine &rGetLine, int Timeout);

Modified: box/trunk/lib/httpserver/HTTPServer.cpp
===================================================================
--- box/trunk/lib/httpserver/HTTPServer.cpp	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/lib/httpserver/HTTPServer.cpp	2015-08-29 08:46:22 UTC (rev 3634)
@@ -86,7 +86,7 @@
 			0
 		}
 	};
-	
+
 	static ConfigurationVerifyKey verifyrootkeys[] = 
 	{
 		HTTPSERVER_VERIFY_ROOT_KEYS
@@ -150,10 +150,10 @@
 			// Didn't get request, connection probably closed.
 			break;
 		}
-	
+
 		// Generate a response
 		HTTPResponse response(apConn.get());
-		
+
 		try
 		{
 			Handle(request, response);

Modified: box/trunk/lib/httpserver/S3Client.cpp
===================================================================
--- box/trunk/lib/httpserver/S3Client.cpp	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/lib/httpserver/S3Client.cpp	2015-08-29 08:46:22 UTC (rev 3634)
@@ -130,7 +130,7 @@
 	{
 		request.AddHeader("Content-Type", pStreamContentType);
 	}
-	
+
 	std::string s3suffix = ".s3.amazonaws.com";
 	std::string bucket;
 	if (mHostName.size() > s3suffix.size())
@@ -143,18 +143,18 @@
 				s3suffix.size());
 		}
 	}
-	
+
 	std::ostringstream data;
 	data << request.GetVerb() << "\n";
 	data << "\n"; /* Content-MD5 */
 	data << request.GetContentType() << "\n";
 	data << date.str() << "\n";
-		
+
 	if (! bucket.empty())
 	{
 		data << "/" << bucket;
 	}
-	
+
 	data << request.GetRequestURI();
 	std::string data_string = data.str();
 
@@ -165,7 +165,7 @@
 		(const unsigned char*)data_string.c_str(),
 		data_string.size(), digest_buffer, &digest_size);
 	std::string digest((const char *)digest_buffer, digest_size);
-	
+
 	base64::encoder encoder;
 	std::string auth_code = "AWS " + mAccessKey + ":" +
 		encoder.encode(digest);

Modified: box/trunk/lib/httpserver/S3Simulator.cpp
===================================================================
--- box/trunk/lib/httpserver/S3Simulator.cpp	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/lib/httpserver/S3Simulator.cpp	2015-08-29 08:46:22 UTC (rev 3634)
@@ -40,12 +40,12 @@
 // --------------------------------------------------------------------------
 const ConfigurationVerify* S3Simulator::GetConfigVerify() const
 {
-	static ConfigurationVerifyKey verifyserverkeys[] = 
+	static ConfigurationVerifyKey verifyserverkeys[] =
 	{
 		HTTPSERVER_VERIFY_SERVER_KEYS(ConfigurationVerifyKey::NoDefaultValue) // no default addresses
 	};
 
-	static ConfigurationVerify verifyserver[] = 
+	static ConfigurationVerify verifyserver[] =
 	{
 		{
 			"Server",
@@ -55,8 +55,8 @@
 			0
 		}
 	};
-	
-	static ConfigurationVerifyKey verifyrootkeys[] = 
+
+	static ConfigurationVerifyKey verifyrootkeys[] =
 	{
 		ConfigurationVerifyKey("AccessKey", ConfigTest_Exists),
 		ConfigurationVerifyKey("SecretKey", ConfigTest_Exists),
@@ -99,11 +99,11 @@
 		const Configuration& rConfig(GetConfiguration());
 		std::string access_key = rConfig.GetKeyValue("AccessKey");
 		std::string secret_key = rConfig.GetKeyValue("SecretKey");
-		
+
 		std::string md5, date, bucket;
 		rRequest.GetHeader("content-md5", &md5);
 		rRequest.GetHeader("date", &date);
-		
+
 		std::string host = rRequest.GetHostName();
 		std::string s3suffix = ".s3.amazonaws.com";
 		if (host.size() > s3suffix.size())
@@ -116,7 +116,7 @@
 					s3suffix.size());
 			}
 		}
-		
+
 		std::ostringstream data;
 		data << rRequest.GetVerb() << "\n";
 		data << md5 << "\n";
@@ -127,7 +127,7 @@
 
 		std::vector<HTTPRequest::Header> headers = rRequest.GetHeaders();
                 std::sort(headers.begin(), headers.end());
-		
+
 		for (std::vector<HTTPRequest::Header>::iterator
 			i = headers.begin(); i != headers.end(); i++)
 		{
@@ -135,13 +135,13 @@
 			{
 				data << i->first << ":" << i->second << "\n";
 			}
-		}		
-		
+		}
+
 		if (! bucket.empty())
 		{
 			data << "/" << bucket;
 		}
-		
+
 		data << rRequest.GetRequestURI();
 		std::string data_string = data.str();
 
@@ -152,17 +152,17 @@
 			(const unsigned char*)data_string.c_str(),
 			data_string.size(), digest_buffer, &digest_size);
 		std::string digest((const char *)digest_buffer, digest_size);
-		
+
 		base64::encoder encoder;
 		std::string expectedAuth = "AWS " + access_key + ":" +
 			encoder.encode(digest);
-		
+
 		if (expectedAuth[expectedAuth.size() - 1] == '\n')
 		{
 			expectedAuth = expectedAuth.substr(0,
 				expectedAuth.size() - 1);
 		}
-		
+
 		std::string actualAuth;
 		if (!rRequest.GetHeader("authorization", &actualAuth) ||
 			actualAuth != expectedAuth)
@@ -170,7 +170,7 @@
 			rResponse.SetResponseCode(HTTPResponse::Code_Unauthorized);
 			SendInternalErrorResponse("Authentication Failed",
 				rResponse);
-		}	
+		}
 		else if (rRequest.GetMethod() == HTTPRequest::Method_GET)
 		{
 			HandleGet(rRequest, rResponse);
@@ -198,7 +198,7 @@
 	{
 		SendInternalErrorResponse("Unknown exception", rResponse);
 	}
-	
+
 	if (rResponse.GetResponseCode() != 200 &&
 		rResponse.GetSize() == 0)
 	{

Modified: box/trunk/test/httpserver/testhttpserver.cpp
===================================================================
--- box/trunk/test/httpserver/testhttpserver.cpp	2015-08-29 08:46:09 UTC (rev 3633)
+++ box/trunk/test/httpserver/testhttpserver.cpp	2015-08-29 08:46:22 UTC (rev 3634)
@@ -136,7 +136,7 @@
 		TestWebServer server;
 		return server.Main("doesnotexist", argc - 1, argv + 1);
 	}
-	
+
 	if(argc >= 2 && ::strcmp(argv[1], "s3server") == 0)
 	{
 		// Run a server
@@ -145,7 +145,7 @@
 	}
 
 	TEST_THAT(system("rm -rf *.memleaks") == 0);
-	
+
 	// Start the server
 	int pid = LaunchServer("./_test server testfiles/httpserver.conf", "testfiles/httpserver.pid");
 	TEST_THAT(pid != -1 && pid != 0);
@@ -200,7 +200,7 @@
 
 		HTTPResponse response;
 		response.Receive(sock, SHORT_TIMEOUT);
-		
+
 		TEST_THAT(response.GetResponseCode() == HTTPResponse::Code_OK);
 		TEST_THAT(response.GetContentType() == "text/html");
 
@@ -257,16 +257,16 @@
 		request.AddHeader("date", "Tue, 27 Mar 2007 19:36:42 +0000");
 		request.AddHeader("authorization",
 			"AWS 0PN5J17HBGZHT7JJ3X82:xXjDGYUmKxnwqr5KXNPGldn5LbA=");
-		
+
 		S3Simulator simulator;
 		simulator.Configure("testfiles/s3simulator.conf");
-		
+
 		CollectInBufferStream response_buffer;
 		HTTPResponse response(&response_buffer);
-		
+
 		simulator.Handle(request, response);
 		TEST_EQUAL(200, response.GetResponseCode());
-		
+
 		std::string response_data((const char *)response.GetBuffer(),
 			response.GetSize());
 		TEST_EQUAL("omgpuppies!\n", response_data);
@@ -280,16 +280,16 @@
 		request.AddHeader("date", "Tue, 27 Mar 2007 19:36:42 +0000");
 		request.AddHeader("authorization",
 			"AWS 0PN5J17HBGZHT7JJ3X82:xXjDGYUmKxnwqr5KXNPGldn5LbB=");
-		
+
 		S3Simulator simulator;
 		simulator.Configure("testfiles/s3simulator.conf");
-		
+
 		CollectInBufferStream response_buffer;
 		HTTPResponse response(&response_buffer);
-		
+
 		simulator.Handle(request, response);
 		TEST_EQUAL(401, response.GetResponseCode());
-		
+
 		std::string response_data((const char *)response.GetBuffer(),
 			response.GetSize());
 		TEST_EQUAL("<html><head>"
@@ -301,7 +301,7 @@
 			"</html>\n", response_data);
 	}
 
-	// S3Client tests
+	// S3Client tests with S3Simulator in-process server for debugging
 	{
 		S3Simulator simulator;
 		simulator.Configure("testfiles/s3simulator.conf");
@@ -336,13 +336,13 @@
 	}
 
 	{
-		HTTPRequest request(HTTPRequest::Method_PUT,
-			"/newfile");
+		HTTPRequest request(HTTPRequest::Method_PUT, "/newfile");
 		request.SetHostName("quotes.s3.amazonaws.com");
 		request.AddHeader("date", "Wed, 01 Mar  2006 12:00:00 GMT");
-		request.AddHeader("authorization", "AWS 0PN5J17HBGZHT7JJ3X82:XtMYZf0hdOo4TdPYQknZk0Lz7rw=");
+		request.AddHeader("authorization",
+			"AWS 0PN5J17HBGZHT7JJ3X82:XtMYZf0hdOo4TdPYQknZk0Lz7rw=");
 		request.AddHeader("Content-Type", "text/plain");
-		
+
 		FileStream fs("testfiles/testrequests.pl");
 		fs.CopyStreamTo(request);
 		request.SetForReading();
@@ -349,13 +349,14 @@
 
 		CollectInBufferStream response_buffer;
 		HTTPResponse response(&response_buffer);
-		
+
 		S3Simulator simulator;
 		simulator.Configure("testfiles/s3simulator.conf");
 		simulator.Handle(request, response);
-		
+
 		TEST_EQUAL(200, response.GetResponseCode());
-		TEST_EQUAL("LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7", response.GetHeaderValue("x-amz-id-2"));
+		TEST_EQUAL("LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7",
+			response.GetHeaderValue("x-amz-id-2"));
 		TEST_EQUAL("F2A8CCCA26B4B26D", response.GetHeaderValue("x-amz-request-id"));
 		TEST_EQUAL("Wed, 01 Mar  2006 12:00:00 GMT", response.GetHeaderValue("Date"));
 		TEST_EQUAL("Sun, 1 Jan 2006 12:00:00 GMT", response.GetHeaderValue("Last-Modified"));




More information about the Boxbackup-commit mailing list