reformat files according to guidelines, remove superflous inclue
This commit is contained in:
		
							parent
							
								
									7b9b2fd23a
								
							
						
					
					
						commit
						db67f2ddf1
					
				| @ -25,17 +25,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| 
 | 
 | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| #ifndef BASIC_DATASTRUCTURES_H | #ifndef COMPRESSION_TYPE_H | ||||||
| #define BASIC_DATASTRUCTURES_H | #define COMPRESSION_TYPE_H | ||||||
| 
 | 
 | ||||||
| namespace http { | namespace http | ||||||
|  | { | ||||||
| 
 | 
 | ||||||
| enum CompressionType { | enum CompressionType | ||||||
|     noCompression, | { noCompression, | ||||||
|   gzipRFC1952, |   gzipRFC1952, | ||||||
|     deflateRFC1951 |   deflateRFC1951 }; | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| } // namespace http
 | } // namespace http
 | ||||||
| 
 | 
 | ||||||
| #endif //BASIC_DATASTRUCTURES_H
 | #endif // COMPRESSION_TYPE_H
 | ||||||
|  | |||||||
| @ -29,11 +29,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| 
 | 
 | ||||||
| #include "../../Util/StringUtil.h" | #include "../../Util/StringUtil.h" | ||||||
| 
 | 
 | ||||||
| namespace http { | namespace http | ||||||
|  | { | ||||||
| 
 | 
 | ||||||
| void Reply::setSize(const unsigned size) { | void Reply::setSize(const unsigned size) | ||||||
|     for ( Header& h :  headers) { | { | ||||||
|         if("Content-Length" == h.name) { |     for (Header &h : headers) | ||||||
|  |     { | ||||||
|  |         if ("Content-Length" == h.name) | ||||||
|  |         { | ||||||
|             intToString(size, h.value); |             intToString(size, h.value); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @ -50,27 +54,31 @@ void Reply::SetUncompressedSize() | |||||||
|     setSize(uncompressed_size); |     setSize(uncompressed_size); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | std::vector<boost::asio::const_buffer> Reply::toBuffers() | ||||||
| std::vector<boost::asio::const_buffer> Reply::toBuffers(){ | { | ||||||
|     std::vector<boost::asio::const_buffer> buffers; |     std::vector<boost::asio::const_buffer> buffers; | ||||||
|     buffers.push_back(ToBuffer(status)); |     buffers.push_back(ToBuffer(status)); | ||||||
|     for (const Header & h : headers) { |     for (const Header &h : headers) | ||||||
|  |     { | ||||||
|         buffers.push_back(boost::asio::buffer(h.name)); |         buffers.push_back(boost::asio::buffer(h.name)); | ||||||
|         buffers.push_back(boost::asio::buffer(seperators)); |         buffers.push_back(boost::asio::buffer(seperators)); | ||||||
|         buffers.push_back(boost::asio::buffer(h.value)); |         buffers.push_back(boost::asio::buffer(h.value)); | ||||||
|         buffers.push_back(boost::asio::buffer(crlf)); |         buffers.push_back(boost::asio::buffer(crlf)); | ||||||
|     } |     } | ||||||
|     buffers.push_back(boost::asio::buffer(crlf)); |     buffers.push_back(boost::asio::buffer(crlf)); | ||||||
|     for (const std::string & line : content) { |     for (const std::string &line : content) | ||||||
|  |     { | ||||||
|         buffers.push_back(boost::asio::buffer(line)); |         buffers.push_back(boost::asio::buffer(line)); | ||||||
|     } |     } | ||||||
|     return buffers; |     return buffers; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| std::vector<boost::asio::const_buffer> Reply::HeaderstoBuffers(){ | std::vector<boost::asio::const_buffer> Reply::HeaderstoBuffers() | ||||||
|  | { | ||||||
|     std::vector<boost::asio::const_buffer> buffers; |     std::vector<boost::asio::const_buffer> buffers; | ||||||
|     buffers.push_back(ToBuffer(status)); |     buffers.push_back(ToBuffer(status)); | ||||||
|     for (std::size_t i = 0; i < headers.size(); ++i) { |     for (std::size_t i = 0; i < headers.size(); ++i) | ||||||
|  |     { | ||||||
|         Header ¤t_header = headers[i]; |         Header ¤t_header = headers[i]; | ||||||
|         buffers.push_back(boost::asio::buffer(current_header.name)); |         buffers.push_back(boost::asio::buffer(current_header.name)); | ||||||
|         buffers.push_back(boost::asio::buffer(seperators)); |         buffers.push_back(boost::asio::buffer(seperators)); | ||||||
| @ -81,7 +89,8 @@ std::vector<boost::asio::const_buffer> Reply::HeaderstoBuffers(){ | |||||||
|     return buffers; |     return buffers; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Reply Reply::StockReply(Reply::status_type status) { | Reply Reply::StockReply(Reply::status_type status) | ||||||
|  | { | ||||||
|     Reply rep; |     Reply rep; | ||||||
|     rep.status = status; |     rep.status = status; | ||||||
|     rep.content.clear(); |     rep.content.clear(); | ||||||
| @ -100,7 +109,8 @@ Reply Reply::StockReply(Reply::status_type status) { | |||||||
|     return rep; |     return rep; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| std::string Reply::ToString(Reply::status_type status) { | std::string Reply::ToString(Reply::status_type status) | ||||||
|  | { | ||||||
|     if (Reply::ok == status) |     if (Reply::ok == status) | ||||||
|     { |     { | ||||||
|         return okHTML; |         return okHTML; | ||||||
| @ -112,7 +122,8 @@ std::string Reply::ToString(Reply::status_type status) { | |||||||
|     return internalServerErrorHTML; |     return internalServerErrorHTML; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| boost::asio::const_buffer Reply::ToBuffer(Reply::status_type status) { | boost::asio::const_buffer Reply::ToBuffer(Reply::status_type status) | ||||||
|  | { | ||||||
|     if (Reply::ok == status) |     if (Reply::ok == status) | ||||||
|     { |     { | ||||||
|         return boost::asio::buffer(okString); |         return boost::asio::buffer(okString); | ||||||
| @ -124,9 +135,5 @@ boost::asio::const_buffer Reply::ToBuffer(Reply::status_type status) { | |||||||
|     return boost::asio::buffer(badRequestString); |     return boost::asio::buffer(badRequestString); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | Reply::Reply() : status(ok) {} | ||||||
| Reply::Reply() : status(ok) { |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -28,15 +28,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #ifndef REQUEST_H | #ifndef REQUEST_H | ||||||
| #define REQUEST_H | #define REQUEST_H | ||||||
| 
 | 
 | ||||||
| #include "../../Util/StringUtil.h" |  | ||||||
| 
 |  | ||||||
| #include <boost/asio.hpp> | #include <boost/asio.hpp> | ||||||
| 
 | 
 | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| namespace http { | namespace http | ||||||
|  | { | ||||||
| 
 | 
 | ||||||
| struct Request { | struct Request | ||||||
|  | { | ||||||
|     std::string uri; |     std::string uri; | ||||||
|     std::string referrer; |     std::string referrer; | ||||||
|     std::string agent; |     std::string agent; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user