MCPcopy Create free account
hub / github.com/Barracuda09/SATPI / process

Method process

src/HttpcServer.cpp:117–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117bool 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
151void HttpcServer::processStreamingRequest(SocketClient &client) {
152 const std::string msg = client.getPercentDecodedMessage();

Callers

nothing calls this directly

Calls 1

getMessageMethod · 0.80

Tested by

no test coverage detected