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

Function handle_map_file

modules/mappers/mod_negotiation.c:2954–3071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2952}
2953
2954static int handle_map_file(request_rec *r)
2955{
2956 negotiation_state *neg;
2957 apr_file_t *map;
2958 var_rec *best;
2959 int res;
2960 char *udir;
2961 const char *new_req;
2962
2963 if (strcmp(r->handler, MAP_FILE_MAGIC_TYPE) && strcmp(r->handler, "type-map")) {
2964 return DECLINED;
2965 }
2966
2967 neg = parse_accept_headers(r);
2968 if ((res = read_type_map(&map, neg, r))) {
2969 return res;
2970 }
2971
2972 res = do_negotiation(r, neg, &best, 0);
2973 if (res != 0) {
2974 return res;
2975 }
2976
2977 if (best->body)
2978 {
2979 conn_rec *c = r->connection;
2980 apr_bucket_brigade *bb;
2981 apr_bucket *e;
2982
2983 ap_allow_standard_methods(r, REPLACE_ALLOW, M_GET, M_OPTIONS,
2984 M_POST, -1);
2985 /* XXX: ?
2986 * if (r->method_number == M_OPTIONS) {
2987 * return ap_send_http_options(r);
2988 *}
2989 */
2990 if (r->method_number != M_GET && r->method_number != M_POST) {
2991 return HTTP_METHOD_NOT_ALLOWED;
2992 }
2993
2994 /* ### These may be implemented by adding some 'extra' info
2995 * of the file offset onto the etag
2996 * ap_update_mtime(r, r->finfo.mtime);
2997 * ap_set_last_modified(r);
2998 * ap_set_etag(r);
2999 */
3000 ap_set_accept_ranges(r);
3001 ap_set_content_length(r, best->bytes);
3002
3003 /* set MIME type and charset as negotiated */
3004 if (best->mime_type && *best->mime_type) {
3005 if (best->content_charset && *best->content_charset) {
3006 ap_set_content_type_ex(r, apr_pstrcat(r->pool,
3007 best->mime_type,
3008 "; charset=",
3009 best->content_charset,
3010 NULL), 1);
3011 }

Callers

nothing calls this directly

Calls 13

parse_accept_headersFunction · 0.85
read_type_mapFunction · 0.85
do_negotiationFunction · 0.85
ap_set_accept_rangesFunction · 0.85
ap_set_content_lengthFunction · 0.85
ap_set_content_type_exFunction · 0.85
ap_meets_conditionsFunction · 0.85
ap_discard_request_bodyFunction · 0.85
ap_pass_brigade_fchkFunction · 0.85
ap_find_path_infoFunction · 0.85
ap_make_dirstr_parentFunction · 0.85

Tested by

no test coverage detected