added some experimental code

This commit is contained in:
hyung-hwan 2014-09-28 16:05:56 +00:00
parent 7cb0f4eeea
commit 0cd8dfe54c
4 changed files with 25 additions and 11 deletions

View File

@ -296,8 +296,11 @@ static int proxy_capture_client_header (qse_htre_t* req, const qse_mchar_t* key,
}
}
/* EXPERIMENTAL: REMOVE HEADERS.
* FOR EXAMPLE, You can remove Referer to make analysis systems harder time */
if (qse_mbscasecmp (key, QSE_MT("Transfer-Encoding")) != 0 &&
qse_mbscasecmp (key, QSE_MT("Content-Length")) != 0)
qse_mbscasecmp (key, QSE_MT("Content-Length")) != 0 /* EXPERIMENTAL */ /* &&
qse_mbscasecmp (key, QSE_MT("Referer")) != 0*/)
{
return proxy_add_header_to_buffer (proxy, proxy->reqfwdbuf, key, val);
}
@ -983,7 +986,6 @@ static int task_init_proxy (
x = httpd->opt.scb.urs.prerewrite (httpd, client, arg->req, arg->rsrc->host, &proxy->url_to_rewrite);
if (x <= -1) goto oops;
printf (">>>>>>>>>>>>>>>>>>>>>>>> [%s] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", proxy->url_to_rewrite);
/* enable url rewriting */
proxy->flags |= PROXY_REWRITE_URL;
if (x == 0)
@ -1070,6 +1072,7 @@ printf (">>>>>>>>>>>>>>>>>>>>>>>> [%s] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", proxy
#if 0
{
/* EXPERIMENTAL */
/* KT FILTERING WORKAROUND POC. KT seems to check the Host: the first packet
* only.I add 1500 byte space octets between the URL and the HTTP version string.
* the header is likely to be placed in the second packet. it seems to work. */
@ -1941,7 +1944,7 @@ if (proxy->flags & PROXY_PEER_NAME_RESOLVED)
{
qse_mchar_t xxxx[128];
qse_nwadtombs (&proxy->peer.nwad, xxxx, 128, QSE_NWADTOMBS_ALL);
printf ("XXXXXXXXXXXXXXXXXXXXXXXXXX PEER NAME RESOLVED.....TO [%s]\n", xxxx);
printf ("XXXXXXXXXXXXXXXXXXXXXXXXXX [%s] PEER NAME RESOLVED.....TO [%s]\n", name, xxxx);
}
}

View File

@ -881,8 +881,6 @@ static int dns_send (qse_httpd_t* httpd, qse_httpd_dns_t* dns, const qse_mchar_t
httpd_xtn = qse_httpd_getxtn (httpd);
printf ("DNS REALLY SENING>>>>>>>>>>>>>>>>>>>>>>>\n");
ans = dns_get_answer_from_cache (dc, name);
if (ans)
{
@ -994,7 +992,8 @@ printf ("DNS REALLY SENING>>>>>>>>>>>>>>>>>>>>>>>\n");
(req->qaaaalen > 0 && sendto (req->dns_socket, req->qaaaa, req->qaaaalen, 0, (struct sockaddr*)&req->dns_skad, req->dns_skadlen) != req->qaaaalen))
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
goto oops;
if (httpd->errnum != QSE_HTTPD_EAGAIN || req->dns_retries <= 0) goto oops;
/*goto oops;*/
}
/* NOTE:
@ -1013,7 +1012,6 @@ printf ("DNS REALLY SENING>>>>>>>>>>>>>>>>>>>>>>>\n");
/* increment the number of pending requests */
dc->req_count++;
printf ("DNS REALLY SENT>>>>>>>>>>>>>>>>>>>>>>>\n");
return 0;
oops:

View File

@ -424,7 +424,6 @@ static int urs_send (qse_httpd_t* httpd, qse_httpd_urs_t* urs, const qse_mchar_t
qse_size_t url_len;
qse_tmr_event_t tmout_event;
printf ("... URS_SEND.....................\n");
httpd_xtn = qse_httpd_getxtn (httpd);
if (dc->req_count >= QSE_COUNTOF(dc->reqs))
@ -532,7 +531,12 @@ printf ("... URS_SEND.....................\n");
if (sendto (req->urs_socket, req->pkt, req->pktlen, 0, (struct sockaddr*)&req->urs_skad, req->urs_skadlen) != req->pktlen)
{
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
goto oops;
printf ("URS SENDTO FAILURE........................\n"); /* TODO: logging */
/* it looks like the EAGAIN is frequently seen on a unix datagram socket
* even with increased SO_SNDBUF size. */
if (httpd->errnum != QSE_HTTPD_EAGAIN || req->urs_retries <= 0) goto oops;
/* goto oops; */
}
req->dc = dc;
@ -545,7 +549,6 @@ printf ("... URS_SEND.....................\n");
/* increment the number of pending requests */
dc->req_count++;
printf ("URS REALLY SENT>>>>>>>>>>>>>>>>>>>>>>>\n");
return 0;
oops:

View File

@ -772,7 +772,7 @@ static qse_sck_hnd_t open_client_socket (qse_httpd_t* httpd, int domain, int typ
#endif
*/
#if defined(IPV6_V6ONLY)
#if defined(AF_INET6) && defined(IPV6_V6ONLY)
if (domain == AF_INET6)
{
flag = 1;
@ -780,6 +780,16 @@ static qse_sck_hnd_t open_client_socket (qse_httpd_t* httpd, int domain, int typ
}
#endif
/*
#if defined(AF_UNIX)
if (domain == AF_UNIX)
{
flag = 1000000;
setsockopt (fd, SOL_SOCKET, SO_SNDBUF, (void*)&flag, QSE_SIZEOF(flag));
}
#endif
*/
if (set_socket_nonblock (httpd, fd, 1) <= -1) goto oops;
#if defined(IPPROTO_SCTP)