mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-14 09:35:04 +00:00
Use the raw_path for proxying (as some media may include ? arguments).
This commit is contained in:
parent
e4e58d2222
commit
a6bf1ee0d0
3 changed files with 10 additions and 1 deletions
8
html.c
8
html.c
|
@ -3216,7 +3216,13 @@ int html_get_handler(const xs_dict *req, const char *q_path,
|
||||||
status = HTTP_STATUS_UNAUTHORIZED;
|
status = HTTP_STATUS_UNAUTHORIZED;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
xs *url = xs_replace(p_path, "proxy/", "https:/" "/");
|
/* pick the raw path (including optional ? arguments) */
|
||||||
|
const char *raw_path = xs_dict_get(req, "raw_path");
|
||||||
|
|
||||||
|
/* skip to where the proxy/ string starts */
|
||||||
|
raw_path += xs_str_in(raw_path, "proxy/");
|
||||||
|
|
||||||
|
xs *url = xs_replace(raw_path, "proxy/", "https:/" "/");
|
||||||
xs *hdrs = xs_dict_new();
|
xs *hdrs = xs_dict_new();
|
||||||
|
|
||||||
hdrs = xs_dict_append(hdrs, "user-agent", USER_AGENT);
|
hdrs = xs_dict_append(hdrs, "user-agent", USER_AGENT);
|
||||||
|
|
|
@ -179,6 +179,8 @@ xs_dict *xs_fcgi_request(FILE *f, xs_str **payload, int *p_size, int *fcgi_id)
|
||||||
req = xs_dict_append(req, "method", v);
|
req = xs_dict_append(req, "method", v);
|
||||||
else
|
else
|
||||||
if (strcmp(k, "REQUEST_URI") == 0) {
|
if (strcmp(k, "REQUEST_URI") == 0) {
|
||||||
|
req = xs_dict_append(req, "raw_path", v);
|
||||||
|
|
||||||
xs *pnv = xs_split_n(v, "?", 1);
|
xs *pnv = xs_split_n(v, "?", 1);
|
||||||
|
|
||||||
/* store the path */
|
/* store the path */
|
||||||
|
|
|
@ -32,6 +32,7 @@ xs_dict *xs_httpd_request(FILE *f, xs_str **payload, int *p_size)
|
||||||
xs_dict *req = xs_dict_new();
|
xs_dict *req = xs_dict_new();
|
||||||
|
|
||||||
req = xs_dict_append(req, "method", xs_list_get(l2, 0));
|
req = xs_dict_append(req, "method", xs_list_get(l2, 0));
|
||||||
|
req = xs_dict_append(req, "raw_path", xs_list_get(l2, 1));
|
||||||
req = xs_dict_append(req, "proto", xs_list_get(l2, 2));
|
req = xs_dict_append(req, "proto", xs_list_get(l2, 2));
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue