| 1333 | } |
| 1334 | |
| 1335 | bool HttpSocket::_HandleStatus |
| 1336 | ( |
| 1337 | ) |
| 1338 | { |
| 1339 | _remaining = _contentLen = safeatoi(Hdr("content-length")); |
| 1340 | |
| 1341 | const char *encoding = Hdr("transfer-encoding"); |
| 1342 | _chunkedTransfer = encoding && !STRNICMP(encoding, "chunked", 7); |
| 1343 | |
| 1344 | const char *conn = Hdr("connection"); // if its not keep-alive, server will close it, so we can too |
| 1345 | _mustClose = !conn || STRNICMP(conn, "keep-alive", 10); |
| 1346 | |
| 1347 | const bool success = IsSuccess(); |
| 1348 | |
| 1349 | if(!(_chunkedTransfer || _contentLen) && success) |
| 1350 | traceprint("_ParseHeader: Not chunked transfer and content-length==0, this will go fail"); |
| 1351 | |
| 1352 | traceprint("Got HTTP Status %d\n", _status); |
| 1353 | |
| 1354 | if(success) |
| 1355 | return true; |
| 1356 | |
| 1357 | bool forceGET = false; |
| 1358 | switch(_status) |
| 1359 | { |
| 1360 | case 303: |
| 1361 | forceGET = true; // As per spec, continue with a GET request |
| 1362 | case 301: |
| 1363 | case 302: |
| 1364 | case 307: |
| 1365 | case 308: |
| 1366 | if(_followRedir) |
| 1367 | if(const char *loc = Hdr("location")) |
| 1368 | _Redirect(loc, forceGET); |
| 1369 | return false; |
| 1370 | |
| 1371 | default: |
| 1372 | return false; |
| 1373 | } |
| 1374 | } |
| 1375 | |
| 1376 | bool HttpSocket::IsRedirecting |
| 1377 | ( |
nothing calls this directly
no test coverage detected