Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

http_protocol.h File Reference

#include "httpd.h"
#include "apr_hooks.h"
#include "apr_portable.h"
#include "apr_mmap.h"
#include "apr_buckets.h"
#include "util_filter.h"

Include dependency graph for http_protocol.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  HTTP

Defines

#define AP_METHOD_CHECK_ALLOWED(mask, methname)   ((mask) & (AP_METHOD_BIT << ap_method_number_of((methname))))
#define ap_rgetline(s, n, read, r, fold, bb)   ap_rgetline_core((s), (n), (read), (r), (fold), (bb))
#define AP_BUCKET_IS_ERROR(e)   (e->type == &ap_bucket_type_error)

Functions

 AP_DECLARE_HOOK (void, insert_error_filter,(request_rec *r)) AP_DECLARE_DATA extern ap_filter_rec_t *ap_old_write_func
request_recap_read_request (conn_rec *c)
 AP_DECLARE (void) ap_get_mime_headers(request_rec *r)
 AP_DECLARE (int) ap_set_keepalive(request_rec *r)
 AP_DECLARE (apr_time_t) ap_rationalize_mtime(request_rec *r
 AP_DECLARE (const char *) ap_make_content_type(request_rec *r
 AP_DECLARE (char *) ap_make_etag(request_rec *r
 AP_DECLARE (apr_status_t) ap_send_fd(apr_file_t *fd
 AP_DECLARE (ap_method_list_t *) ap_make_method_list(apr_pool_t *p
 AP_DECLARE_NONSTD (void) ap_method_list_do(int(*comp)(void *urec
 AP_DECLARE_NONSTD (int) ap_rvputs(request_rec *r
const char __attribute__ ((format(printf, 2, 3)))
 AP_DECLARE (long) ap_get_client_block(request_rec *r
 AP_CORE_DECLARE (void) ap_parse_uri(request_rec *r
 AP_DECLARE_HOOK (int, post_read_request,(request_rec *r)) AP_DECLARE_HOOK(int
request_rec *r AP_DECLARE_HOOK (const char *, http_method,(const request_rec *r)) AP_DECLARE_HOOK(apr_port_t
 AP_DECLARE (apr_bucket *) ap_bucket_error_make(apr_bucket *b
 AP_DECLARE_NONSTD (apr_status_t) ap_byterange_filter(ap_filter_t *f

Variables

apr_bucket_brigadebb
int recursive_error
apr_off_t length
apr_time_t mtime
const char * type
int force_weak
request_recr
request_rec apr_off_t offset
request_rec apr_off_t apr_size_t
apr_size_t * 
nbytes
const char * methname
int nelts
ap_method_list_tsrc
const char * mname
const char int mnum
const char int void * rec
const char int void const
ap_method_list_t
ml
const char int void const
ap_method_list_t const char
int void const ap_method_list_t
va_list 
vp
const char * method
const char * ct
int nbyte
const char * fmt
const char va_list vlist
int read_policy
char * buffer
char apr_size_t bufsiz
const char ** pw
const char * uri
int n
int request_rec int fold
apr_size_t apr_size_t * read
int methnum
 log_transaction
request_rec *r default_port
typedefrequest_rec *r const
request_rec *r struct ap_bucket_error 
ap_bucket_error
AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_error
int error
int const char * buf
int const char apr_pool_tp
const char apr_pool_t apr_bucket_alloc_tlist
apr_bucket_brigadeb


Define Documentation

#define AP_BUCKET_IS_ERROR e   )     (e->type == &ap_bucket_type_error)
 

Determine if a bucket is an error bucket

Parameters:
e The bucket to inspect
Returns:
true or false

Definition at line 653 of file http_protocol.h.

#define AP_METHOD_CHECK_ALLOWED mask,
methname   )     ((mask) & (AP_METHOD_BIT << ap_method_number_of((methname))))
 

Definition at line 248 of file http_protocol.h.

#define ap_rgetline s,
n,
read,
r,
fold,
bb   )     ap_rgetline_core((s), (n), (read), (r), (fold), (bb))
 

Get the next line of input for the request

Note: on ASCII boxes, ap_rgetline is a macro which simply calls ap_rgetline_core to get the line of input.

on EBCDIC boxes, ap_rgetline is a wrapper function which translates ASCII protocol lines to the local EBCDIC code page after getting the line of input.

Parameters:
s Pointer to the pointer to the buffer into which the line should be read; if *s==NULL, a buffer of the necessary size to hold the data will be allocated from the request pool
n The size of the buffer
read The length of the line.
r The request
fold Whether to merge continuation lines
bb Working brigade to use when reading buckets
Returns:
APR_SUCCESS, if successful APR_ENOSPC, if the line is too big to fit in the buffer Other errors where appropriate

Definition at line 561 of file http_protocol.h.

Referenced by AP_DECLARE(), and read_request_line().


Function Documentation

const char __attribute__ (format(printf, 2, 3))   ) 
 

AP_CORE_DECLARE void   ) 
 

parse_uri: break apart the uri

Warning:
Side Effects:
  • sets r->args to rest after '?' (or NULL if no '?')
  • sets r->uri to request uri (without r->args part)
  • sets r->hostname (if not set already) from request (scheme://host:port)
Parameters:
r 
The current request
 
uri 
The uri to break apart
  void ap_parse_uri(request_rec *r, const char *uri)

Definition at line 508 of file core.c.

References AP_CORE_DECLARE, ap_get_module_config, core_module, and sconf.

AP_DECLARE apr_bucket  ) 
 

Make the bucket passed in an error bucket

Parameters:
b The bucket to make into an error bucket
error The HTTP error code to put in the bucket.
buf An optional error string to put in the bucket.
p A pool to allocate out of.
Returns:
The new bucket, or NULL if allocation failed apr_bucket *ap_bucket_error_make(apr_bucket *b, int error, const char *buf, apr_pool_t *p)

Definition at line 38 of file eoc_bucket.c.

References AP_DECLARE, APR_BUCKET_INIT, and b.

AP_DECLARE long   ) 
 

Call this in a loop. It will put data into a buffer and return the length of the input block

Parameters:
r The current request
buffer The buffer in which to store the data
bufsiz The size of the buffer
Returns:
Number of bytes inserted into the buffer. When done reading, 0 if EOF, or -1 if there was an error long ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz)

AP_DECLARE ap_method_list_t  ) 
 

Create a new method list with the specified number of preallocated slots for extension methods.

Parameters:
p Pointer to a pool in which the structure should be allocated.
nelts Number of preallocated extension slots
Returns:
Pointer to the newly created structure. ap_method_list_t ap_make_method_list(apr_pool_t *p, int nelts)

AP_DECLARE apr_status_t   ) 
 

Send an entire file to the client, using sendfile if supported by the current platform

Parameters:
fd The file to send.
r The current request
offset Offset into the file to start sending.
length Amount of data to send
nbytes Amount of data actually sent apr_status_t ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset, apr_size_t length, apr_size_t *nbytes);

AP_DECLARE char *   ) 
 

Construct an entity tag from the resource information. If it's a real file, build in some of the file characteristics.

Parameters:
r The current request
force_weak Force the entity tag to be weak - it could be modified again in as short an interval.
Returns:
The entity tag char *ap_make_etag(request_rec *r, int force_weak)

AP_DECLARE apr_time_t   ) 
 

Return the latest rational time from a request/mtime pair. Mtime is returned unless it's in the future, in which case we return the current time.

Parameters:
r The current request
mtime The last modified time
Returns:
the latest rational time. apr_time_t ap_rationalize_mtime(request_rec *r, apr_time_t mtime)

AP_DECLARE int   ) 
 

Get XML post data and parse it

Parameters:
r The current request
pdoc The XML post data
Returns:
HTTP status code int ap_xml_parse_input(request_rec *r, apr_xml_doc **pdoc)

Definition at line 445 of file http_protocol.c.

AP_DECLARE void   ) 
 

Generic accessors for other modules to set at their own module-specific data

Parameters:
conf_vector The vector in which the modules configuration is stored. usually r->per_dir_config or s->module_config
m The module to set the data for.
val The module-specific data to set void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val)

Definition at line 1271 of file http_protocol.c.

request_rec* r AP_DECLARE_HOOK const char *  ,
http_method  ,
(const request_rec *r
 

Return the default port from the current request

Parameters:
r The current request
Returns:
The current port apr_port_t ap_run_default_port(const request_rec *r)

AP_DECLARE_HOOK int  ,
post_read_request  ,
(request_rec *r
 

This hook allows modules to perform any module-specific logging activities over and above the normal server things.

Parameters:
r The current request
Returns:
OK, DECLINED, or HTTP_... int ap_run_log_transaction(request_rec *r)

AP_DECLARE_NONSTD apr_status_t   ) 
 

AP_DECLARE_NONSTD int   ) 
 

Write an unspecified number of strings to the request

Parameters:
r The current request
... The strings to write
Returns:
The number of bytes sent int ap_rvputs(request_rec *r, ...)

AP_DECLARE_NONSTD void   ) 
 

request_rec* ap_read_request conn_rec c  ) 
 

Read a request and fill in the fields.

Parameters:
c The current connection
Returns:
The new request_rec

Definition at line 815 of file protocol.c.

References request_rec::allowed_methods, request_rec::ap_auth_type, ap_http_input_filter_handle, APLOG_ERR, APLOG_INFO, APLOG_MARK, apr_pcalloc, apr_pool_create, request_rec::assbackwards, conn_rec::base_server, conn_rec::bucket_alloc, request_rec::connection, request_rec::err_headers_out, request_rec::expecting_100, request_rec::header_only, request_rec::headers_in, request_rec::headers_out, request_rec::hostname, HTTP_BAD_REQUEST, HTTP_EXPECTATION_FAILED, HTTP_OK, HTTP_REQUEST_TIME_OUT, HTTP_REQUEST_URI_TOO_LARGE, HTTP_VERSION, conn_rec::input_filters, request_rec::input_filters, server_rec::limit_req_line, server_rec::lookup_defaults, request_rec::notes, NULL, conn_rec::output_filters, request_rec::output_filters, p, request_rec::per_dir_config, conn_rec::pool, request_rec::pool, request_rec::proto_input_filters, request_rec::proto_num, request_rec::proto_output_filters, request_rec::read_body, request_rec::read_length, read_request_line(), request_rec::request_config, REQUEST_NO_BODY, conn_rec::sbh, request_rec::sent_bodyct, request_rec::server, SERVER_BUSY_LOG, request_rec::status, strcasecmp(), request_rec::subprocess_env, request_rec::the_request, request_rec::uri, and request_rec::user.

Referenced by ap_process_http_connection().

Here is the call graph for this function:


Variable Documentation

typedefrequest_rec* r const request_rec* r struct ap_bucket_error ap_bucket_error
 

Definition at line 628 of file http_protocol.h.

AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_error
 

Definition at line 67 of file error_bucket.c.

Referenced by AP_CORE_DECLARE_NONSTD(), and AP_DECLARE().

apr_bucket_brigade apr_bucket_brigade * bb
 

Definition at line 507 of file util_filter.h.

Referenced by AP_DECLARE(), ap_http_filter(), ap_proxy_ftp_handler(), ap_proxy_http_handler(), APR_HOOK_STRUCT(), APR_OPTIONAL_FN_TYPE(), asis_handler(), cache_save_filter(), cgi_handler(), cgid_handler(), check_pipeline_flush(), dav_method_put(), dav_send_multistatus(), default_handler(), drain_available_output(), getsfunc_BRIGADE(), handle_map_file(), isapi_handler(), mmap_handler(), pass_request(), perchild_process_connection(), process_echo_connection(), receive_from_other_child(), send_downstream(), send_eos(), sendfile_handler(), ServerSupportFunction(), and WriteClient().

char* buffer
 

Definition at line 449 of file http_protocol.h.

char apr_size_t bufsiz
 

Definition at line 449 of file http_protocol.h.

const char* ct
 

Definition at line 322 of file http_protocol.h.

Referenced by APR_DECLARE(), maybe_byte_reverse(), mime_post_config(), and modssl_session_get_time().

request_rec* r default_port
 

Definition at line 626 of file http_protocol.h.

int error
 

Definition at line 664 of file http_protocol.h.

Referenced by apr_socket_connect(), APU_DECLARE(), cmd_rewritelock(), common(), DAV_DECLARE_NONSTD(), dav_method_lock(), main(), prep(), prolog0(), prolog1(), prolog2(), ssl_io_filter_connect(), table_next(), table_next_r(), and table_order().

const char* fmt
 

Definition at line 383 of file http_protocol.h.

apr_size_t apr_size_t request_rec int fold
 

Definition at line 564 of file http_protocol.h.

int force_weak
 

Definition at line 161 of file http_protocol.h.

log_transaction
 

Definition at line 609 of file http_protocol.h.

const char* methname
 

Definition at line 235 of file http_protocol.h.

int methnum
 

Definition at line 584 of file http_protocol.h.

Referenced by AP_CORE_DECLARE_NONSTD(), AP_DECLARE(), and set_script().

const char* method
 

Definition at line 303 of file http_protocol.h.

const char int void const ap_method_list_t const char int void const ap_method_list_t * ml
 

Definition at line 268 of file http_protocol.h.

Referenced by AP_DECLARE().

const char int void const ap_method_list_t const char * mname
 

Definition at line 268 of file http_protocol.h.

const char int void const ap_method_list_t const char int mnum
 

Definition at line 268 of file http_protocol.h.

apr_time_t mtime
 

Definition at line 127 of file http_protocol.h.

Referenced by AP_DECLARE(), and ap_proxy_ftp_handler().

const char** pw
 

Definition at line 505 of file http_protocol.h.

Referenced by add_password(), get_dbm_pw(), main(), and mkrecord().

const request_rec* r
 

Definition at line 690 of file http_protocol.h.

apr_size_t apr_size_t* read
 

Definition at line 564 of file http_protocol.h.

Referenced by AP_DECLARE(), APR_DECLARE(), apr_socket_recv(), isapi_handler(), main(), read_connection(), ReadClient(), ServerSupportFunction(), and sock_read().

int read_policy
 

Definition at line 426 of file http_protocol.h.

int recursive_error
 

Definition at line 94 of file http_protocol.h.

Referenced by AP_DECLARE().

const char* type
 

Definition at line 141 of file http_protocol.h.

const char* uri
 

Definition at line 518 of file http_protocol.h.

const char va_list vlist
 

Definition at line 373 of file http_protocol.h.

const char int void const ap_method_list_t const char int void const ap_method_list_t va_list vp
 

Definition at line 268 of file http_protocol.h.

Referenced by AP_DECLARE_NONSTD(), APR_DECLARE_NONSTD(), ssl_scache_shmht_retrieve(), and ssl_scache_shmht_store().