| 1421 | } |
| 1422 | |
| 1423 | request_rec *ap_read_request(conn_rec *conn) |
| 1424 | { |
| 1425 | int access_status; |
| 1426 | apr_bucket_brigade *tmp_bb; |
| 1427 | |
| 1428 | request_rec *r = ap_create_request(conn); |
| 1429 | |
| 1430 | tmp_bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); |
| 1431 | conn->keepalive = AP_CONN_UNKNOWN; |
| 1432 | |
| 1433 | ap_run_pre_read_request(r, conn); |
| 1434 | |
| 1435 | /* Get the request... */ |
| 1436 | if (!read_request_line(r, tmp_bb) || !ap_parse_request_line(r)) { |
| 1437 | apr_brigade_cleanup(tmp_bb); |
| 1438 | switch (r->status) { |
| 1439 | case HTTP_REQUEST_URI_TOO_LARGE: |
| 1440 | case HTTP_BAD_REQUEST: |
| 1441 | case HTTP_VERSION_NOT_SUPPORTED: |
| 1442 | case HTTP_NOT_IMPLEMENTED: |
| 1443 | if (r->status == HTTP_REQUEST_URI_TOO_LARGE) { |
| 1444 | ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00565) |
| 1445 | "request failed: client's request-line exceeds LimitRequestLine (longer than %d)", |
| 1446 | r->server->limit_req_line); |
| 1447 | } |
| 1448 | else if (r->method == NULL) { |
| 1449 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00566) |
| 1450 | "request failed: malformed request line"); |
| 1451 | } |
| 1452 | access_status = r->status; |
| 1453 | goto die_unusable_input; |
| 1454 | |
| 1455 | case HTTP_REQUEST_TIME_OUT: |
| 1456 | /* Just log, no further action on this connection. */ |
| 1457 | ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, NULL); |
| 1458 | if (!r->connection->keepalives) |
| 1459 | ap_run_log_transaction(r); |
| 1460 | break; |
| 1461 | } |
| 1462 | /* Not worth dying with. */ |
| 1463 | conn->keepalive = AP_CONN_CLOSE; |
| 1464 | apr_pool_destroy(r->pool); |
| 1465 | goto ignore; |
| 1466 | } |
| 1467 | apr_brigade_cleanup(tmp_bb); |
| 1468 | |
| 1469 | /* We may have been in keep_alive_timeout mode, so toggle back |
| 1470 | * to the normal timeout mode as we fetch the header lines, |
| 1471 | * as necessary. |
| 1472 | */ |
| 1473 | apply_server_config(r); |
| 1474 | |
| 1475 | if (!r->assbackwards) { |
| 1476 | const char *tenc, *clen; |
| 1477 | |
| 1478 | ap_get_mime_headers_core(r, tmp_bb); |
| 1479 | apr_brigade_cleanup(tmp_bb); |
| 1480 | if (r->status != HTTP_OK) { |
no test coverage detected