changed httpd to accept http://name:port and https://name:port as a document root value
This commit is contained in:
parent
c4df310ee7
commit
a842cf0767
@ -157,12 +157,15 @@ struct loccfg_t
|
|||||||
ROOT_TYPE_PATH = 0,
|
ROOT_TYPE_PATH = 0,
|
||||||
ROOT_TYPE_NWAD,
|
ROOT_TYPE_NWAD,
|
||||||
ROOT_TYPE_NWAD_SECURE,
|
ROOT_TYPE_NWAD_SECURE,
|
||||||
|
ROOT_TYPE_HOST,
|
||||||
|
ROOT_TYPE_HOST_SECURE,
|
||||||
ROOT_TYPE_RELOC,
|
ROOT_TYPE_RELOC,
|
||||||
ROOT_TYPE_ERROR
|
ROOT_TYPE_ERROR
|
||||||
} root_type;
|
} root_type;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
qse_nwad_t nwad;
|
qse_nwad_t nwad;
|
||||||
|
const qse_mchar_t* host;
|
||||||
int error_code;
|
int error_code;
|
||||||
qse_httpd_rsrc_reloc_t reloc;
|
qse_httpd_rsrc_reloc_t reloc;
|
||||||
} root;
|
} root;
|
||||||
@ -611,6 +614,16 @@ printf ("qpath ===> [%s]\n",qpath);
|
|||||||
|
|
||||||
goto proxy_ok;
|
goto proxy_ok;
|
||||||
|
|
||||||
|
case ROOT_TYPE_HOST_SECURE:
|
||||||
|
root->u.proxy.flags |= QSE_HTTPD_RSRC_PROXY_DST_SECURE;
|
||||||
|
case ROOT_TYPE_HOST:
|
||||||
|
root->type = QSE_HTTPD_SERVERSTD_ROOT_PROXY;
|
||||||
|
root->u.proxy.dst.str = loccfg->root.host;
|
||||||
|
root->u.proxy.flags |= QSE_HTTPD_RSRC_PROXY_DST_STR;
|
||||||
|
if (loccfg->proxy.pseudonym[0])
|
||||||
|
root->u.proxy.pseudonym = loccfg->proxy.pseudonym;
|
||||||
|
goto proxy_ok;
|
||||||
|
|
||||||
case ROOT_TYPE_RELOC:
|
case ROOT_TYPE_RELOC:
|
||||||
root->type = QSE_HTTPD_SERVERSTD_ROOT_RELOC;
|
root->type = QSE_HTTPD_SERVERSTD_ROOT_RELOC;
|
||||||
root->u.reloc.flags = loccfg->root.reloc.flags;
|
root->u.reloc.flags = loccfg->root.reloc.flags;
|
||||||
@ -1759,6 +1772,13 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_t* xli, qse_xli_list_t* list
|
|||||||
cfg->root_type = (proto_len == 8)? ROOT_TYPE_NWAD_SECURE: ROOT_TYPE_NWAD;
|
cfg->root_type = (proto_len == 8)? ROOT_TYPE_NWAD_SECURE: ROOT_TYPE_NWAD;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
else if (proto_len > 0 && *root != QSE_MT('\0'))
|
||||||
|
{
|
||||||
|
/* it begins with http:// or https:// */
|
||||||
|
cfg->root_type = (proto_len == 8)? ROOT_TYPE_HOST_SECURE: ROOT_TYPE_HOST;
|
||||||
|
cfg->root.host = root;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -29,6 +29,8 @@ server-default {
|
|||||||
####################################################################
|
####################################################################
|
||||||
root = "/var/www";
|
root = "/var/www";
|
||||||
#root = "1.2.3.4:80";
|
#root = "1.2.3.4:80";
|
||||||
|
#root = "https://1.2.3.4";
|
||||||
|
#root = "http://code.abiyo.net";
|
||||||
#root = "<302>http://www.google.com"; #301, 302, 303, 307, 308
|
#root = "<302>http://www.google.com"; #301, 302, 303, 307, 308
|
||||||
#root = "<404>"; #400 - 599
|
#root = "<404>"; #400 - 599
|
||||||
|
|
||||||
@ -222,7 +224,7 @@ server {
|
|||||||
|
|
||||||
#host "www.google.com" {
|
#host "www.google.com" {
|
||||||
# location "/" {
|
# location "/" {
|
||||||
# root = "/home/www/google";
|
# root = "/home/www/google";
|
||||||
# realm = "jjjjjjjj";
|
# realm = "jjjjjjjj";
|
||||||
# auth = "username:password";
|
# auth = "username:password";
|
||||||
# }
|
# }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user