Add sock_send_x and remove fastcgi compression

This commit is contained in:
2023-01-12 19:50:35 +01:00
parent 5138dafb8e
commit f96dc46ea7
10 changed files with 55 additions and 135 deletions

@ -113,18 +113,16 @@ int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mo
while (1) {
sprintf(buf0, "%s%s", uri->webroot, uri->path);
p_len = snprintf(buf1, sizeof(buf1), "%s.ncr", buf0);
p_len = snprintf(buf1, sizeof(buf1), "%s.php", buf0);
if (p_len < 0 || p_len >= sizeof(buf1)) return -1;
p_len = snprintf(buf2, sizeof(buf2), "%s.php", buf0);
p_len = snprintf(buf2, sizeof(buf2), "%s.html", buf0);
if (p_len < 0 || p_len >= sizeof(buf2)) return -1;
p_len = snprintf(buf3, sizeof(buf3), "%s.html", buf0);
if (p_len < 0 || p_len >= sizeof(buf3)) return -1;
if (strlen(uri->path) <= 1 ||
path_exists(buf0) ||
path_is_file(buf1) ||
path_is_file(buf2) ||
path_is_file(buf3)) {
path_is_file(buf2))
{
break;
}
@ -145,7 +143,7 @@ int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mo
uri->filename = malloc(strlen(buf0) + 1);
strcpy(uri->filename, buf0);
long len = (long) strlen(uri->path);
if (strends(uri->path, ".ncr") || strends(uri->path, ".php")) {
if (strends(uri->path, ".php")) {
uri->path[len - 4] = 0;
uri->is_static = 0;
} else if (strends(uri->path, ".html")) {
@ -165,9 +163,8 @@ int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mo
} else {
uri->is_dir = 1;
strcpy(uri->path + strlen(uri->path), "/");
sprintf(buf1, "%s%sindex.ncr", uri->webroot, uri->path);
sprintf(buf2, "%s%sindex.php", uri->webroot, uri->path);
sprintf(buf3, "%s%sindex.html", uri->webroot, uri->path);
sprintf(buf1, "%s%sindex.php", uri->webroot, uri->path);
sprintf(buf2, "%s%sindex.html", uri->webroot, uri->path);
if (path_is_file(buf1)) {
uri->filename = malloc(strlen(buf1) + 1);
strcpy(uri->filename, buf1);
@ -175,10 +172,6 @@ int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mo
} else if (path_is_file(buf2)) {
uri->filename = malloc(strlen(buf2) + 1);
strcpy(uri->filename, buf2);
uri->is_static = 0;
} else if (path_is_file(buf3)) {
uri->filename = malloc(strlen(buf3) + 1);
strcpy(uri->filename, buf3);
} else {
if (dir_mode == URI_DIR_MODE_FORBIDDEN) {
uri->is_static = 1;
@ -198,9 +191,9 @@ int uri_init(http_uri *uri, const char *webroot, const char *uri_str, int dir_mo
if (strends(uri->path + strlen(uri->path), "index")) {
uri->path[strlen(uri->path) - 5] = 0;
}
if (streq(uri->pathinfo, "index.ncr") ||
streq(uri->pathinfo, "index.php") ||
streq(uri->pathinfo, "index.html")) {
if (streq(uri->pathinfo, "index.php") ||
streq(uri->pathinfo, "index.html"))
{
uri->pathinfo[0] = 0;
}