|
|
|
@ -23,10 +23,7 @@
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int http_response_redirect_to_directory(server *srv, connection *con) {
|
|
|
|
|
buffer *o = srv->tmp_buf;
|
|
|
|
|
buffer_copy_buffer(o, con->uri.scheme);
|
|
|
|
|
buffer_append_string_len(o, CONST_STR_LEN("://"));
|
|
|
|
|
int http_response_buffer_append_authority(server *srv, connection *con, buffer *o) {
|
|
|
|
|
if (!buffer_string_is_empty(con->uri.authority)) {
|
|
|
|
|
buffer_append_string_buffer(o, con->uri.authority);
|
|
|
|
|
} else {
|
|
|
|
@ -61,6 +58,16 @@ int http_response_redirect_to_directory(server *srv, connection *con) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int http_response_redirect_to_directory(server *srv, connection *con) {
|
|
|
|
|
buffer *o = srv->tmp_buf;
|
|
|
|
|
buffer_copy_buffer(o, con->uri.scheme);
|
|
|
|
|
buffer_append_string_len(o, CONST_STR_LEN("://"));
|
|
|
|
|
if (0 != http_response_buffer_append_authority(srv, con, o)) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
buffer_append_string_encoded(o, CONST_BUF_LEN(con->uri.path), ENCODING_REL_URI);
|
|
|
|
|
buffer_append_string_len(o, CONST_STR_LEN("/"));
|
|
|
|
|
if (!buffer_string_is_empty(con->uri.query)) {
|
|
|
|
|