[core] http_response_buffer_append_authority()

(shared code)
personal/stbuehler/fix-fdevent
Glenn Strauss 4 years ago
parent bceeac654e
commit 81dfa7a8d2

@ -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)) {

@ -44,6 +44,7 @@ int http_cgi_headers(server *srv, connection *con, http_cgi_opts *opts, http_cgi
handler_t http_response_parse_headers(server *srv, connection *con, http_response_opts *opts, buffer *hdrs);
handler_t http_response_read(server *srv, connection *con, http_response_opts *opts, buffer *b, int fd, int *fde_ndx);
handler_t http_response_prepare(server *srv, connection *con);
int http_response_buffer_append_authority(server *srv, connection *con, buffer *b);
int http_response_redirect_to_directory(server *srv, connection *con);
int http_response_handle_cachable(server *srv, connection *con, buffer * mtime);
void http_response_body_clear(connection *con, int preserve_length);

Loading…
Cancel
Save