| 398 | } |
| 399 | |
| 400 | static apr_status_t md_curl_perform(md_http_request_t *req) |
| 401 | { |
| 402 | apr_status_t rv = APR_SUCCESS; |
| 403 | CURLcode curle; |
| 404 | md_curl_internals_t *internals; |
| 405 | long l; |
| 406 | |
| 407 | if (APR_SUCCESS != (rv = internals_setup(req))) goto leave; |
| 408 | internals = req->internals; |
| 409 | |
| 410 | curle = curl_easy_perform(internals->curl); |
| 411 | |
| 412 | rv = curl_status(curle); |
| 413 | if (APR_SUCCESS != rv) { |
| 414 | md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, req->pool, |
| 415 | "request failed(%d): %s", curle, curl_easy_strerror(curle)); |
| 416 | goto leave; |
| 417 | } |
| 418 | |
| 419 | rv = curl_status(curl_easy_getinfo(internals->curl, CURLINFO_RESPONSE_CODE, &l)); |
| 420 | if (APR_SUCCESS == rv) { |
| 421 | internals->response->status = (int)l; |
| 422 | } |
| 423 | md_log_perror(MD_LOG_MARK, MD_LOG_TRACE1, rv, req->pool, "request <-- %d", |
| 424 | internals->response->status); |
| 425 | |
| 426 | if (req->cb.on_response) { |
| 427 | rv = req->cb.on_response(internals->response, req->cb.on_response_data); |
| 428 | req->cb.on_response = NULL; |
| 429 | } |
| 430 | |
| 431 | leave: |
| 432 | fire_status(req, rv); |
| 433 | md_http_req_destroy(req); |
| 434 | return rv; |
| 435 | } |
| 436 | |
| 437 | static md_http_request_t *find_curl_request(apr_array_header_t *requests, CURL *curl) |
| 438 | { |
nothing calls this directly
no test coverage detected