HTTP/S proxy starting point [closed]

2020-02-09 23:40发布

问题:


Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 4 years ago.

I would like to make an HTTP/S proxy program to filter/deny certain http traffic based on how I parse the HTTP request in C++.

Is there some kind of starting point code that I can use with an open license for commercial use? For example if I wanted to do a project on searching I would start with lucene.

回答1:

nginx is a high performance HTTP/S server written in C that can be used as a proxy.

It has a easy to use module system for which you can write plugins. You should consider using an existing parser like Ragel to help you on the filtering side.

It is licensed under a BSD-like license which is fine for commercial use.



回答2:

Have a look at Squid (developers section).

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator. It runs on most available operating systems, including Windows and is licensed under the GNU GPL.



回答3:

You can't see the request at a proxy for HTTPS traffic - SSL is specifically designed to prevent this.

You could terminate the SSL connection at the proxy but would need to either rewrite all the URLs in the content to be non-SSL before passwing back to the client or install your skae oil CA Cert on all the clients and generate certificates on the fly.

If you just want to play around with HTTP, then SQUID alreay has hooks built-in to implement your own filtering mechanism.

C.