Mercurial > hg > nginx
comparison src/http/ngx_http_script.c @ 2758:77264e0157ad
-p and --prefix=
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 27 Apr 2009 11:32:33 +0000 |
parents | 09cab3f8d92e |
children | 32b444fa2ca4 501fd3ae3188 |
comparison
equal
deleted
inserted
replaced
2757:9cc973b46af1 | 2758:77264e0157ad |
---|---|
1211 if (code == NULL) { | 1211 if (code == NULL) { |
1212 return NGX_ERROR; | 1212 return NGX_ERROR; |
1213 } | 1213 } |
1214 | 1214 |
1215 code->code = (ngx_http_script_code_pt) ngx_http_script_full_name_len_code; | 1215 code->code = (ngx_http_script_code_pt) ngx_http_script_full_name_len_code; |
1216 code->prefix = sc->conf_prefix; | 1216 code->conf_prefix = sc->conf_prefix; |
1217 | 1217 |
1218 code = ngx_http_script_add_code(*sc->values, | 1218 code = ngx_http_script_add_code(*sc->values, |
1219 sizeof(ngx_http_script_full_name_code_t), | 1219 sizeof(ngx_http_script_full_name_code_t), |
1220 &sc->main); | 1220 &sc->main); |
1221 if (code == NULL) { | 1221 if (code == NULL) { |
1222 return NGX_ERROR; | 1222 return NGX_ERROR; |
1223 } | 1223 } |
1224 | 1224 |
1225 code->code = ngx_http_script_full_name_code; | 1225 code->code = ngx_http_script_full_name_code; |
1226 code->prefix = sc->conf_prefix; | 1226 code->conf_prefix = sc->conf_prefix; |
1227 | 1227 |
1228 return NGX_OK; | 1228 return NGX_OK; |
1229 } | 1229 } |
1230 | 1230 |
1231 | 1231 |
1236 | 1236 |
1237 code = (ngx_http_script_full_name_code_t *) e->ip; | 1237 code = (ngx_http_script_full_name_code_t *) e->ip; |
1238 | 1238 |
1239 e->ip += sizeof(ngx_http_script_full_name_code_t); | 1239 e->ip += sizeof(ngx_http_script_full_name_code_t); |
1240 | 1240 |
1241 return code->prefix ? sizeof(NGX_CONF_PREFIX) : ngx_cycle->root.len; | 1241 return code->conf_prefix ? ngx_cycle->conf_prefix.len: |
1242 ngx_cycle->prefix.len; | |
1242 } | 1243 } |
1243 | 1244 |
1244 | 1245 |
1245 static void | 1246 static void |
1246 ngx_http_script_full_name_code(ngx_http_script_engine_t *e) | 1247 ngx_http_script_full_name_code(ngx_http_script_engine_t *e) |
1252 code = (ngx_http_script_full_name_code_t *) e->ip; | 1253 code = (ngx_http_script_full_name_code_t *) e->ip; |
1253 | 1254 |
1254 value.data = e->buf.data; | 1255 value.data = e->buf.data; |
1255 value.len = e->pos - e->buf.data; | 1256 value.len = e->pos - e->buf.data; |
1256 | 1257 |
1257 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &value, code->prefix) | 1258 if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &value, code->conf_prefix) |
1258 != NGX_OK) | 1259 != NGX_OK) |
1259 { | 1260 { |
1260 e->ip = ngx_http_script_exit; | 1261 e->ip = ngx_http_script_exit; |
1261 e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; | 1262 e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; |
1262 return; | 1263 return; |