95 { |
95 { |
96 char *path = pblock_findkeyval (pb_key_path, rq -> vars); |
96 char *path = pblock_findkeyval (pb_key_path, rq -> vars); |
97 char *path_info = pblock_findkeyval (pb_key_path_info , rq -> vars); |
97 char *path_info = pblock_findkeyval (pb_key_path_info , rq -> vars); |
98 char *script_name = pblock_findkeyval (pb_key_script_name, rq -> vars); |
98 char *script_name = pblock_findkeyval (pb_key_script_name, rq -> vars); |
99 //NSFCFileInfo *finfo = NULL; |
99 //NSFCFileInfo *finfo = NULL; |
100 struct stat *finfo; |
100 struct stat stbuf; |
|
101 struct stat *finfo = NULL; |
101 |
102 |
102 rq->directive_is_cacheable = 1; |
103 rq->directive_is_cacheable = 1; |
103 |
104 |
104 if (path_info != NULL || script_name != NULL || path == NULL) |
105 if (path_info != NULL || script_name != NULL || path == NULL) |
105 return REQ_NOACTION;// ruslan: bail out right away for performance (no need to go into file cache) |
106 return REQ_NOACTION;// ruslan: bail out right away for performance (no need to go into file cache) |
140 if (path_info == path) |
141 if (path_info == path) |
141 break; |
142 break; |
142 |
143 |
143 *path_info = '\0'; |
144 *path_info = '\0'; |
144 //if ((INTrequest_info_path(path, rq, &finfo) == PR_SUCCESS) && finfo) { |
145 //if ((INTrequest_info_path(path, rq, &finfo) == PR_SUCCESS) && finfo) { |
145 if((finfo = request_stat_path(path, rq)) != NULL) { |
146 struct stat *st = request_stat_path(path, rq); |
|
147 if(st) { |
|
148 finfo = &stbuf; |
|
149 stbuf = *st; |
|
150 free(st); |
|
151 } |
|
152 if(finfo) { |
146 //if (finfo->pr.type != PR_FILE_FILE) { |
153 //if (finfo->pr.type != PR_FILE_FILE) { |
147 if(S_ISDIR(finfo->st_mode)) { |
154 if(S_ISDIR(finfo->st_mode)) { |
148 *path_info = FILE_PATHSEP; |
155 *path_info = FILE_PATHSEP; |
149 if (set_path_info(rq, pblock_findkeyval(pb_key_uri, rq->reqpb), 0)) { |
156 if (set_path_info(rq, pblock_findkeyval(pb_key_uri, rq->reqpb), 0)) { |
150 free(finfo); |
|
151 return REQ_PROCEED; |
157 return REQ_PROCEED; |
152 } |
158 } |
153 break; |
159 break; |
154 } else { |
160 } else { |
155 set_path_info(rq, pblock_findkeyval(pb_key_uri, rq->reqpb), path_info_depth); |
161 set_path_info(rq, pblock_findkeyval(pb_key_uri, rq->reqpb), path_info_depth); |
156 free(finfo); |
|
157 return REQ_PROCEED; |
162 return REQ_PROCEED; |
158 } |
163 } |
159 } else { |
164 } else { |
160 *path_info-- = FILE_PATHSEP; |
165 *path_info-- = FILE_PATHSEP; |
161 } |
166 } |
183 break; |
188 break; |
184 } |
189 } |
185 |
190 |
186 *path_info = '\0'; |
191 *path_info = '\0'; |
187 //if ((INTrequest_info_path(path, rq, &finfo) == PR_SUCCESS) && finfo) { |
192 //if ((INTrequest_info_path(path, rq, &finfo) == PR_SUCCESS) && finfo) { |
188 if((finfo = request_stat_path(path, rq)) != NULL) { |
193 struct stat *st = request_stat_path(path, rq); |
|
194 if(st) { |
|
195 stbuf = *st; |
|
196 finfo = &stbuf; |
|
197 free(st); |
|
198 } |
|
199 if(finfo) { |
189 //if (finfo->pr.type != PR_FILE_FILE) { |
200 //if (finfo->pr.type != PR_FILE_FILE) { |
190 if(S_ISDIR(finfo->st_mode)) { |
201 if(S_ISDIR(finfo->st_mode)) { |
191 *path_info++ = FILE_PATHSEP; |
202 *path_info++ = FILE_PATHSEP; |
192 } else { |
203 } else { |
193 char *uri = pblock_findkeyval(pb_key_uri, rq->reqpb); |
204 char *uri = pblock_findkeyval(pb_key_uri, rq->reqpb); |