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

Function virtualhost_section

server/core.c:2943–2994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2941/* httpd.conf commands... beginning with the <VirtualHost> business */
2942
2943static const char *virtualhost_section(cmd_parms *cmd, void *dummy,
2944 const char *arg)
2945{
2946 server_rec *main_server = cmd->server, *s;
2947 const char *errmsg;
2948 const char *endp = ap_strrchr_c(arg, '>');
2949 apr_pool_t *p = cmd->pool;
2950
2951 const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
2952 if (err != NULL) {
2953 return err;
2954 }
2955
2956 if (endp == NULL) {
2957 return unclosed_directive(cmd);
2958 }
2959
2960 arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg);
2961
2962 if (!arg[0]) {
2963 return missing_container_arg(cmd);
2964 }
2965
2966 /* FIXME: There's another feature waiting to happen here -- since you
2967 can now put multiple addresses/names on a single <VirtualHost>
2968 you might want to use it to group common definitions and then
2969 define other "subhosts" with their individual differences. But
2970 personally I'd rather just do it with a macro preprocessor. -djg */
2971 if (main_server->is_virtual) {
2972 return "<VirtualHost> doesn't nest!";
2973 }
2974
2975 errmsg = ap_init_virtual_host(p, arg, main_server, &s);
2976 if (errmsg) {
2977 return errmsg;
2978 }
2979
2980 s->next = main_server->next;
2981 main_server->next = s;
2982
2983 s->defn_name = cmd->directive->filename;
2984 s->defn_line_number = cmd->directive->line_num;
2985
2986 cmd->server = s;
2987
2988 errmsg = ap_walk_config(cmd->directive->first_child, cmd,
2989 s->lookup_defaults);
2990
2991 cmd->server = main_server;
2992
2993 return errmsg;
2994}
2995
2996static const char *set_regex_default_options(cmd_parms *cmd,
2997 void *dummy,

Callers

nothing calls this directly

Calls 6

ap_strrchr_cFunction · 0.85
ap_check_cmd_contextFunction · 0.85
unclosed_directiveFunction · 0.85
missing_container_argFunction · 0.85
ap_init_virtual_hostFunction · 0.85
ap_walk_configFunction · 0.85

Tested by

no test coverage detected