From ea418d25b21de97a6bda4139d526d01dcf71ca8e Mon Sep 17 00:00:00 2001 From: Moritz Wirger Date: Sun, 15 Oct 2017 03:29:25 +0200 Subject: [PATCH] cleanup and add todo --- hueplusplus/HttpHandler.cpp | 25 +++++++++++++------------ hueplusplus/UPnP.cpp | 1 - 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hueplusplus/HttpHandler.cpp b/hueplusplus/HttpHandler.cpp index bd9f0e5..53994c5 100755 --- a/hueplusplus/HttpHandler.cpp +++ b/hueplusplus/HttpHandler.cpp @@ -223,22 +223,22 @@ std::string HttpHandler::sendHTTPRequest(std::string method, std::string uri, st std::string request; // Protocol reference: https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html // Request-Line - request.append(method); // Method - request.append(" "); // Separation - request.append(uri); // Request-URI - request.append(" "); // Separation + request.append(method); // Method + request.append(" "); // Separation + request.append(uri); // Request-URI + request.append(" "); // Separation request.append("HTTP/1.0"); // HTTP-Version - request.append("\r\n"); // Ending + request.append("\r\n"); // Ending // Entities - request.append("Content-Type:"); // entity-header - request.append(" "); // Separation - request.append(content_type); // media-type - request.append("\r\n"); // Entity ending - request.append("Content-Length:"); // entity-header - request.append(" "); // Separation + request.append("Content-Type:"); // entity-header + request.append(" "); // Separation + request.append(content_type); // media-type + request.append("\r\n"); // Entity ending + request.append("Content-Length:"); // entity-header + request.append(" "); // Separation request.append(std::to_string(body.size())); // length request.append("\r\n\r\n"); // Entity ending & Request-Line ending - request.append(body); // message-body + request.append(body); // message-body request.append("\r\n\r\n"); // Ending return sendGetHTTPBody(request.c_str(), adr, port); @@ -259,6 +259,7 @@ std::string HttpHandler::PUTString(std::string uri, std::string content_type, st return sendHTTPRequest("PUT", uri, content_type, body, adr, port); } +//! \todo Get rid of duplicate code in GETJson, POSTJson and PUTJson Json::Value HttpHandler::GETJson(std::string uri, const Json::Value& body, const std::string &adr, int port) { std::string response = GETString(uri, "application/json", body.toStyledString(), adr, port); diff --git a/hueplusplus/UPnP.cpp b/hueplusplus/UPnP.cpp index 0c41736..aad5b0c 100755 --- a/hueplusplus/UPnP.cpp +++ b/hueplusplus/UPnP.cpp @@ -47,4 +47,3 @@ std::vector> UPnP::getDevices() } return devices; } - -- libgit2 0.21.4