Make the auth code requeue the same request instance when another request is
needed to get the required response.

Serf 1.3 requeued a different request and destroyed the existing one, which
makes it impossible for end-user applications to perform further operations
on a request. This patch fixes that behavior by rerouting the existing
response to a new request instead.

* auth/auth.c
  (serf__handle_auth_response): Use bool. Just handle the headers and let
    requeue the request. This avoids work in case we can just reset the
    stream. Mark handling done to avoid processing every time during body
    handling.

* outgoing_request.c
  (clean_resp): Add comment.
  (serf__handle_response): Update caller.
  (create_request): Use bool arguments.
  (serf_connection_request_create): Update caller.
  (insert_priority_request): New function, extracted from...
  (priority_request_create): ... here.
  (discard_response_handler): New function.
  (serf__request_requeue): Rewrite as...
  (serf_connection__request_requeue): ... this.

* protocols/http2_stream.c
  (serf_http2_stream_data_t): Track resetted.
  (serf_http2__stream_create): Init value.
  (serf_http2__stream_reset): We reset only once.
  (serf_http2__stream_cancel_request): Handle request updating and
    the remaining work as reset.
  (stream_response_eof): Don't return EOF on stream reset, as handlers
    will commonly report that as reading errors. Just keep returning
    EAGAIN.
  (serf_http2__stream_processor): Handle switching requests and
    resetting requests.

* serf_private.h
  (IOV_MAX): Remove unused variable.
  (SERF__STD_IOV_COUNT): Use APR_MAX_IOVEC_SIZE instead of IOV_MAX.
  (serf_request_t): Add variable. Use bool for a few others.
  (serf__handle_auth_response): Use bool for output argument.

  (serf__request_requeue): Remove function.
  (serf_connection__request_requeue): New function.


git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1716726 13f79535-47bb-0310-9956-ffa450edef68
4 files changed