Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 1295:5383f5232364
proxy_store and fastcgi_store were changed,
proxy_store_access and fastcgi_store_access were added
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 13 Jul 2007 08:30:34 +0000 |
parents | 13a4ce6e7f1e |
children | 32cdba6f2ec1 |
comparison
equal
deleted
inserted
replaced
1294:e888f8acdb46 | 1295:5383f5232364 |
---|---|
370 | 370 |
371 cln->handler = ngx_http_upstream_cleanup; | 371 cln->handler = ngx_http_upstream_cleanup; |
372 cln->data = r; | 372 cln->data = r; |
373 u->cleanup = &cln->handler; | 373 u->cleanup = &cln->handler; |
374 | 374 |
375 u->store = (u->conf->store != 0); | 375 u->store = (u->conf->store || u->conf->store_lengths); |
376 | 376 |
377 ngx_http_upstream_connect(r, u); | 377 ngx_http_upstream_connect(r, u); |
378 } | 378 } |
379 | 379 |
380 | 380 |
2027 | 2027 |
2028 temp = &u->pipe->temp_file->file.name; | 2028 temp = &u->pipe->temp_file->file.name; |
2029 | 2029 |
2030 #if !(NGX_WIN32) | 2030 #if !(NGX_WIN32) |
2031 | 2031 |
2032 if (ngx_change_file_access(temp->data, u->conf->store) == NGX_FILE_ERROR) { | 2032 if (ngx_change_file_access(temp->data, u->conf->store_access) |
2033 == NGX_FILE_ERROR) | |
2034 { | |
2033 err = ngx_errno; | 2035 err = ngx_errno; |
2034 failed = ngx_change_file_access_n; | 2036 failed = ngx_change_file_access_n; |
2035 name = temp->data; | 2037 name = temp->data; |
2036 | 2038 |
2037 goto failed; | 2039 goto failed; |
2050 != NGX_OK) | 2052 != NGX_OK) |
2051 { | 2053 { |
2052 err = ngx_errno; | 2054 err = ngx_errno; |
2053 failed = ngx_set_file_time_n; | 2055 failed = ngx_set_file_time_n; |
2054 name = temp->data; | 2056 name = temp->data; |
2055 | 2057 |
2056 goto failed; | 2058 goto failed; |
2057 } | 2059 } |
2058 } | 2060 } |
2059 } | 2061 } |
2060 | 2062 |
2061 ngx_http_map_uri_to_path(r, &path, &root, 0); | 2063 if (u->conf->store_lengths == NULL) { |
2064 | |
2065 ngx_http_map_uri_to_path(r, &path, &root, 0); | |
2066 | |
2067 } else { | |
2068 if (ngx_http_script_run(r, &path, u->conf->store_lengths->elts, 0, | |
2069 u->conf->store_values->elts) | |
2070 == NULL) | |
2071 { | |
2072 return; | |
2073 } | |
2074 } | |
2062 | 2075 |
2063 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 2076 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2064 "upstream stores \"%s\" to \"%s\"", temp->data, path.data); | 2077 "upstream stores \"%s\" to \"%s\"", temp->data, path.data); |
2065 | 2078 |
2066 failed = ngx_rename_file_n; | 2079 failed = ngx_rename_file_n; |
2072 | 2085 |
2073 err = ngx_errno; | 2086 err = ngx_errno; |
2074 | 2087 |
2075 if (err == NGX_ENOENT) { | 2088 if (err == NGX_ENOENT) { |
2076 | 2089 |
2077 err = ngx_create_full_path(path.data, ngx_dir_access(u->conf->store)); | 2090 err = ngx_create_full_path(path.data, |
2078 | 2091 ngx_dir_access(u->conf->store_access)); |
2079 if (err == 0) { | 2092 if (err == 0) { |
2080 if (ngx_rename_file(temp->data, path.data) != NGX_FILE_ERROR) { | 2093 if (ngx_rename_file(temp->data, path.data) != NGX_FILE_ERROR) { |
2081 return; | 2094 return; |
2082 } | 2095 } |
2083 | 2096 |