Commit d28f2f0b authored by Yann Ylavic's avatar Yann Ylavic
Browse files

Merge r1748047 from trunk:

mod_dav: Add dav_begin_multistatus, dav_send_one_response,
dav_finish_multistatus, dav_send_multistatus, dav_handle_err, 
dav_failed_proppatch, dav_success_proppatch to mod_dav.h.

Submitted by: minfrin
Reviewed by: minfrin, jim, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1756561 13f79535-47bb-0310-9956-ffa450edef68
parent c009b70e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5,6 +5,9 @@ Changes with Apache 2.4.24
  *) core: CVE-2016-5387: Mitigate [f]cgi "httpoxy" issues.
     [Dominic Scheirlinck <dominic vendhq.com>, Yann Ylavic]

  *) mod_dav: Add dav_get_provider_name() function to obtain the name
     of the provider from mod_dav.  [Graham Leggett]

  *) mod_dav: Add support for childtags to dav_error.
     [Jari Urpalainen <jari.urpalainen nokia.com>]

+0 −7
Original line number Diff line number Diff line
@@ -117,13 +117,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) mod_dav: Add dav_begin_multistatus, dav_send_one_response,
     dav_finish_multistatus, dav_send_multistatus, dav_handle_err, 
     dav_failed_proppatch, dav_success_proppatch to mod_dav.h.
     trunk patch: http://svn.apache.org/r1748047
     2.4.x: trunk works modulo CHANGES/MMN
     +1: minfrin, jim, ylavic

  *) mod_proxy: Correctly consider error response codes by the backend when
     processing failonstatus. PR 59869
      Trunk version of patch:
+5 −1
Original line number Diff line number Diff line
@@ -478,6 +478,10 @@
 * 20120211.60 (2.4.21-dev) Add dav_get_provider_name.
 * 20120211.61 (2.4.21-dev) Add ap_cstr_casecmp[n]() - placeholder of apr_ fns
 * 20120211.62 (2.4.24-dev) Add childtags to dav_error.
 * 20120211.63 (2.4.24-dev) Add dav_begin_multistatus, dav_send_one_response,
 *                          dav_finish_multistatus, dav_send_multistatus,
 *                          dav_handle_err, dav_failed_proppatch,
 *                          dav_success_proppatch.
 */

#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -485,7 +489,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20120211
#endif
#define MODULE_MAGIC_NUMBER_MINOR 62                   /* 0...n */
#define MODULE_MAGIC_NUMBER_MINOR 63                   /* 0...n */

/**
 * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
+18 −17
Original line number Diff line number Diff line
@@ -443,7 +443,7 @@ static const char *dav_xml_escape_uri(apr_pool_t *p, const char *uri)
   [Presumably the <multistatus> tag has already been written;  this
   routine is shared by dav_send_multistatus and dav_stream_response.]
*/
static void dav_send_one_response(dav_response *response,
DAV_DECLARE(void) dav_send_one_response(dav_response *response,
                                        apr_bucket_brigade *bb,
                                        ap_filter_t *output,
                                        apr_pool_t *pool)
@@ -505,7 +505,7 @@ static void dav_send_one_response(dav_response *response,
   response and write <multistatus> tag into BB, destined for
   R->output_filters.  Use xml NAMESPACES in initial tag, if
   non-NULL. */
static void dav_begin_multistatus(apr_bucket_brigade *bb,
DAV_DECLARE(void) dav_begin_multistatus(apr_bucket_brigade *bb,
                                        request_rec *r, int status,
                                        apr_array_header_t *namespaces)
{
@@ -530,7 +530,7 @@ static void dav_begin_multistatus(apr_bucket_brigade *bb,
}

/* Finish a multistatus response started by dav_begin_multistatus: */
static apr_status_t dav_finish_multistatus(request_rec *r,
DAV_DECLARE(apr_status_t) dav_finish_multistatus(request_rec *r,
                                                 apr_bucket_brigade *bb)
{
    apr_bucket *b;
@@ -545,7 +545,7 @@ static apr_status_t dav_finish_multistatus(request_rec *r,
    return ap_pass_brigade(r->output_filters, bb);
}

static void dav_send_multistatus(request_rec *r, int status,
DAV_DECLARE(void) dav_send_multistatus(request_rec *r, int status,
                                       dav_response *first,
                                       apr_array_header_t *namespaces)
{
@@ -600,7 +600,7 @@ static void dav_log_err(request_rec *r, dav_error *err, int level)
 *   - repos_hooks->copy_resource
 *   - vsn_hooks->update
 */
static int dav_handle_err(request_rec *r, dav_error *err,
DAV_DECLARE(int) dav_handle_err(request_rec *r, dav_error *err,
                                dav_response *response)
{
    /* log the errors */
@@ -2173,7 +2173,7 @@ static int dav_method_propfind(request_rec *r)
    return DONE;
}

static apr_text * dav_failed_proppatch(apr_pool_t *p,
DAV_DECLARE(apr_text *) dav_failed_proppatch(apr_pool_t *p,
                                             apr_array_header_t *prop_ctx)
{
    apr_text_header hdr = { 0 };
@@ -2234,7 +2234,8 @@ static apr_text * dav_failed_proppatch(apr_pool_t *p,
    return hdr.first;
}

static apr_text * dav_success_proppatch(apr_pool_t *p, apr_array_header_t *prop_ctx)
DAV_DECLARE(apr_text *) dav_success_proppatch(apr_pool_t *p,
                                              apr_array_header_t *prop_ctx)
{
    apr_text_header hdr = { 0 };
    int i = prop_ctx->nelts;
+52 −0
Original line number Diff line number Diff line
@@ -185,6 +185,23 @@ DAV_DECLARE(dav_error*) dav_push_error(apr_pool_t *p, int status, int error_id,
*/
DAV_DECLARE(dav_error*) dav_join_error(dav_error* dest, dav_error* src);

typedef struct dav_response dav_response;

/*
** dav_handle_err()
**
** Handle the standard error processing. <err> must be non-NULL.
**
** <response> is set by the following:
**   - dav_validate_request()
**   - dav_add_lock()
**   - repos_hooks->remove_resource
**   - repos_hooks->move_resource
**   - repos_hooks->copy_resource
**   - vsn_hooks->update
*/
DAV_DECLARE(int) dav_handle_err(request_rec *r, dav_error *err,
                                dav_response *response);

/* error ID values... */

@@ -517,6 +534,41 @@ typedef enum {
#define DAV_STYLE_RFC822        2
#define DAV_TIMEBUF_SIZE        30

/* Write a complete RESPONSE object out as a <DAV:response> xml
 * element.  Data is sent into brigade BB, which is auto-flushed into
 * OUTPUT filter stack.  Use POOL for any temporary allocations.
 *
 * [Presumably the <multistatus> tag has already been written;  this
 * routine is shared by dav_send_multistatus and dav_stream_response.]
 */
DAV_DECLARE(void) dav_send_one_response(dav_response *response,
                                        apr_bucket_brigade *bb,
                                        ap_filter_t *output,
                                        apr_pool_t *pool);

/* Factorized helper function: prep request_rec R for a multistatus
 * response and write <multistatus> tag into BB, destined for
 * R->output_filters.  Use xml NAMESPACES in initial tag, if
 * non-NULL.
 */
DAV_DECLARE(void) dav_begin_multistatus(apr_bucket_brigade *bb,
                                        request_rec *r, int status,
                                        apr_array_header_t *namespaces);

/* Finish a multistatus response started by dav_begin_multistatus: */
DAV_DECLARE(apr_status_t) dav_finish_multistatus(request_rec *r,
                                                 apr_bucket_brigade *bb);

/* Send a multistatus response */
DAV_DECLARE(void) dav_send_multistatus(request_rec *r, int status,
                                       dav_response *first,
                                       apr_array_header_t *namespaces);

DAV_DECLARE(apr_text *) dav_failed_proppatch(apr_pool_t *p,
                                             apr_array_header_t *prop_ctx);
DAV_DECLARE(apr_text *) dav_success_proppatch(apr_pool_t *p,
                                              apr_array_header_t *prop_ctx);

DAV_DECLARE(int) dav_get_depth(request_rec *r, int def_depth);

DAV_DECLARE(int) dav_validate_root(const apr_xml_doc *doc,