included qparam to url for rewriting
This commit is contained in:
parent
7d447c0dc6
commit
624ffcb006
@ -2154,17 +2154,18 @@ static int prerewrite_url (qse_httpd_t* httpd, qse_httpd_client_t* client, qse_h
|
||||
httpd_xtn = qse_httpd_getxtnstd (httpd);
|
||||
|
||||
printf ("PREREWRITING.....................\n");
|
||||
/*
|
||||
if (qse_htre_getqmethodtype(req) == QSE_HTTP_CONNECT)
|
||||
{
|
||||
*url = QSE_NULL;
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/* TODO: override prerewrite url */
|
||||
return httpd_xtn->org_urs_prerewrite (httpd, client, req, host, url);
|
||||
}
|
||||
|
||||
|
||||
static void logact_httpd (qse_httpd_t* httpd, const qse_httpd_act_t* act)
|
||||
{
|
||||
/*httpd_xtn_t* httpd_xtn;*/
|
||||
|
@ -487,17 +487,31 @@ static int urs_prerewrite (qse_httpd_t* httpd, qse_httpd_client_t* client, qse_h
|
||||
const qse_mchar_t* qpath;
|
||||
int mtype;
|
||||
const qse_mchar_t* mname;
|
||||
const qse_mchar_t* quest;
|
||||
const qse_mchar_t* qparam;
|
||||
const qse_mchar_t* proto;
|
||||
|
||||
const qse_mchar_t* host_ptr = QSE_NULL;
|
||||
qse_mchar_t cliaddrbuf[128];
|
||||
qse_mchar_t cliaddrbuf[MAX_NWAD_TEXT_SIZE];
|
||||
qse_size_t total_len;
|
||||
qse_mchar_t* url_to_rewrite;
|
||||
|
||||
qpath = qse_htre_getqpath(req);
|
||||
qparam = qse_htre_getqparam(req);
|
||||
mtype = qse_htre_getqmethodtype(req);
|
||||
mname = qse_htre_getqmethodname(req);
|
||||
|
||||
total_len = qse_mbslen(qpath) + qse_mbslen(mname);
|
||||
if (qparam)
|
||||
{
|
||||
quest = QSE_MT("?");
|
||||
total_len = total_len + 1 + qse_mbslen(qparam);
|
||||
}
|
||||
else
|
||||
{
|
||||
qparam = QSE_MT("");
|
||||
quest = QSE_MT("");
|
||||
}
|
||||
|
||||
if (host)
|
||||
{
|
||||
@ -519,17 +533,24 @@ static int urs_prerewrite (qse_httpd_t* httpd, qse_httpd_client_t* client, qse_h
|
||||
}
|
||||
|
||||
total_len += qse_nwadtombs (&client->remote_addr, cliaddrbuf, QSE_COUNTOF(cliaddrbuf), QSE_NWADTOMBS_ADDR);
|
||||
|
||||
total_len += 128; /* extra space */
|
||||
|
||||
url_to_rewrite = qse_httpd_allocmem (httpd, total_len);
|
||||
if (url_to_rewrite == QSE_NULL) return -1;
|
||||
|
||||
/* URL client-ip/client-fqdn ident method */
|
||||
if (mtype != QSE_HTTP_CONNECT && host_ptr)
|
||||
qse_mbsxfmt (url_to_rewrite, total_len, QSE_MT("http://%s%s %s/- - %s"), host_ptr, qpath, cliaddrbuf, mname);
|
||||
|
||||
if (mtype == QSE_HTTP_CONNECT || !host_ptr)
|
||||
{
|
||||
host_ptr = QSE_MT("");
|
||||
proto = QSE_MT("");
|
||||
}
|
||||
else
|
||||
qse_mbsxfmt (url_to_rewrite, total_len, QSE_MT("%s %s/- - %s"), qpath, cliaddrbuf, mname);
|
||||
{
|
||||
proto = QSE_MT("http://");
|
||||
}
|
||||
|
||||
/* URL client-ip/client-fqdn ident method */
|
||||
qse_mbsxfmt (url_to_rewrite, total_len, QSE_MT("%s%s%s%s%s %s/- - %s"), proto, host_ptr, qpath, quest, qparam, cliaddrbuf, mname);
|
||||
|
||||
*url = url_to_rewrite;
|
||||
return 1;
|
||||
|
@ -110,6 +110,8 @@ struct qse_httpd_status_reloc_t
|
||||
#define MAX_SEND_SIZE 4096
|
||||
#define MAX_RECV_SIZE 4096
|
||||
|
||||
#define MAX_NWAD_TEXT_SIZE 96
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user