Lines Matching refs:con
120 static int mod_staticfile_patch_connection(server *srv, connection *con, plugin_data *p) { in mod_staticfile_patch_connection() argument
134 if (!config_check_cond(srv, con, dc)) continue; in mod_staticfile_patch_connection()
154 static int http_response_parse_range(server *srv, connection *con, plugin_data *p) { in http_response_parse_range() argument
164 if (HANDLER_ERROR == stat_cache_get_entry(srv, con, con->physical.path, &sce)) { in http_response_parse_range()
171 con->response.content_length = 0; in http_response_parse_range()
173 if (NULL != (ds = (data_string *)array_get_element(con->response.headers, "Content-Type"))) { in http_response_parse_range()
177 for (s = con->request.http_range, error = 0; in http_response_parse_range()
190 con->http_status = 416; in http_response_parse_range()
281 con->http_status = 416; in http_response_parse_range()
290 b = chunkqueue_get_append_buffer(con->write_queue); in http_response_parse_range()
309 con->response.content_length += b->used - 1; in http_response_parse_range()
313 chunkqueue_append_file(con->write_queue, con->physical.path, start, end - start + 1); in http_response_parse_range()
314 con->response.content_length += end - start + 1; in http_response_parse_range()
325 b = chunkqueue_get_append_buffer(con->write_queue); in http_response_parse_range()
331 con->response.content_length += b->used - 1; in http_response_parse_range()
339 response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(p->range_buf)); in http_response_parse_range()
350 response_header_insert(srv, con, CONST_STR_LEN("Content-Range"), CONST_BUF_LEN(p->range_buf)); in http_response_parse_range()
366 if (con->http_status != 0) return HANDLER_GO_ON; in URIHANDLER_FUNC()
367 if (con->uri.path->used == 0) return HANDLER_GO_ON; in URIHANDLER_FUNC()
368 if (con->physical.path->used == 0) return HANDLER_GO_ON; in URIHANDLER_FUNC()
371 if (con->mode != DIRECT) return HANDLER_GO_ON; in URIHANDLER_FUNC()
374 switch(con->request.http_method) { in URIHANDLER_FUNC()
383 mod_staticfile_patch_connection(srv, con, p); in URIHANDLER_FUNC()
385 if (p->conf.disable_pathinfo && 0 != con->request.pathinfo->used) { in URIHANDLER_FUNC()
386 if (con->conf.log_request_handling) { in URIHANDLER_FUNC()
398 if (buffer_is_equal_right_len(con->physical.path, ds->value, ds->value->used - 1)) { in URIHANDLER_FUNC()
399 if (con->conf.log_request_handling) { in URIHANDLER_FUNC()
407 if (con->conf.log_request_handling) { in URIHANDLER_FUNC()
411 if (HANDLER_ERROR == stat_cache_get_entry(srv, con, con->physical.path, &sce)) { in URIHANDLER_FUNC()
412 con->http_status = 403; in URIHANDLER_FUNC()
415 "not a regular file:", con->uri.path, in URIHANDLER_FUNC()
416 "->", con->physical.path); in URIHANDLER_FUNC()
423 if ((sce->is_symlink == 1) && !con->conf.follow_symlink) { in URIHANDLER_FUNC()
424 con->http_status = 403; in URIHANDLER_FUNC()
426 if (con->conf.log_request_handling) { in URIHANDLER_FUNC()
428 log_error_write(srv, __FILE__, __LINE__, "sb", "Path :", con->physical.path); in URIHANDLER_FUNC()
431 buffer_reset(con->physical.path); in URIHANDLER_FUNC()
436 con->http_status = 404; in URIHANDLER_FUNC()
438 if (con->conf.log_file_not_found) { in URIHANDLER_FUNC()
440 "not a regular file:", con->uri.path, in URIHANDLER_FUNC()
451 if (NULL == array_get_element(con->response.headers, "Content-Type")) { in URIHANDLER_FUNC()
459 …response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("application/octe… in URIHANDLER_FUNC()
463 …response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(sce->content_type… in URIHANDLER_FUNC()
467 if (con->conf.range_requests) { in URIHANDLER_FUNC()
468 response_header_overwrite(srv, con, CONST_STR_LEN("Accept-Ranges"), CONST_STR_LEN("bytes")); in URIHANDLER_FUNC()
472 if (p->conf.etags_used && con->etag_flags != 0 && !buffer_is_empty(sce->etag)) { in URIHANDLER_FUNC()
473 if (NULL == array_get_element(con->response.headers, "ETag")) { in URIHANDLER_FUNC()
475 etag_mutate(con->physical.etag, sce->etag); in URIHANDLER_FUNC()
477 response_header_overwrite(srv, con, CONST_STR_LEN("ETag"), CONST_BUF_LEN(con->physical.etag)); in URIHANDLER_FUNC()
482 if (NULL == (ds = (data_string *)array_get_element(con->response.headers, "Last-Modified"))) { in URIHANDLER_FUNC()
484 response_header_overwrite(srv, con, CONST_STR_LEN("Last-Modified"), CONST_BUF_LEN(mtime)); in URIHANDLER_FUNC()
489 if (HANDLER_FINISHED == http_response_handle_cachable(srv, con, mtime)) { in URIHANDLER_FUNC()
494 if (con->request.http_range && con->conf.range_requests) { in URIHANDLER_FUNC()
498 if (NULL != (ds = (data_string *)array_get_element(con->request.headers, "If-Range"))) { in URIHANDLER_FUNC()
506 if (!con->physical.etag) { in URIHANDLER_FUNC()
508 } else if (!buffer_is_equal(ds->value, con->physical.etag)) { in URIHANDLER_FUNC()
525 con->file_finished = 1; in URIHANDLER_FUNC()
527 if (0 == http_response_parse_range(srv, con, p)) { in URIHANDLER_FUNC()
528 con->http_status = 206; in URIHANDLER_FUNC()
539 http_chunk_append_file(srv, con, con->physical.path, 0, sce->st.st_size); in URIHANDLER_FUNC()
541 con->http_status = 200; in URIHANDLER_FUNC()
542 con->file_finished = 1; in URIHANDLER_FUNC()