MCPcopy Create free account
hub / github.com/apache/httpd / default_handler

Function default_handler

server/core.c:4893–5058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4891}
4892
4893static int default_handler(request_rec *r)
4894{
4895 conn_rec *c = r->connection;
4896 apr_bucket_brigade *bb;
4897 apr_bucket *e;
4898 core_dir_config *d;
4899 int errstatus;
4900 apr_file_t *fd = NULL;
4901 apr_status_t status;
4902 /* XXX if/when somebody writes a content-md5 filter we either need to
4903 * remove this support or coordinate when to use the filter vs.
4904 * when to use this code
4905 * The current choice of when to compute the md5 here matches the 1.3
4906 * support fairly closely (unlike 1.3, we don't handle computing md5
4907 * when the charset is translated).
4908 */
4909 int bld_content_md5;
4910
4911 d = (core_dir_config *)ap_get_core_module_config(r->per_dir_config);
4912 bld_content_md5 = (d->content_md5 == AP_CONTENT_MD5_ON)
4913 && r->output_filters->frec->ftype != AP_FTYPE_RESOURCE;
4914
4915 ap_allow_standard_methods(r, MERGE_ALLOW, M_GET, M_OPTIONS, M_POST, -1);
4916
4917 /* If filters intend to consume the request body, they must
4918 * register an InputFilter to slurp the contents of the POST
4919 * data from the POST input stream. It no longer exists when
4920 * the output filters are invoked by the default handler.
4921 */
4922 if ((errstatus = ap_discard_request_body(r)) != OK) {
4923 return errstatus;
4924 }
4925
4926 if (r->method_number == M_GET || r->method_number == M_POST) {
4927 if (r->finfo.filetype == APR_NOFILE) {
4928 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00128)
4929 "File does not exist: %s",
4930 apr_pstrcat(r->pool, r->filename, r->path_info, NULL));
4931 return HTTP_NOT_FOUND;
4932 }
4933
4934 /* Don't try to serve a dir. Some OSs do weird things with
4935 * raw I/O on a dir.
4936 */
4937 if (r->finfo.filetype == APR_DIR) {
4938 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00129)
4939 "Attempt to serve directory: %s", r->filename);
4940 return HTTP_NOT_FOUND;
4941 }
4942
4943 if ((r->used_path_info != AP_REQ_ACCEPT_PATH_INFO) &&
4944 r->path_info && *r->path_info)
4945 {
4946 /* default to reject */
4947 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00130)
4948 "File does not exist: %s",
4949 apr_pstrcat(r->pool, r->filename, r->path_info, NULL));
4950 return HTTP_NOT_FOUND;

Callers

nothing calls this directly

Calls 12

ap_discard_request_bodyFunction · 0.85
ap_update_mtimeFunction · 0.85
ap_set_last_modifiedFunction · 0.85
ap_set_etag_fdFunction · 0.85
ap_set_accept_rangesFunction · 0.85
ap_set_content_lengthFunction · 0.85
ap_md5digestFunction · 0.85
ap_meets_conditionsFunction · 0.85
ap_pass_brigadeFunction · 0.85
ap_send_http_optionsFunction · 0.85

Tested by

no test coverage detected