https://bz.apache.org/bugzilla/show_bug.cgi?id=60313

--- Comment #9 from Zheng SHAO <[email protected]> ---
Hi, I'm working on fixing this bug for mod_php. May I ask a question?

If we have some codes did not handle the result of `ap_get_brigade`.

we_do_not_want_modify_this_func() {
  ...
  while (ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES,
APR_BLOCK_READ, len) == APR_SUCCESS) {
    apr_brigade_flatten(brigade, buf, &len);
    apr_brigade_cleanup(brigade);
    tlen += len;
    if (tlen == count_bytes || !len) {
      break;
    }
    buf += len;
    len = count_bytes - tlen;
  }
  return tlen;
}

Is it possible to detect the error like this? Or is there a better way to do
this?

detect_error() {
  ...
  error = OK;
  bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
  rv = ap_pass_brigade(r->output_filters, bb);

  if (rv != APR_SUCCESS) {
    if (APR_STATUS_IS_TIMEUP(rv)) {
      error = ap_map_http_request_error(rv, HTTP_REQUEST_TIME_OUT);
    } else {
      error = ap_map_http_request_error(rv, HTTP_BAD_REQUEST);
    }
  }
  return error;
}

Thank you.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to