HttpConnectionManager.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2002-2009 Moxie Marlinspike
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 3 of the
  7. * License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  17. * USA
  18. */
  19. #ifndef __HTTP_FINGERPRINTER_H__
  20. #define __HTTP_FINGERPRINTER_H__
  21. #include <boost/shared_ptr.hpp>
  22. #include <boost/asio.hpp>
  23. #include <string>
  24. #include <set>
  25. #include <vector>
  26. #include "HttpBridge.hpp"
  27. #include "OCSPDenier.hpp"
  28. #include "../certificate/CertificateManager.hpp"
  29. using namespace boost::asio;
  30. class HttpConnectionManager {
  31. private:
  32. ip::tcp::acceptor acceptor_;
  33. int port_;
  34. CertificateManager &certificateManager;
  35. bool denyOCSP;
  36. void acceptIncomingConnection();
  37. void bridgeHttpRequest(boost::shared_ptr<ip::tcp::socket> socket,
  38. ip::tcp::endpoint destination);
  39. void handleClientConnection(boost::shared_ptr<ip::tcp::socket> socket,
  40. const boost::system::error_code& error);
  41. void handleServerConnection(HttpBridge::ptr bridge, const boost::system::error_code& error);
  42. public:
  43. HttpConnectionManager(io_service& io_service, int port,
  44. CertificateManager &certificateManager, bool denyOCSP);
  45. };
  46. #endif