Perform a speculative (and non-blocking) read from the connection * filters for the given request, to determine whether there is any * pending data to read. Return non-zero if there is, else zero. */
| 42 | * filters for the given request, to determine whether there is any |
| 43 | * pending data to read. Return non-zero if there is, else zero. */ |
| 44 | static int has_buffered_data(request_rec *r) |
| 45 | { |
| 46 | apr_bucket_brigade *bb; |
| 47 | apr_off_t len; |
| 48 | apr_status_t rv; |
| 49 | int result; |
| 50 | |
| 51 | bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); |
| 52 | |
| 53 | rv = ap_get_brigade(r->connection->input_filters, bb, AP_MODE_SPECULATIVE, |
| 54 | APR_NONBLOCK_READ, 1); |
| 55 | result = rv == APR_SUCCESS |
| 56 | && apr_brigade_length(bb, 1, &len) == APR_SUCCESS |
| 57 | && len > 0; |
| 58 | |
| 59 | apr_brigade_destroy(bb); |
| 60 | |
| 61 | return result; |
| 62 | } |
| 63 | |
| 64 | /* If a renegotiation is required for the location, and the request |
| 65 | * includes a message body (and the client has not requested a "100 |
no test coverage detected