MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / handleRspHeader

Method handleRspHeader

lib/AsyncHttpClient/src/AsyncHttpClient.cpp:1211–1267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1209}
1210
1211bool AsyncHttpClient::handleRspHeader()
1212{
1213 bool isSuccess = true;
1214 String value;
1215
1216 /* Connection = "Connection" ":" 1#(connection-token)
1217 * connection-token = token
1218 *
1219 * HTTP/1.1 defines the "close" connection option for the sender to
1220 * signal that the connection will be closed after completion of the
1221 * response.
1222 */
1223 value = m_rsp.getHeader("Connection");
1224
1225 if (false == value.isEmpty())
1226 {
1227 /* Server closes the connection after the response? */
1228 if (0 <= value.indexOf("close"))
1229 {
1230 /* Client want a permanent connection? */
1231 if (true == m_isKeepAlive)
1232 {
1233 LOG_WARNING("Connection can not be kept-alive.");
1234 m_isKeepAlive = false;
1235 }
1236 }
1237 }
1238
1239 value = m_rsp.getHeader("Content-Length");
1240
1241 if (false == value.isEmpty())
1242 {
1243 m_contentLength = value.toInt();
1244 }
1245 else
1246 {
1247 m_contentLength = 0U;
1248 }
1249
1250 value = m_rsp.getHeader("Transfer-Encoding");
1251
1252 if (false == value.isEmpty())
1253 {
1254 /* Only IDENTITY (default) and CHUNKED transfer coding are supported. */
1255 if (0U != value.equalsIgnoreCase("chunked"))
1256 {
1257 m_transferCoding = TRANSFER_CODING_CHUNKED;
1258 }
1259 /* Unsupported transfer coding */
1260 else
1261 {
1262 isSuccess = false;
1263 }
1264 }
1265
1266 return isSuccess;
1267}
1268

Callers

nothing calls this directly

Calls 5

getHeaderMethod · 0.80
indexOfMethod · 0.80
toIntMethod · 0.80
equalsIgnoreCaseMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected