Exemple #1
0
static void install_content_reader( ne_request *req, void *userdata, const ne_status *status )
{
    const char *enc = NULL;
    struct transfer_context *writeCtx = userdata;

    (void) status;
    if( !writeCtx ) {
        DEBUG_WEBDAV("Error: install_content_reader called without valid write context!");
        return;
    }

    enc = ne_get_response_header( req, "Content-Encoding" );
    if( status && status->code != 200 ) {
      DEBUG_WEBDAV("Content encoding ist <%s> with status %d", enc ? enc : "empty",
                   status ? status->code : -1 );
    }

    if( enc && c_streq( enc, "gzip" )) {
        writeCtx->decompress = ne_decompress_reader( req, ne_accept_2xx,
                                                     compress_reader,     /* reader callback */
                                                     (void*) writeCtx );  /* userdata        */
    } else {
        ne_add_response_body_reader( req, ne_accept_2xx,
                                     uncompress_reader,
                                     (void*) writeCtx );
        writeCtx->decompress = NULL;
    }
}
Exemple #2
0
/* Attach READER as a response reader for the request REQ, with the
 * acceptance function ACCPT.  The response body data will be decompressed,
 * if compressed, before being passed to READER.  USERDATA will be passed as
 * the first argument to the acceptance and reader callbacks. */
static void
attach_ne_body_reader(svn_ra_neon__request_t *req,
                      ne_accept_response accpt,
                      ne_block_reader reader,
                      void *userdata)
{
  if (req->sess->compression)
    {
      ne_decompress *decompress =
        ne_decompress_reader(req->ne_req, accpt, reader, userdata);

      apr_pool_cleanup_register(req->pool,
                                decompress,
                                compressed_body_reader_cleanup,
                                apr_pool_cleanup_null);
    }
  else
    ne_add_response_body_reader(req->ne_req, accpt, reader, userdata);
}