Commit ea418d25b21de97a6bda4139d526d01dcf71ca8e

Authored by Moritz Wirger
1 parent ddf3333a

cleanup and add todo

hueplusplus/HttpHandler.cpp
... ... @@ -223,22 +223,22 @@ std::string HttpHandler::sendHTTPRequest(std::string method, std::string uri, st
223 223 std::string request;
224 224 // Protocol reference: https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html
225 225 // Request-Line
226   - request.append(method); // Method
227   - request.append(" "); // Separation
228   - request.append(uri); // Request-URI
229   - request.append(" "); // Separation
  226 + request.append(method); // Method
  227 + request.append(" "); // Separation
  228 + request.append(uri); // Request-URI
  229 + request.append(" "); // Separation
230 230 request.append("HTTP/1.0"); // HTTP-Version
231   - request.append("\r\n"); // Ending
  231 + request.append("\r\n"); // Ending
232 232 // Entities
233   - request.append("Content-Type:"); // entity-header
234   - request.append(" "); // Separation
235   - request.append(content_type); // media-type
236   - request.append("\r\n"); // Entity ending
237   - request.append("Content-Length:"); // entity-header
238   - request.append(" "); // Separation
  233 + request.append("Content-Type:"); // entity-header
  234 + request.append(" "); // Separation
  235 + request.append(content_type); // media-type
  236 + request.append("\r\n"); // Entity ending
  237 + request.append("Content-Length:"); // entity-header
  238 + request.append(" "); // Separation
239 239 request.append(std::to_string(body.size())); // length
240 240 request.append("\r\n\r\n"); // Entity ending & Request-Line ending
241   - request.append(body); // message-body
  241 + request.append(body); // message-body
242 242 request.append("\r\n\r\n"); // Ending
243 243  
244 244 return sendGetHTTPBody(request.c_str(), adr, port);
... ... @@ -259,6 +259,7 @@ std::string HttpHandler::PUTString(std::string uri, std::string content_type, st
259 259 return sendHTTPRequest("PUT", uri, content_type, body, adr, port);
260 260 }
261 261  
  262 +//! \todo Get rid of duplicate code in GETJson, POSTJson and PUTJson
262 263 Json::Value HttpHandler::GETJson(std::string uri, const Json::Value& body, const std::string &adr, int port)
263 264 {
264 265 std::string response = GETString(uri, "application/json", body.toStyledString(), adr, port);
... ...
hueplusplus/UPnP.cpp
... ... @@ -47,4 +47,3 @@ std::vector<std::pair<std::string, std::string>> UPnP::getDevices()
47 47 }
48 48 return devices;
49 49 }
50   -
... ...