Lines Matching refs:r

16 static void test_mod_staticfile_reset (request_st * const r)  in test_mod_staticfile_reset()  argument
18 r->http_status = 0; in test_mod_staticfile_reset()
19 r->resp_htags = 0; in test_mod_staticfile_reset()
20 array_reset_data_strings(&r->resp_headers); in test_mod_staticfile_reset()
21 http_response_body_clear(r, 0); in test_mod_staticfile_reset()
22 r->conf.etag_flags = ETAG_USE_INODE | ETAG_USE_MTIME | ETAG_USE_SIZE; in test_mod_staticfile_reset()
27 run_http_response_send_file (request_st * const r, int line, int status, const char *desc) in run_http_response_send_file() argument
29 http_response_send_file(r, &r->physical.path, NULL); in run_http_response_send_file()
30 if (r->http_status != status) { in run_http_response_send_file()
34 r->http_status, desc); in run_http_response_send_file()
41 test_http_response_send_file (request_st * const r, time_t lmtime) in test_http_response_send_file() argument
43 test_mod_staticfile_reset(r); in test_http_response_send_file()
48 const array * const mimetypes_orig = r->conf.mimetypes; in test_http_response_send_file()
49 r->conf.mimetypes = mimetypes_empty; in test_http_response_send_file()
50 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
52 vb = http_header_response_get(r, HTTP_HEADER_CONTENT_TYPE, in test_http_response_send_file()
55 test_mod_staticfile_reset(r); in test_http_response_send_file()
56 r->conf.mimetypes = mimetypes_orig; in test_http_response_send_file()
59 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
61 vb = http_header_response_get(r, HTTP_HEADER_CONTENT_TYPE, in test_http_response_send_file()
64 vb = http_header_response_get(r, HTTP_HEADER_ETAG, in test_http_response_send_file()
67 vb = http_header_response_get(r, HTTP_HEADER_LAST_MODIFIED, in test_http_response_send_file()
70 test_mod_staticfile_reset(r); in test_http_response_send_file()
72 const uint32_t plen = buffer_clen(&r->physical.path); in test_http_response_send_file()
73 buffer_append_string_len(&r->physical.path, CONST_STR_LEN("-nonexistent")); in test_http_response_send_file()
74 run_http_response_send_file(r, __LINE__, 404, in test_http_response_send_file()
76 test_mod_staticfile_reset(r); in test_http_response_send_file()
77 buffer_truncate(&r->physical.path, plen); in test_http_response_send_file()
79 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
82 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
84 test_mod_staticfile_reset(r); in test_http_response_send_file()
86 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
89 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
91 test_mod_staticfile_reset(r); in test_http_response_send_file()
93 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
96 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
98 test_mod_staticfile_reset(r); in test_http_response_send_file()
105 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
108 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
110 test_mod_staticfile_reset(r); in test_http_response_send_file()
113 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
116 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
118 test_mod_staticfile_reset(r); in test_http_response_send_file()
121 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
124 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
126 test_mod_staticfile_reset(r); in test_http_response_send_file()
129 force_assert(http_header_request_get(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
133 http_header_request_get(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
136 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
138 test_mod_staticfile_reset(r); in test_http_response_send_file()
140 http_header_request_unset(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
144 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
147 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
149 vb = http_header_response_get(r, HTTP_HEADER_ETAG, in test_http_response_send_file()
153 test_mod_staticfile_reset(r); in test_http_response_send_file()
155 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
158 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
160 test_mod_staticfile_reset(r); in test_http_response_send_file()
162 r->conf.etag_flags = 0; in test_http_response_send_file()
163 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
166 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
168 test_mod_staticfile_reset(r); in test_http_response_send_file()
169 r->conf.etag_flags = ETAG_USE_INODE | ETAG_USE_MTIME | ETAG_USE_SIZE; in test_http_response_send_file()
171 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
176 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
179 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
182 test_mod_staticfile_reset(r); in test_http_response_send_file()
184 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
188 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
191 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
194 test_mod_staticfile_reset(r); in test_http_response_send_file()
196 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
199 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
202 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
205 test_mod_staticfile_reset(r); in test_http_response_send_file()
207 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
212 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
215 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
218 test_mod_staticfile_reset(r); in test_http_response_send_file()
220 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
224 http_header_request_set(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
227 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
230 test_mod_staticfile_reset(r); in test_http_response_send_file()
232 http_header_request_unset(r, HTTP_HEADER_IF_MODIFIED_SINCE, in test_http_response_send_file()
235 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
238 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
240 test_mod_staticfile_reset(r); in test_http_response_send_file()
242 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
245 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
247 test_mod_staticfile_reset(r); in test_http_response_send_file()
249 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
252 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
254 test_mod_staticfile_reset(r); in test_http_response_send_file()
256 http_header_request_set(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
259 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
261 test_mod_staticfile_reset(r); in test_http_response_send_file()
264 http_header_request_set_ptr(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
269 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
271 test_mod_staticfile_reset(r); in test_http_response_send_file()
274 http_header_request_set(r, HTTP_HEADER_RANGE, in test_http_response_send_file()
277 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
279 test_mod_staticfile_reset(r); in test_http_response_send_file()
280 http_header_request_unset(r, HTTP_HEADER_RANGE, CONST_STR_LEN("Range")); in test_http_response_send_file()
283 run_http_response_send_file(r, __LINE__, 200, in test_http_response_send_file()
285 test_mod_staticfile_reset(r); in test_http_response_send_file()
289 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
291 test_mod_staticfile_reset(r); in test_http_response_send_file()
295 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
297 test_mod_staticfile_reset(r); in test_http_response_send_file()
301 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
303 test_mod_staticfile_reset(r); in test_http_response_send_file()
308 run_http_response_send_file(r, __LINE__, 304, in test_http_response_send_file()
310 test_mod_staticfile_reset(r); in test_http_response_send_file()
312 http_header_request_unset(r, HTTP_HEADER_IF_NONE_MATCH, in test_http_response_send_file()
320 run_mod_staticfile_process (request_st * const r, plugin_config * const pconf, int line, int status… in run_mod_staticfile_process() argument
322 handler_t rc = mod_staticfile_process(r, pconf); in run_mod_staticfile_process()
323 if (r->http_status != status in run_mod_staticfile_process()
328 r->http_status, desc); in run_mod_staticfile_process()
335 test_mod_staticfile_process (request_st * const r, plugin_config * const pconf) in test_mod_staticfile_process() argument
337 test_mod_staticfile_reset(r); in test_mod_staticfile_process()
340 buffer_copy_string_len(&r->pathinfo, CONST_STR_LEN("/pathinfo")); in test_mod_staticfile_process()
341 run_mod_staticfile_process(r, pconf, __LINE__, 200, in test_mod_staticfile_process()
343 test_mod_staticfile_reset(r); in test_mod_staticfile_process()
345 run_mod_staticfile_process(r, pconf, __LINE__, 0, in test_mod_staticfile_process()
347 test_mod_staticfile_reset(r); in test_mod_staticfile_process()
348 buffer_clear(&r->pathinfo); in test_mod_staticfile_process()
349 run_mod_staticfile_process(r, pconf, __LINE__, 200, in test_mod_staticfile_process()
351 test_mod_staticfile_reset(r); in test_mod_staticfile_process()
357 run_mod_staticfile_process(r, pconf, __LINE__, 200, in test_mod_staticfile_process()
359 test_mod_staticfile_reset(r); in test_mod_staticfile_process()
360 buffer_append_string_len(&r->physical.path, CONST_STR_LEN(".exe")); in test_mod_staticfile_process()
361 run_mod_staticfile_process(r, pconf, __LINE__, 0, in test_mod_staticfile_process()
363 test_mod_staticfile_reset(r); in test_mod_staticfile_process()
394 request_st r; in test_mod_staticfile() local
396 memset(&r, 0, sizeof(request_st)); in test_mod_staticfile()
397 r.http_method = HTTP_METHOD_GET; in test_mod_staticfile()
398 r.http_version = HTTP_VERSION_1_1; in test_mod_staticfile()
399 r.tmp_buf = buffer_init(); in test_mod_staticfile()
400 r.conf.errh = fdlog_init(NULL, -1, FDLOG_FD); in test_mod_staticfile()
401 r.conf.errh->fd = -1; /* (disable) */ in test_mod_staticfile()
402 r.conf.follow_symlink = 1; in test_mod_staticfile()
403 buffer_copy_string_len(&r.uri.path, CONST_STR_LEN("/")); in test_mod_staticfile()
405 r.conf.mimetypes = mimetypes; in test_mod_staticfile()
411 buffer_copy_string_len(&r.physical.path, fn, sizeof(fn)-1); in test_mod_staticfile()
412 test_http_response_send_file(&r, st.st_mtime); in test_mod_staticfile()
414 r.rqst_htags = 0; in test_mod_staticfile()
415 array_reset_data_strings(&r.rqst_headers); in test_mod_staticfile()
417 buffer_copy_string_len(&r.physical.path, fn, sizeof(fn)-1); in test_mod_staticfile()
418 test_mod_staticfile_process(&r, &p->conf); in test_mod_staticfile()
421 fdlog_free(r.conf.errh); in test_mod_staticfile()
422 buffer_free(r.tmp_buf); in test_mod_staticfile()
423 chunkqueue_reset(&r.write_queue); in test_mod_staticfile()
425 free(r.uri.path.ptr); in test_mod_staticfile()
426 free(r.pathinfo.ptr); in test_mod_staticfile()
427 free(r.physical.path.ptr); in test_mod_staticfile()
428 free(r.physical.rel_path.ptr); in test_mod_staticfile()
429 free(r.physical.doc_root.ptr); in test_mod_staticfile()
430 array_free_data(&r.rqst_headers); in test_mod_staticfile()
431 array_free_data(&r.resp_headers); in test_mod_staticfile()