| 115 | } |
| 116 | |
| 117 | bool HttpcServer::process(SocketClient &client) { |
| 118 | std::string msg = client.getMessage(); |
| 119 | |
| 120 | // SI_LOG_DEBUG("%s HTML data from client %s: %s", client.getProtocolString().c_str(), client.getIPAddress().c_str(), msg.c_str()); |
| 121 | |
| 122 | // parse HTML |
| 123 | const std::string method = StringConverter::getMethod(msg); |
| 124 | const std::string protocol = StringConverter::getProtocol(msg); |
| 125 | if (method.empty() || protocol.empty()) { |
| 126 | SI_LOG_ERROR("Unknown Data: %s", msg.c_str()); |
| 127 | return false; |
| 128 | } |
| 129 | if (protocol == "RTSP") { |
| 130 | processStreamingRequest(client); |
| 131 | } else if (protocol == "HTTP") { |
| 132 | if (method == "GET") { |
| 133 | if (StringConverter::hasTransportParameters(client.getMessage())) { |
| 134 | processStreamingRequest(client); |
| 135 | } else { |
| 136 | methodGet(client); |
| 137 | } |
| 138 | } else if (method == "POST") { |
| 139 | methodPost(client); |
| 140 | } else { |
| 141 | SI_LOG_ERROR("Unknown HTML message: %s", msg.c_str()); |
| 142 | return false; |
| 143 | } |
| 144 | } else { |
| 145 | SI_LOG_ERROR("%s: Unknown HTML protocol: %s", protocol.c_str(), msg.c_str()); |
| 146 | return false; |
| 147 | } |
| 148 | return true; |
| 149 | } |
| 150 | |
| 151 | void HttpcServer::processStreamingRequest(SocketClient &client) { |
| 152 | const std::string msg = client.getPercentDecodedMessage(); |
nothing calls this directly
no test coverage detected