6 #include "stat_cache.h"
9 #include "configfile.h"
13 #include <sys/types.h>
28 #include "sys-socket.h"
31 int http_response_write_header(server
*srv
, connection
*con
) {
39 if (con
->request
.http_version
== HTTP_VERSION_1_1
) {
40 buffer_copy_string_len(b
, CONST_STR_LEN("HTTP/1.1 "));
42 buffer_copy_string_len(b
, CONST_STR_LEN("HTTP/1.0 "));
44 buffer_append_int(b
, con
->http_status
);
45 buffer_append_string_len(b
, CONST_STR_LEN(" "));
46 buffer_append_string(b
, get_http_status_name(con
->http_status
));
48 /* disable keep-alive if requested */
49 if (con
->request_count
> con
->conf
.max_keep_alive_requests
|| 0 == con
->conf
.max_keep_alive_idle
) {
52 con
->keep_alive_idle
= con
->conf
.max_keep_alive_idle
;
55 if (con
->request
.http_version
!= HTTP_VERSION_1_1
|| con
->keep_alive
== 0) {
56 if (con
->keep_alive
) {
57 response_header_overwrite(srv
, con
, CONST_STR_LEN("Connection"), CONST_STR_LEN("keep-alive"));
59 response_header_overwrite(srv
, con
, CONST_STR_LEN("Connection"), CONST_STR_LEN("close"));
63 if (con
->response
.transfer_encoding
& HTTP_TRANSFER_ENCODING_CHUNKED
) {
64 response_header_overwrite(srv
, con
, CONST_STR_LEN("Transfer-Encoding"), CONST_STR_LEN("chunked"));
69 for (i
= 0; i
< con
->response
.headers
->used
; i
++) {
72 ds
= (data_string
*)con
->response
.headers
->data
[i
];
74 if (!buffer_is_empty(ds
->value
) && !buffer_is_empty(ds
->key
) &&
75 0 != strncasecmp(ds
->key
->ptr
, CONST_STR_LEN("X-LIGHTTPD-")) &&
76 0 != strncasecmp(ds
->key
->ptr
, CONST_STR_LEN("X-Sendfile"))) {
77 if (0 == strcasecmp(ds
->key
->ptr
, "Date")) have_date
= 1;
78 if (0 == strcasecmp(ds
->key
->ptr
, "Server")) have_server
= 1;
79 if (0 == strcasecmp(ds
->key
->ptr
, "Content-Encoding") && 304 == con
->http_status
) continue;
81 buffer_append_string_len(b
, CONST_STR_LEN("\r\n"));
82 buffer_append_string_buffer(b
, ds
->key
);
83 buffer_append_string_len(b
, CONST_STR_LEN(": "));
86 * the value might contain newlines, encode them with at least one white-space
88 buffer_append_string_encoded(b
, CONST_BUF_LEN(ds
->value
), ENCODING_HTTP_HEADER
);
90 buffer_append_string_buffer(b
, ds
->value
);
96 /* HTTP/1.1 requires a Date: header */
97 buffer_append_string_len(b
, CONST_STR_LEN("\r\nDate: "));
99 /* cache the generated timestamp */
100 if (srv
->cur_ts
!= srv
->last_generated_date_ts
) {
101 buffer_string_prepare_copy(srv
->ts_date_str
, 255);
103 buffer_append_strftime(srv
->ts_date_str
, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&(srv
->cur_ts
)));
105 srv
->last_generated_date_ts
= srv
->cur_ts
;
108 buffer_append_string_buffer(b
, srv
->ts_date_str
);
112 if (buffer_is_empty(con
->conf
.server_tag
)) {
113 buffer_append_string_len(b
, CONST_STR_LEN("\r\nServer: " PACKAGE_DESC
));
114 } else if (!buffer_string_is_empty(con
->conf
.server_tag
)) {
115 buffer_append_string_len(b
, CONST_STR_LEN("\r\nServer: "));
116 buffer_append_string_encoded(b
, CONST_BUF_LEN(con
->conf
.server_tag
), ENCODING_HTTP_HEADER
);
120 buffer_append_string_len(b
, CONST_STR_LEN("\r\n\r\n"));
122 con
->bytes_header
= buffer_string_length(b
);
124 if (con
->conf
.log_response_header
) {
125 log_error_write(srv
, __FILE__
, __LINE__
, "sSb", "Response-Header:", "\n", b
);
128 chunkqueue_prepend_buffer(con
->write_queue
, b
);
135 static void https_add_ssl_entries(connection
*con
) {
142 SSL_get_verify_result(con
->ssl
) != X509_V_OK
143 || !(xs
= SSL_get_peer_certificate(con
->ssl
))
148 xn
= X509_get_subject_name(xs
);
149 for (i
= 0, nentries
= X509_NAME_entry_count(xn
); i
< nentries
; ++i
) {
154 if (!(xe
= X509_NAME_get_entry(xn
, i
))) {
157 xobjnid
= OBJ_obj2nid((ASN1_OBJECT
*)X509_NAME_ENTRY_get_object(xe
));
158 xobjsn
= OBJ_nid2sn(xobjnid
);
163 if (NULL
== (envds
= (data_string
*)array_get_unused_element(con
->environment
, TYPE_STRING
))) {
164 envds
= data_string_init();
166 buffer_copy_string_len(envds
->key
, CONST_STR_LEN("SSL_CLIENT_S_DN_"));
167 buffer_append_string(envds
->key
, xobjsn
);
168 buffer_copy_string_len(
170 (const char *)X509_NAME_ENTRY_get_data(xe
)->data
,
171 X509_NAME_ENTRY_get_data(xe
)->length
173 /* pick one of the exported values as "REMOTE_USER", for example
174 * ssl.verifyclient.username = "SSL_CLIENT_S_DN_UID" or "SSL_CLIENT_S_DN_emailAddress"
176 if (buffer_is_equal(con
->conf
.ssl_verifyclient_username
, envds
->key
)) {
178 if (NULL
== (ds
= (data_string
*)array_get_element(con
->environment
, "REMOTE_USER"))) {
179 if (NULL
== (ds
= (data_string
*)array_get_unused_element(con
->environment
, TYPE_STRING
))) {
180 ds
= data_string_init();
182 buffer_copy_string(ds
->key
, "REMOTE_USER");
183 array_insert_unique(con
->environment
, (data_unset
*)ds
);
185 buffer_copy_buffer(ds
->value
, envds
->value
);
187 array_insert_unique(con
->environment
, (data_unset
*)envds
);
189 if (con
->conf
.ssl_verifyclient_export_cert
) {
191 if (NULL
!= (bio
= BIO_new(BIO_s_mem()))) {
195 PEM_write_bio_X509(bio
, xs
);
196 n
= BIO_pending(bio
);
198 if (NULL
== (envds
= (data_string
*)array_get_unused_element(con
->environment
, TYPE_STRING
))) {
199 envds
= data_string_init();
202 buffer_copy_string_len(envds
->key
, CONST_STR_LEN("SSL_CLIENT_CERT"));
203 buffer_string_prepare_copy(envds
->value
, n
);
204 BIO_read(bio
, envds
->value
->ptr
, n
);
206 buffer_commit(envds
->value
, n
);
207 array_insert_unique(con
->environment
, (data_unset
*)envds
);
215 handler_t
http_response_prepare(server
*srv
, connection
*con
) {
218 /* looks like someone has already done a decision */
219 if (con
->mode
== DIRECT
&&
220 (con
->http_status
!= 0 && con
->http_status
!= 200)) {
221 /* remove a packets in the queue */
222 if (con
->file_finished
== 0) {
223 chunkqueue_reset(con
->write_queue
);
226 return HANDLER_FINISHED
;
229 /* no decision yet, build conf->filename */
230 if (con
->mode
== DIRECT
&& buffer_is_empty(con
->physical
.path
)) {
233 /* we only come here when we have the parse the full request again
235 * a HANDLER_COMEBACK from mod_rewrite and mod_fastcgi might be a
236 * problem here as mod_setenv might get called multiple times
238 * fastcgi-auth might lead to a COMEBACK too
239 * fastcgi again dead server too
241 * mod_compress might add headers twice too
245 config_cond_cache_reset(srv
, con
);
246 config_setup_connection(srv
, con
); /* Perhaps this could be removed at other places. */
248 if (con
->conf
.log_condition_handling
) {
249 log_error_write(srv
, __FILE__
, __LINE__
, "s", "run condition");
256 * - uri.path (secure)
262 * Name according to RFC 2396
269 * (scheme)://(authority)(path)?(query)#fragment
274 /* initial scheme value. can be overwritten for example by mod_extforward later */
275 if (con
->srv_socket
->is_ssl
) {
276 buffer_copy_string_len(con
->uri
.scheme
, CONST_STR_LEN("https"));
278 buffer_copy_string_len(con
->uri
.scheme
, CONST_STR_LEN("http"));
280 buffer_copy_buffer(con
->uri
.authority
, con
->request
.http_host
);
281 buffer_to_lower(con
->uri
.authority
);
283 /** their might be a fragment which has to be cut away */
284 if (NULL
!= (qstr
= strchr(con
->request
.uri
->ptr
, '#'))) {
285 buffer_string_set_length(con
->request
.uri
, qstr
- con
->request
.uri
->ptr
);
288 /** extract query string from request.uri */
289 if (NULL
!= (qstr
= strchr(con
->request
.uri
->ptr
, '?'))) {
290 buffer_copy_string (con
->uri
.query
, qstr
+ 1);
291 buffer_copy_string_len(con
->uri
.path_raw
, con
->request
.uri
->ptr
, qstr
- con
->request
.uri
->ptr
);
293 buffer_reset (con
->uri
.query
);
294 buffer_copy_buffer(con
->uri
.path_raw
, con
->request
.uri
);
297 /* decode url to path
299 * - decode url-encodings (e.g. %20 -> ' ')
300 * - remove path-modifiers (e.g. /../)
303 if (con
->request
.http_method
== HTTP_METHOD_OPTIONS
&&
304 con
->uri
.path_raw
->ptr
[0] == '*' && con
->uri
.path_raw
->ptr
[1] == '\0') {
306 buffer_copy_buffer(con
->uri
.path
, con
->uri
.path_raw
);
308 buffer_copy_buffer(srv
->tmp_buf
, con
->uri
.path_raw
);
309 buffer_urldecode_path(srv
->tmp_buf
);
310 buffer_path_simplify(con
->uri
.path
, srv
->tmp_buf
);
313 con
->conditional_is_valid
[COMP_SERVER_SOCKET
] = 1; /* SERVERsocket */
314 con
->conditional_is_valid
[COMP_HTTP_SCHEME
] = 1; /* Scheme: */
315 con
->conditional_is_valid
[COMP_HTTP_HOST
] = 1; /* Host: */
316 con
->conditional_is_valid
[COMP_HTTP_REMOTE_IP
] = 1; /* Client-IP */
317 con
->conditional_is_valid
[COMP_HTTP_REFERER
] = 1; /* Referer: */
318 con
->conditional_is_valid
[COMP_HTTP_USER_AGENT
] = /* User-Agent: */
319 con
->conditional_is_valid
[COMP_HTTP_LANGUAGE
] = 1; /* Accept-Language: */
320 con
->conditional_is_valid
[COMP_HTTP_COOKIE
] = 1; /* Cookie: */
321 con
->conditional_is_valid
[COMP_HTTP_REQUEST_METHOD
] = 1; /* REQUEST_METHOD */
322 con
->conditional_is_valid
[COMP_HTTP_URL
] = 1; /* HTTPurl */
323 con
->conditional_is_valid
[COMP_HTTP_QUERY_STRING
] = 1; /* HTTPqs */
324 config_patch_connection(srv
, con
);
327 if (con
->srv_socket
->is_ssl
&& con
->conf
.ssl_verifyclient
) {
328 https_add_ssl_entries(con
);
332 /* do we have to downgrade to 1.0 ? */
333 if (!con
->conf
.allow_http11
) {
334 con
->request
.http_version
= HTTP_VERSION_1_0
;
337 if (con
->conf
.log_request_handling
) {
338 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- splitting Request-URI");
339 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Request-URI : ", con
->request
.uri
);
340 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "URI-scheme : ", con
->uri
.scheme
);
341 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "URI-authority : ", con
->uri
.authority
);
342 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "URI-path (raw) : ", con
->uri
.path_raw
);
343 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "URI-path (clean): ", con
->uri
.path
);
344 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "URI-query : ", con
->uri
.query
);
352 * - based on the raw URL
356 switch(r
= plugins_call_handle_uri_raw(srv
, con
)) {
359 case HANDLER_FINISHED
:
360 case HANDLER_COMEBACK
:
361 case HANDLER_WAIT_FOR_EVENT
:
365 log_error_write(srv
, __FILE__
, __LINE__
, "sd", "handle_uri_raw: unknown return value", r
);
373 * - based on the clean URL
377 switch(r
= plugins_call_handle_uri_clean(srv
, con
)) {
380 case HANDLER_FINISHED
:
381 case HANDLER_COMEBACK
:
382 case HANDLER_WAIT_FOR_EVENT
:
386 log_error_write(srv
, __FILE__
, __LINE__
, "");
390 if (con
->request
.http_method
== HTTP_METHOD_OPTIONS
&&
391 con
->uri
.path
->ptr
[0] == '*' && con
->uri
.path_raw
->ptr
[1] == '\0') {
392 /* option requests are handled directly without checking of the path */
394 response_header_insert(srv
, con
, CONST_STR_LEN("Allow"), CONST_STR_LEN("OPTIONS, GET, HEAD, POST"));
396 con
->http_status
= 200;
397 con
->file_finished
= 1;
399 return HANDLER_FINISHED
;
406 * logical filename (URI) becomes a physical filename here
416 * ... ISREG() -> ok, go on
417 * ... ISDIR() -> index-file -> redirect
427 * SEARCH DOCUMENT ROOT
432 buffer_copy_buffer(con
->physical
.doc_root
, con
->conf
.document_root
);
433 buffer_copy_buffer(con
->physical
.rel_path
, con
->uri
.path
);
435 #if defined(__WIN32) || defined(__CYGWIN__)
436 /* strip dots from the end and spaces
438 * windows/dos handle those filenames as the same file
440 * foo == foo. == foo..... == "foo... " == "foo.. ./"
442 * This will affect in some cases PATHINFO
444 * on native windows we could prepend the filename with \\?\ to circumvent
445 * this behaviour. I have no idea how to push this through cygwin
449 if (con
->physical
.rel_path
->used
> 1) {
450 buffer
*b
= con
->physical
.rel_path
;
451 size_t len
= buffer_string_length(b
);
453 /* strip trailing " /" or "./" once */
455 b
->ptr
[len
- 1] == '/' &&
456 (b
->ptr
[len
- 2] == ' ' || b
->ptr
[len
- 2] == '.')) {
459 /* strip all trailing " " and "." */
460 while (len
> 0 && ( ' ' == b
->ptr
[len
-1] || '.' == b
->ptr
[len
-1] ) ) --len
;
461 buffer_string_set_length(b
, len
);
465 if (con
->conf
.log_request_handling
) {
466 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- before doc_root");
467 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Doc-Root :", con
->physical
.doc_root
);
468 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Rel-Path :", con
->physical
.rel_path
);
469 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
471 /* the docroot plugin should set the doc_root and might also set the physical.path
472 * for us (all vhost-plugins are supposed to set the doc_root)
474 switch(r
= plugins_call_handle_docroot(srv
, con
)) {
477 case HANDLER_FINISHED
:
478 case HANDLER_COMEBACK
:
479 case HANDLER_WAIT_FOR_EVENT
:
483 log_error_write(srv
, __FILE__
, __LINE__
, "");
487 /* MacOS X and Windows can't distiguish between upper and lower-case
489 * convert to lower-case
491 if (con
->conf
.force_lowercase_filenames
) {
492 buffer_to_lower(con
->physical
.rel_path
);
495 /* the docroot plugins might set the servername, if they don't we take http-host */
496 if (buffer_string_is_empty(con
->server_name
)) {
497 buffer_copy_buffer(con
->server_name
, con
->uri
.authority
);
501 * create physical filename
502 * -> physical.path = docroot + rel_path
506 buffer_copy_buffer(con
->physical
.basedir
, con
->physical
.doc_root
);
507 buffer_copy_buffer(con
->physical
.path
, con
->physical
.doc_root
);
508 buffer_append_slash(con
->physical
.path
);
509 if (!buffer_string_is_empty(con
->physical
.rel_path
) &&
510 con
->physical
.rel_path
->ptr
[0] == '/') {
511 buffer_append_string_len(con
->physical
.path
, con
->physical
.rel_path
->ptr
+ 1, buffer_string_length(con
->physical
.rel_path
) - 1);
513 buffer_append_string_buffer(con
->physical
.path
, con
->physical
.rel_path
);
516 if (con
->conf
.log_request_handling
) {
517 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- after doc_root");
518 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Doc-Root :", con
->physical
.doc_root
);
519 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Rel-Path :", con
->physical
.rel_path
);
520 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
523 switch(r
= plugins_call_handle_physical(srv
, con
)) {
526 case HANDLER_FINISHED
:
527 case HANDLER_COMEBACK
:
528 case HANDLER_WAIT_FOR_EVENT
:
532 log_error_write(srv
, __FILE__
, __LINE__
, "");
536 if (con
->conf
.log_request_handling
) {
537 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- logical -> physical");
538 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Doc-Root :", con
->physical
.doc_root
);
539 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Basedir :", con
->physical
.basedir
);
540 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Rel-Path :", con
->physical
.rel_path
);
541 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
546 * Noone catched away the file from normal path of execution yet (like mod_access)
548 * Go on and check of the file exists at all
551 if (con
->mode
== DIRECT
) {
553 char *pathinfo
= NULL
;
555 stat_cache_entry
*sce
= NULL
;
557 if (con
->conf
.log_request_handling
) {
558 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- handling physical path");
559 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
562 if (HANDLER_ERROR
!= stat_cache_get_entry(srv
, con
, con
->physical
.path
, &sce
)) {
565 if (con
->conf
.log_request_handling
) {
566 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- file found");
567 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
570 if ((sce
->is_symlink
!= 0) && !con
->conf
.follow_symlink
) {
571 con
->http_status
= 403;
573 if (con
->conf
.log_request_handling
) {
574 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- access denied due symlink restriction");
575 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
578 buffer_reset(con
->physical
.path
);
579 return HANDLER_FINISHED
;
582 if (S_ISDIR(sce
->st
.st_mode
)) {
583 if (con
->uri
.path
->ptr
[buffer_string_length(con
->uri
.path
) - 1] != '/') {
584 /* redirect to .../ */
586 http_response_redirect_to_directory(srv
, con
);
588 return HANDLER_FINISHED
;
591 } else if (!S_ISREG(sce
->st
.st_mode
) && !sce
->is_symlink
) {
593 } else if (!S_ISREG(sce
->st
.st_mode
)) {
595 /* any special handling of non-reg files ?*/
602 con
->http_status
= 403;
604 if (con
->conf
.log_request_handling
) {
605 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- access denied");
606 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
609 buffer_reset(con
->physical
.path
);
610 return HANDLER_FINISHED
;
612 /* file name to be read was too long. return 404 */
614 con
->http_status
= 404;
616 if (con
->conf
.log_request_handling
) {
617 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- file not found");
618 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
621 buffer_reset(con
->physical
.path
);
622 return HANDLER_FINISHED
;
627 /* we have no idea what happend. let's tell the user so. */
628 con
->http_status
= 500;
629 buffer_reset(con
->physical
.path
);
631 log_error_write(srv
, __FILE__
, __LINE__
, "ssbsb",
632 "file not found ... or so: ", strerror(errno
),
634 "->", con
->physical
.path
);
636 return HANDLER_FINISHED
;
639 /* not found, perhaps PATHINFO */
641 buffer_copy_buffer(srv
->tmp_buf
, con
->physical
.path
);
645 buffer_copy_string_len(con
->physical
.path
, srv
->tmp_buf
->ptr
, slash
- srv
->tmp_buf
->ptr
);
647 buffer_copy_buffer(con
->physical
.path
, srv
->tmp_buf
);
650 if (HANDLER_ERROR
!= stat_cache_get_entry(srv
, con
, con
->physical
.path
, &sce
)) {
651 found
= S_ISREG(sce
->st
.st_mode
);
655 if (pathinfo
!= NULL
) {
658 slash
= strrchr(srv
->tmp_buf
->ptr
, '/');
660 if (pathinfo
!= NULL
) {
665 if (slash
) pathinfo
= slash
;
666 } while ((found
== 0) && (slash
!= NULL
) && ((size_t)(slash
- srv
->tmp_buf
->ptr
) > (buffer_string_length(con
->physical
.basedir
) - 1)));
669 /* no it really doesn't exists */
670 con
->http_status
= 404;
672 if (con
->conf
.log_file_not_found
) {
673 log_error_write(srv
, __FILE__
, __LINE__
, "sbsb",
674 "file not found:", con
->uri
.path
,
675 "->", con
->physical
.path
);
678 buffer_reset(con
->physical
.path
);
680 return HANDLER_FINISHED
;
684 if ((sce
->is_symlink
!= 0) && !con
->conf
.follow_symlink
) {
685 con
->http_status
= 403;
687 if (con
->conf
.log_request_handling
) {
688 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- access denied due symlink restriction");
689 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
692 buffer_reset(con
->physical
.path
);
693 return HANDLER_FINISHED
;
697 /* we have a PATHINFO */
699 size_t len
= strlen(pathinfo
), reqlen
;
700 if (con
->conf
.force_lowercase_filenames
701 && len
<= (reqlen
= buffer_string_length(con
->request
.uri
))
702 && 0 == strncasecmp(con
->request
.uri
->ptr
+ reqlen
- len
, pathinfo
, len
)) {
703 /* attempt to preserve case-insensitive PATH_INFO
704 * (works in common case where mod_alias, mod_magnet, and other modules
705 * have not modified the PATH_INFO portion of request URI, or did so
706 * with exactly the PATH_INFO desired) */
707 buffer_copy_string_len(con
->request
.pathinfo
, con
->request
.uri
->ptr
+ reqlen
- len
, len
);
709 buffer_copy_string_len(con
->request
.pathinfo
, pathinfo
, len
);
716 buffer_string_set_length(con
->uri
.path
, buffer_string_length(con
->uri
.path
) - len
);
719 if (con
->conf
.log_request_handling
) {
720 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- after pathinfo check");
721 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
722 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "URI :", con
->uri
.path
);
723 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Pathinfo :", con
->request
.pathinfo
);
727 if (con
->conf
.log_request_handling
) {
728 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- handling subrequest");
729 log_error_write(srv
, __FILE__
, __LINE__
, "sb", "Path :", con
->physical
.path
);
732 /* call the handlers */
733 switch(r
= plugins_call_handle_subrequest_start(srv
, con
)) {
735 /* request was not handled */
737 case HANDLER_FINISHED
:
739 if (con
->conf
.log_request_handling
) {
740 log_error_write(srv
, __FILE__
, __LINE__
, "s", "-- subrequest finished");
743 /* something strange happend */
747 /* if we are still here, no one wanted the file, status 403 is ok I think */
749 if (con
->mode
== DIRECT
&& con
->http_status
== 0) {
750 switch (con
->request
.http_method
) {
751 case HTTP_METHOD_OPTIONS
:
752 con
->http_status
= 200;
755 con
->http_status
= 403;
758 return HANDLER_FINISHED
;
763 switch(r
= plugins_call_handle_subrequest(srv
, con
)) {
765 /* request was not handled, looks like we are done */
766 return HANDLER_FINISHED
;
767 case HANDLER_FINISHED
:
768 /* request is finished */
770 /* something strange happend */
775 return HANDLER_COMEBACK
;