HTTP Protocol Handling
[Apache Core]


データ構造

struct  ap_bucket_error
 A bucket referring to an HTTP error [詳細]
struct  ap_bucket_error
 A bucket referring to an HTTP error [詳細]

マクロ定義

#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)

型定義

typedef ap_bucket_error ap_bucket_error

関数

request_recap_read_request (conn_rec *c)
void ap_get_mime_headers (request_rec *r)
void ap_get_mime_headers_core (request_rec *r, apr_bucket_brigade *bb)
void ap_finalize_request_protocol (request_rec *r)
void ap_send_error_response (request_rec *r, int recursive_error)
void ap_set_content_length (request_rec *r, apr_off_t length)
int ap_set_keepalive (request_rec *r)
apr_time_t ap_rationalize_mtime (request_rec *r, apr_time_t mtime)
const char * ap_make_content_type (request_rec *r, const char *type)
char * ap_make_etag (request_rec *r, int force_weak)
void ap_set_etag (request_rec *r)
void ap_set_last_modified (request_rec *r)
int ap_meets_conditions (request_rec *r)
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)
size_t ap_send_mmap (apr_mmap_t *mm, request_rec *r, size_t offset, size_t length)
int ap_method_register (apr_pool_t *p, const char *methname)
void ap_method_registry_init (apr_pool_t *p)
ap_method_list_tap_make_method_list (apr_pool_t *p, int nelts)
void ap_copy_method_list (ap_method_list_t *dest, ap_method_list_t *src)
int ap_method_in_list (ap_method_list_t *l, const char *method)
void ap_method_list_add (ap_method_list_t *l, const char *method)
void ap_method_list_remove (ap_method_list_t *l, const char *method)
void ap_clear_method_list (ap_method_list_t *l)
void ap_set_content_type (request_rec *r, const char *ct)
int ap_rputc (int c, request_rec *r)
int ap_rputs (const char *str, request_rec *r)
int ap_rwrite (const void *buf, int nbyte, request_rec *r)
int ap_rvputs (request_rec *r,...)
int ap_vrprintf (request_rec *r, const char *fmt, va_list vlist)
int ap_rprintf (request_rec *r, const char *fmt,...) __attribute__((format(printf
int int ap_rflush (request_rec *r)
int ap_index_of_response (int status)
const char * ap_get_status_line (int status)
int ap_setup_client_block (request_rec *r, int read_policy)
int ap_should_client_block (request_rec *r)
long ap_get_client_block (request_rec *r, char *buffer, apr_size_t bufsiz)
int ap_discard_request_body (request_rec *r)
void ap_note_auth_failure (request_rec *r)
void ap_note_basic_auth_failure (request_rec *r)
void ap_note_digest_auth_failure (request_rec *r)
int ap_get_basic_auth_pw (request_rec *r, const char **pw)
 AP_CORE_DECLARE (void) ap_parse_uri(request_rec *r
int ap_getline (char *s, int n, request_rec *r, int fold)
apr_status_t ap_rgetline_core (char **s, apr_size_t n, apr_size_t *read, request_rec *r, int fold, apr_bucket_brigade *bb)
int ap_method_number_of (const char *method)
const char * ap_method_name_of (apr_pool_t *p, int methnum)
int post_read_request (request_rec *r)
int log_transaction (request_rec *r)
const char * http_scheme (const request_rec *r)
apr_port_t default_port (const request_rec *r)
apr_bucketap_bucket_error_make (apr_bucket *b, int error, const char *buf, apr_pool_t *p)
apr_bucketap_bucket_error_create (int error, const char *buf, apr_pool_t *p, apr_bucket_alloc_t *list)
apr_status_t ap_byterange_filter (ap_filter_t *f, apr_bucket_brigade *b)
apr_status_t ap_http_header_filter (ap_filter_t *f, apr_bucket_brigade *b)
apr_status_t ap_content_length_filter (ap_filter_t *, apr_bucket_brigade *)
apr_status_t ap_old_write_filter (ap_filter_t *f, apr_bucket_brigade *b)
void ap_set_sub_req_protocol (request_rec *rnew, const request_rec *r)
void ap_finalize_sub_req_protocol (request_rec *sub_r)

変数

AP_DECLARE_DATA ap_filter_rec_tap_old_write_func
const char * uri
AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_error

マクロ定義

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

Determine if a bucket is an error bucket

引数:
e The bucket to inspect
戻り値:
true or false

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

This is a convenience macro to ease with checking a mask against a method name.

#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.

引数:
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
戻り値:
APR_SUCCESS, if successful APR_ENOSPC, if the line is too big to fit in the buffer Other errors where appropriate


型定義

typedef struct ap_bucket_error ap_bucket_error

参照:
ap_bucket_type_error


関数

apr_bucket* ap_bucket_error_create ( int  error,
const char *  buf,
apr_pool_t p,
apr_bucket_alloc_t list 
)

Create a bucket referring to an HTTP error.

引数:
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 the error string out of.
list The bucket allocator from which to allocate the bucket
戻り値:
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 
)

Make the bucket passed in an error bucket

引数:
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.
戻り値:
The new bucket, or NULL if allocation failed

void ap_clear_method_list ( ap_method_list_t l  ) 

Reset a method list to be completely empty.

引数:
l Pointer to a method list, such as cmd->methods_limited.
戻り値:
None.

void ap_copy_method_list ( ap_method_list_t dest,
ap_method_list_t src 
)

Copy a method list

引数:
dest List to copy to
src List to copy from

AP_CORE_DECLARE ( void   ) 

parse_uri: break apart the uri

警告:
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)
引数:
r The current request
uri The uri to break apart

int ap_discard_request_body ( request_rec r  ) 

In HTTP/1.1, any method can have a body. However, most GET handlers wouldn't know what to do with a request body if they received one. This helper routine tests for and reads any message body in the request, simply discarding whatever it receives. We need to do this because failing to read the request body would cause it to be interpreted as the next request on a persistent connection.

引数:
r The current request
戻り値:
error status if request is malformed, OK otherwise

void ap_finalize_request_protocol ( request_rec r  ) 

Called at completion of sending the response. It sends the terminating protocol information.

引数:
r The current request

void ap_finalize_sub_req_protocol ( request_rec sub_r  ) 

A wrapup function to keep the internal accounting straight. Indicates that there is no more content coming.

引数:
sub_r Subrequest that is now compete

int ap_get_basic_auth_pw ( request_rec r,
const char **  pw 
)

Get the password from the request headers

引数:
r The current request
pw The password as set in the headers
戻り値:
0 (OK) if it set the 'pw' argument (and assured a correct value in r->user); otherwise it returns an error code, either HTTP_INTERNAL_SERVER_ERROR if things are really confused, HTTP_UNAUTHORIZED if no authentication at all seemed to be in use, or DECLINED if there was authentication but it wasn't Basic (in which case, the caller should presumably decline as well).

long ap_get_client_block ( request_rec r,
char *  buffer,
apr_size_t  bufsiz 
)

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

引数:
r The current request
buffer The buffer in which to store the data
bufsiz The size of the buffer
戻り値:
Number of bytes inserted into the buffer. When done reading, 0 if EOF, or -1 if there was an error

void ap_get_mime_headers ( request_rec r  ) 

Read the mime-encoded headers.

引数:
r The current request

void ap_get_mime_headers_core ( request_rec r,
apr_bucket_brigade bb 
)

Optimized version of ap_get_mime_headers() that requires a temporary brigade to work with

引数:
r The current request
bb temp brigade

const char* ap_get_status_line ( int  status  ) 

Return the Status-Line for a given status code (excluding the HTTP-Version field). If an invalid or unknown status code is passed, "500 Internal Server Error" will be returned.

引数:
status The HTTP status code
戻り値:
The Status-Line

int ap_getline ( char *  s,
int  n,
request_rec r,
int  fold 
)

Get the next line of input for the request

引数:
s The buffer into which to read the line
n The size of the buffer
r The request
fold Whether to merge continuation lines
戻り値:
The length of the line, if successful n, if the line is too big to fit in the buffer -1 for miscellaneous errors

int ap_index_of_response ( int  status  ) 

Index used in custom_responses array for a specific error code (only use outside protocol.c is in getting them configured).

引数:
status HTTP status code
戻り値:
The index of the response

const char* ap_make_content_type ( request_rec r,
const char *  type 
)

Build the content-type that should be sent to the client from the content-type specified. The following rules are followed:

char* ap_make_etag ( request_rec r,
int  force_weak 
)

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

引数:
r The current request
force_weak Force the entity tag to be weak - it could be modified again in as short an interval.
戻り値:
The entity tag

ap_method_list_t* ap_make_method_list ( apr_pool_t p,
int  nelts 
)

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

引数:
p Pointer to a pool in which the structure should be allocated.
nelts Number of preallocated extension slots
戻り値:
Pointer to the newly created structure.

int ap_meets_conditions ( request_rec r  ) 

Implements condition GET rules for HTTP/1.1 specification. This function inspects the client headers and determines if the response fulfills the requirements specified.

引数:
r The current request
戻り値:
OK if the response fulfills the condition GET rules, some other status code otherwise

int ap_method_in_list ( ap_method_list_t l,
const char *  method 
)

Search for an HTTP method name in an ap_method_list_t structure, and return true if found.

引数:
method String containing the name of the method to check.
l Pointer to a method list, such as cmd->methods_limited.
戻り値:
1 if method is in the list, otherwise 0

void ap_method_list_add ( ap_method_list_t l,
const char *  method 
)

Add an HTTP method name to an ap_method_list_t structure if it isn't already listed.

引数:
method String containing the name of the method to check.
l Pointer to a method list, such as cmd->methods_limited.
戻り値:
None.

void ap_method_list_remove ( ap_method_list_t l,
const char *  method 
)

Remove an HTTP method name from an ap_method_list_t structure.

引数:
l Pointer to a method list, such as cmd->methods_limited.
method String containing the name of the method to remove.
戻り値:
None.

const char* ap_method_name_of ( apr_pool_t p,
int  methnum 
)

Get the method name associated with the given internal method number. Returns NULL if not recognized.

引数:
p A pool to use for temporary allocations.
methnum An integer value corresponding to an internal method number
戻り値:
The name corresponding to the method number

int ap_method_number_of ( const char *  method  ) 

Get the method number associated with the given string, assumed to contain an HTTP method. Returns M_INVALID if not recognized.

引数:
method A string containing a valid HTTP method
戻り値:
The method number

int ap_method_register ( apr_pool_t p,
const char *  methname 
)

Register a new request method, and return the offset that will be associated with that method.

引数:
p The pool to create registered method numbers from.
methname The name of the new method to register.
戻り値:
Ab int value representing an offset into a bitmask.

void ap_method_registry_init ( apr_pool_t p  ) 

Initialize the method_registry and allocate memory for it.

引数:
p Pool to allocate memory for the registry from.

void ap_note_auth_failure ( request_rec r  ) 

Setup the output headers so that the client knows how to authenticate itself the next time, if an authentication request failed. This function works for both basic and digest authentication

引数:
r The current request

void ap_note_basic_auth_failure ( request_rec r  ) 

Setup the output headers so that the client knows how to authenticate itself the next time, if an authentication request failed. This function works only for basic authentication

引数:
r The current request

void ap_note_digest_auth_failure ( request_rec r  ) 

Setup the output headers so that the client knows how to authenticate itself the next time, if an authentication request failed. This function works only for digest authentication

引数:
r The current request

apr_time_t ap_rationalize_mtime ( request_rec r,
apr_time_t  mtime 
)

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.

引数:
r The current request
mtime The last modified time
戻り値:
the latest rational time.

request_rec* ap_read_request ( conn_rec c  ) 

Read a request and fill in the fields.

引数:
c The current connection
戻り値:
The new request_rec

int int ap_rflush ( request_rec r  ) 

Flush all of the data for the current request to the client

引数:
r The current request
戻り値:
The number of bytes sent

apr_status_t ap_rgetline_core ( char **  s,
apr_size_t  n,
apr_size_t *  read,
request_rec r,
int  fold,
apr_bucket_brigade bb 
)

参照:
ap_rgetline

int ap_rprintf ( request_rec r,
const char *  fmt,
  ... 
)

Output data to the client in a printf format

引数:
r The current request
fmt The format string
... The arguments to use to fill out the format string
戻り値:
The number of bytes sent

int ap_rputc ( int  c,
request_rec r 
)

Output one character for this request

引数:
c the character to output
r the current request
戻り値:
The number of bytes sent

int ap_rputs ( const char *  str,
request_rec r 
)

Output a string for the current request

引数:
str The string to output
r The current request
戻り値:
The number of bytes sent

int ap_rvputs ( request_rec r,
  ... 
)

Write an unspecified number of strings to the request

引数:
r The current request
... The strings to write
戻り値:
The number of bytes sent

int ap_rwrite ( const void *  buf,
int  nbyte,
request_rec r 
)

Write a buffer for the current request

引数:
buf The buffer to write
nbyte The number of bytes to send from the buffer
r The current request
戻り値:
The number of bytes sent

void ap_send_error_response ( request_rec r,
int  recursive_error 
)

Send error back to client.

引数:
r The current request
recursive_error last arg indicates error status in case we get an error in the process of trying to deal with an ErrorDocument to handle some other error. In that case, we print the default report for the first thing that went wrong, and more briefly report on the problem with the ErrorDocument.

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 
)

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

引数:
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

size_t ap_send_mmap ( apr_mmap_t mm,
request_rec r,
size_t  offset,
size_t  length 
)

Send an MMAP'ed file to the client

引数:
mm The MMAP'ed file to send
r The current request
offset The offset into the MMAP to start sending
length The amount of data to send
戻り値:
The number of bytes sent

void ap_set_content_length ( request_rec r,
apr_off_t  length 
)

Set the content length for this request

引数:
r The current request
length The new content length

void ap_set_content_type ( request_rec r,
const char *  ct 
)

Set the content type for this request (r->content_type).

引数:
r The current request
ct The new content type
警告:
This function must be called to set r->content_type in order for the AddOutputFilterByType directive to work correctly.

void ap_set_etag ( request_rec r  ) 

Set the E-tag outgoing header

引数:
r The current request

int ap_set_keepalive ( request_rec r  ) 

Set the keepalive status for this request

引数:
r The current request
戻り値:
1 if keepalive can be set, 0 otherwise

void ap_set_last_modified ( request_rec r  ) 

Set the last modified time for the file being sent

引数:
r The current request

void ap_set_sub_req_protocol ( request_rec rnew,
const request_rec r 
)

Sett up the protocol fields for subsidiary requests

引数:
rnew New Sub Request
r current request

int ap_setup_client_block ( request_rec r,
int  read_policy 
)

Setup the client to allow Apache to read the request body.

引数:
r The current request
read_policy How the server should interpret a chunked transfer-encoding. One of:
    REQUEST_NO_BODY          Send 413 error if message has any body
    REQUEST_CHUNKED_ERROR    Send 411 error if body without Content-Length
    REQUEST_CHUNKED_DECHUNK  If chunked, remove the chunks for me.
 
戻り値:
either OK or an error code

int ap_should_client_block ( request_rec r  ) 

Determine if the client has sent any data. This also sends a 100 Continue response to HTTP/1.1 clients, so modules should not be called until the module is ready to read content.

警告:
Never call this function more than once.
引数:
r The current request
戻り値:
0 if there is no message to read, 1 otherwise

int ap_vrprintf ( request_rec r,
const char *  fmt,
va_list  vlist 
)

Output data to the client in a printf format

引数:
r The current request
fmt The format string
vlist The arguments to use to fill out the format string
戻り値:
The number of bytes sent

apr_port_t default_port ( const request_rec r  ) 

Return the default port from the current request

引数:
r The current request
戻り値:
The current port

const char* http_scheme ( const request_rec r  ) 

This hook allows modules to retrieve the http scheme for a request. This allows Apache modules to easily extend the schemes that Apache understands

引数:
r The current request
戻り値:
The http scheme from the request

int log_transaction ( request_rec r  ) 

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

引数:
r The current request
戻り値:
OK, DECLINED, or HTTP_...

int post_read_request ( request_rec r  ) 

This hook allows modules to affect the request immediately after the request has been read, and before any other phases have been processes. This allows modules to make decisions based upon the input header fields

引数:
r The current request
戻り値:
OK or DECLINED


変数

AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_error

参照:
ap_bucket_type_error

AP_DECLARE_DATA ap_filter_rec_t* ap_old_write_func

This is an optimization. We keep a record of the filter_rec that stores the old_write filter, so that we can avoid strcmp's later.


Apacheに対してSun Jul 19 22:05:28 2009に生成されました。  doxygen 1.4.7