comparison src/http/modules/ngx_http_dav_module.c @ 322:56675f002600 NGINX_0_5_31

nginx 0.5.31 *) Feature: named locations. *) Feature: the "proxy_store" and "fastcgi_store" directives. *) Feature: the "proxy_store_access" and "fastcgi_store_access" directives.
author Igor Sysoev <http://sysoev.ru>
date Wed, 15 Aug 2007 00:00:00 +0400
parents 24def6198d7f
children
comparison
equal deleted inserted replaced
321:6762c33c7da8 322:56675f002600
55 ngx_str_t *path, ngx_uint_t dir); 55 ngx_str_t *path, ngx_uint_t dir);
56 static ngx_int_t ngx_http_dav_depth(ngx_http_request_t *r, ngx_int_t dflt); 56 static ngx_int_t ngx_http_dav_depth(ngx_http_request_t *r, ngx_int_t dflt);
57 static ngx_int_t ngx_http_dav_error(ngx_log_t *log, ngx_err_t err, 57 static ngx_int_t ngx_http_dav_error(ngx_log_t *log, ngx_err_t err,
58 ngx_int_t not_found, char *failed, u_char *path); 58 ngx_int_t not_found, char *failed, u_char *path);
59 static ngx_int_t ngx_http_dav_location(ngx_http_request_t *r, u_char *path); 59 static ngx_int_t ngx_http_dav_location(ngx_http_request_t *r, u_char *path);
60 static char *ngx_http_dav_access(ngx_conf_t *cf, ngx_command_t *cmd,
61 void *conf);
62 static void *ngx_http_dav_create_loc_conf(ngx_conf_t *cf); 60 static void *ngx_http_dav_create_loc_conf(ngx_conf_t *cf);
63 static char *ngx_http_dav_merge_loc_conf(ngx_conf_t *cf, 61 static char *ngx_http_dav_merge_loc_conf(ngx_conf_t *cf,
64 void *parent, void *child); 62 void *parent, void *child);
65 static ngx_int_t ngx_http_dav_init(ngx_conf_t *cf); 63 static ngx_int_t ngx_http_dav_init(ngx_conf_t *cf);
66 64
92 offsetof(ngx_http_dav_loc_conf_t, create_full_put_path), 90 offsetof(ngx_http_dav_loc_conf_t, create_full_put_path),
93 NULL }, 91 NULL },
94 92
95 { ngx_string("dav_access"), 93 { ngx_string("dav_access"),
96 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123, 94 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
97 ngx_http_dav_access, 95 ngx_conf_set_access_slot,
98 NGX_HTTP_LOC_CONF_OFFSET, 96 NGX_HTTP_LOC_CONF_OFFSET,
99 0, 97 offsetof(ngx_http_dav_loc_conf_t, access),
100 NULL }, 98 NULL },
101 99
102 ngx_null_command 100 ngx_null_command
103 }; 101 };
104 102
1104 1102
1105 return NGX_OK; 1103 return NGX_OK;
1106 } 1104 }
1107 1105
1108 1106
1109 static char *
1110 ngx_http_dav_access(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1111 {
1112 ngx_http_dav_loc_conf_t *lcf = conf;
1113
1114 u_char *p;
1115 ngx_str_t *value;
1116 ngx_uint_t i, right, shift;
1117
1118 if (lcf->access != NGX_CONF_UNSET_UINT) {
1119 return "is duplicate";
1120 }
1121
1122 value = cf->args->elts;
1123
1124 lcf->access = 0600;
1125
1126 for (i = 1; i < cf->args->nelts; i++) {
1127
1128 p = value[i].data;
1129
1130 if (ngx_strncmp(p, "user:", sizeof("user:") - 1) == 0) {
1131 shift = 6;
1132 p += sizeof("user:") - 1;
1133
1134 } else if (ngx_strncmp(p, "group:", sizeof("group:") - 1) == 0) {
1135 shift = 3;
1136 p += sizeof("group:") - 1;
1137
1138 } else if (ngx_strncmp(p, "all:", sizeof("all:") - 1) == 0) {
1139 shift = 0;
1140 p += sizeof("all:") - 1;
1141
1142 } else {
1143 goto invalid;
1144 }
1145
1146 if (ngx_strcmp(p, "rw") == 0) {
1147 right = 6;
1148
1149 } else if (ngx_strcmp(p, "r") == 0) {
1150 right = 4;
1151
1152 } else {
1153 goto invalid;
1154 }
1155
1156 lcf->access |= right << shift;
1157 }
1158
1159 return NGX_CONF_OK;
1160
1161 invalid:
1162
1163 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1164 "invalid value \"%V\"", &value[i]);
1165 return NGX_CONF_ERROR;
1166 }
1167
1168
1169 static void * 1107 static void *
1170 ngx_http_dav_create_loc_conf(ngx_conf_t *cf) 1108 ngx_http_dav_create_loc_conf(ngx_conf_t *cf)
1171 { 1109 {
1172 ngx_http_dav_loc_conf_t *conf; 1110 ngx_http_dav_loc_conf_t *conf;
1173 1111