Browse Source

Merge pull request #335 from xcps/http_remove_referer

Http remove referer
pull/340/head
orignal 9 years ago
parent
commit
1e69b8c41d
  1. 11
      HTTPProxy.cpp

11
HTTPProxy.cpp

@ -183,6 +183,17 @@ namespace proxy
bool HTTPProxyHandler::HandleData(uint8_t *http_buff, std::size_t len) bool HTTPProxyHandler::HandleData(uint8_t *http_buff, std::size_t len)
{ {
assert(len); // This should always be called with a least a byte left to parse assert(len); // This should always be called with a least a byte left to parse
// remove "Referer" from http requst
http_buff[len] = '\0';
char *start = strstr((char *)http_buff, "\nReferer:");
if (start!=0)
{
char *end = strstr(start+1, "\n");
strncpy(start, end, (char*)(http_buff + len) - end);
len = len - (end - start);
}
while (len > 0) while (len > 0)
{ {
//TODO: fallback to finding HOst: header if needed //TODO: fallback to finding HOst: header if needed

Loading…
Cancel
Save