Merge branch 'master' of
https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git
This commit is contained in:
@@ -52,10 +52,11 @@ enum CompressionType {
|
||||
|
||||
struct Request {
|
||||
std::string uri;
|
||||
boost::asio::ip::address endpoint;
|
||||
};
|
||||
|
||||
struct Reply {
|
||||
Reply() : status(ok) { content.reserve(1000000); }
|
||||
Reply() : status(ok) { content.reserve(2 << 20); }
|
||||
enum status_type {
|
||||
ok = 200,
|
||||
badRequest = 400,
|
||||
@@ -63,9 +64,9 @@ struct Reply {
|
||||
} status;
|
||||
|
||||
std::vector<Header> headers;
|
||||
std::string content;
|
||||
std::vector<boost::asio::const_buffer> toBuffers();
|
||||
std::vector<boost::asio::const_buffer> HeaderstoBuffers();
|
||||
std::string content;
|
||||
static Reply stockReply(status_type status);
|
||||
void setSize(unsigned size) {
|
||||
for (std::size_t i = 0; i < headers.size(); ++i) {
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
/// Start the first asynchronous operation for the connection.
|
||||
void start() {
|
||||
TCPsocket.async_read_some(boost::asio::buffer(incomingDataBuffer), strand.wrap( boost::bind(&Connection::handleRead, this->shared_from_this(), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)));
|
||||
TCPsocket.async_read_some(boost::asio::buffer(incomingDataBuffer), strand.wrap( boost::bind(&Connection::handleRead, this->shared_from_this(), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
// std::cout << "[debug] using deflate" << std::endl;
|
||||
// if(compressionType == noCompression)
|
||||
// std::cout << "[debug] no compression" << std::endl;
|
||||
|
||||
request.endpoint = TCPsocket.remote_endpoint().address();
|
||||
requestHandler.handle_request(request, reply);
|
||||
|
||||
Header compressionHeader;
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
void handle_request(const Request& req, Reply& rep){
|
||||
//parse command
|
||||
std::string request(req.uri);
|
||||
// INFO( "[r] " << request );
|
||||
INFO( req.endpoint.to_string() << " " << request );
|
||||
std::string command;
|
||||
std::size_t firstAmpPosition = request.find_first_of("?");
|
||||
command = request.substr(1,firstAmpPosition-1);
|
||||
|
||||
Reference in New Issue
Block a user