Example #1
0
void Logger::logFromClient(std::string &name, HttpHeaders &headers) {
  std::string message = "Got POST (";
  message.append(name);
  message.append(") :\n");
  message.append(headers.getPostData());

  log4cpp::Category::getInstance("sslsniff").info(message);
}
void HTTPSBridge::buildRequestFromHeaders(HttpHeaders &headers, std::string &request) {
  std::ostringstream requestStream;
  requestStream << headers.getMethod()  << " "
	  << headers.getRequest() << " "
	  << "HTTP/1.0\r\n";
      
  std::map<std::string,std::string>::iterator iter;
  std::map<std::string,std::string>& headersMap = headers.getHeaders();
  for( iter = headersMap.begin(); iter != headersMap.end(); ++iter ) {
    std::string key   = iter->first;
    std::string value = iter->second;

    Util::trimString(key);
    Util::trimString(value);
    
    if (key != "Accept-Encoding" && key != "Connection" && key != "Keep-Alive")
      requestStream << key << ": " << value << "\r\n";
  }

  requestStream << "Connection: Close" << "\r\n\r\n";
  if (headers.isPost()) requestStream << headers.getPostData();

  request = requestStream.str();
}