httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: httpd-2.0/modules/http config.m4 http_core.c http_protocol.c http_request.c
Date Sat, 27 Jan 2001 07:13:39 GMT
rbb         01/01/26 23:13:39

  Modified:    .        CHANGES
               include  http_protocol.h util_filter.h
               modules/http config.m4 http_core.c http_protocol.c
                        http_request.c
  Log:
  filters can now report an HTTP error to the server.  This is done
  by sending a brigade where the first bucket is an error_bucket.
  This bucket is a simple bucket that stores an HTTP error and
  a string.  Currently the string is not used, but it may be needed
  to output an error log.  The http_header_filter will find this
  bucket, and output the error text, and then return
  AP_FILTER_ERROR, which informs the server that the error web page
  has already been sent.
  
  Revision  Changes    Path
  1.55      +9 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -d -b -w -u -r1.54 -r1.55
  --- CHANGES	2001/01/26 17:54:02	1.54
  +++ CHANGES	2001/01/27 07:13:38	1.55
  @@ -1,5 +1,14 @@
   Changes with Apache 2.0b1
   
  +  *) filters can now report an HTTP error to the server.  This is done
  +     by sending a brigade where the first bucket is an error_bucket.
  +     This bucket is a simple bucket that stores an HTTP error and
  +     a string.  Currently the string is not used, but it may be needed
  +     to output an error log.  The http_header_filter will find this
  +     bucket, and output the error text, and then return 
  +     AP_FILTER_ERROR, which informs the server that the error web page
  +     has already been sent.  [Ryan Bloom]
  +
     *) If we get an error, then we should remove all filters except for
        those critical to serving a web page.  This fixes a bug, where
        error pages were going through the byterange filter, even though
  
  
  
  1.47      +42 -0     httpd-2.0/include/http_protocol.h
  
  Index: http_protocol.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_protocol.h,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -d -b -w -u -r1.46 -r1.47
  --- http_protocol.h	2001/01/24 02:14:23	1.46
  +++ http_protocol.h	2001/01/27 07:13:38	1.47
  @@ -59,9 +59,11 @@
   #ifndef APACHE_HTTP_PROTOCOL_H
   #define APACHE_HTTP_PROTOCOL_H
   
  +#include "httpd.h"
   #include "apr_hooks.h"
   #include "apr_portable.h"
   #include "apr_mmap.h"
  +#include "apr_buckets.h"
   
   #ifdef __cplusplus
   extern "C" {
  @@ -549,6 +551,46 @@
    * @deffunc apr_port_t ap_run_default_port(const request_rec *r)
    */
   AP_DECLARE_HOOK(apr_port_t,default_port,(const request_rec *))
  +
  +typedef struct ap_bucket_error ap_bucket_error;
  +/**
  + * A bucket referring to an HTTP error
  + * This bucket can be passed down the filter stack to indicate that an
  + * HTTP error occurred while running a filter.  In order for this bucket
  + * to be used successfully, it MUST be sent as the first bucket in the
  + * first brigade to be sent from a given filter.
  + */
  +struct ap_bucket_error {
  +    /** The start of the data actually allocated.  This should never be
  +     * modified, it is only used to free the bucket.
  +     */
  +    char    *start;
  +};
  +
  +extern const apr_bucket_type_t ap_bucket_type_error;
  +
  +/**
  + * Make the bucket passed in an error bucket
  + * @param b The bucket to make into an error bucket
  + * @param error The HTTP error code to put in the bucket. 
  + * @param buf An optional error string to put in the bucket.
  + * @param p A pool to allocate out of.
  + * @return The new bucket, or NULL if allocation failed
  + * @deffunc apr_bucket *ap_bucket_make_error(apr_bucket *b, int error, const char *buf,
apr_pool_t *p)
  + */
  +AP_DECLARE(apr_bucket *) ap_bucket_make_error(apr_bucket *b, int error,
  +                const char *buf, apr_pool_t *p);
  +
  +/**
  + * Create a bucket referring to an HTTP error.
  + * @param error The HTTP error code to put in the bucket. 
  + * @param buf An optional error string to put in the bucket.
  + * @param p A pool to allocate out of.
  + * @return The new bucket, or NULL if allocation failed
  + * @deffunc apr_bucket *ap_bucket_create_error(int error, const char *buf, apr_pool_t *p)
  + */
  +AP_DECLARE(apr_bucket *) ap_bucket_create_error(int error,
  +                const char *buf, apr_pool_t *p);
   
   #ifdef __cplusplus
   }
  
  
  
  1.37      +1 -0      httpd-2.0/include/util_filter.h
  
  Index: util_filter.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/util_filter.h,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -d -b -w -u -r1.36 -r1.37
  --- util_filter.h	2001/01/22 21:57:56	1.36
  +++ util_filter.h	2001/01/27 07:13:38	1.37
  @@ -73,6 +73,7 @@
   
   #define AP_NOBODY_WROTE         -1
   #define AP_NOBODY_READ          -2
  +#define AP_FILTER_ERROR         -3
   
   /* ap_input_mode_t - input filtering modes 
    * 
  
  
  
  1.2       +1 -1      httpd-2.0/modules/http/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/config.m4,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -d -b -w -u -r1.1 -r1.2
  --- config.m4	2000/12/05 03:51:41	1.1
  +++ config.m4	2001/01/27 07:13:39	1.2
  @@ -2,7 +2,7 @@
   
   APACHE_MODPATH_INIT(http)
   
  -http_objects="http_core.lo http_protocol.lo http_request.lo"
  +http_objects="http_core.lo http_protocol.lo http_request.lo error_bucket.lo"
   
   APACHE_MODULE(core, HTTP protocol handling, $http_objects, , yes)
   APACHE_MODULE(mime, mapping of file-extension to MIME, , , yes)
  
  
  
  1.251     +1 -0      httpd-2.0/modules/http/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_core.c,v
  retrieving revision 1.250
  retrieving revision 1.251
  diff -u -d -b -w -u -r1.250 -r1.251
  --- http_core.c	2001/01/25 02:51:30	1.250
  +++ http_core.c	2001/01/27 07:13:39	1.251
  @@ -3516,6 +3516,7 @@
   static void core_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
   {
       apr_init_bucket_types(pconf);
  +    apr_insert_bucket_type(&ap_bucket_type_error);
   }
   
   static void core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec
*s)
  
  
  
  1.283     +8 -0      httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.282
  retrieving revision 1.283
  diff -u -d -b -w -u -r1.282 -r1.283
  --- http_protocol.c	2001/01/26 18:48:57	1.282
  +++ http_protocol.c	2001/01/27 07:13:39	1.283
  @@ -2466,6 +2466,14 @@
           return OK;
       }
   
  +    if (APR_BRIGADE_FIRST(b)->type == &ap_bucket_type_error) {
  +        const char *str;
  +        apr_size_t length;
  +        apr_bucket_read(APR_BRIGADE_FIRST(b), &str, &length, APR_NONBLOCK_READ);
  +        ap_die(atoi(ap_getword_white(r->pool, &str)), r);
  +        return AP_FILTER_ERROR;
  +    }
  +
       if (r->assbackwards) {
           r->bytes_sent = 0;
           r->sent_bodyct = 1;
  
  
  
  1.78      +1 -1      httpd-2.0/modules/http/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_request.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -d -b -w -u -r1.77 -r1.78
  --- http_request.c	2001/01/24 02:14:23	1.77
  +++ http_request.c	2001/01/27 07:13:39	1.78
  @@ -1351,7 +1351,7 @@
        */
       ap_run_insert_filter(r);
   
  -    if ((access_status = ap_invoke_handler(r)) != 0) {
  +    if ((access_status = ap_invoke_handler(r)) != 0 && access_status != -3) {
           ap_die(access_status, r);
           return;
       }
  
  
  

Mime
View raw message