简体   繁体   English

代理服务器-修改请求标头

[英]Proxy Server - modify header of request

如何开发一个应用程序,该应用程序修改对服务器的所有请求,侦听本地端口,添加标头,然后在客户端和服务器之间传输?

Grab a copy of mentalis: http://www.mentalis.org/soft/projects/proxy/ 获取一份mentalis副本: http : //www.mentalis.org/soft/projects/proxy/

It supports SOCKS4/5 as well as HTTP proxy. 它支持SOCKS4 / 5以及HTTP代理。 You can take a look at the source and figure it out - its not that hard. 您可以查看源代码并找出原因-并不难。

[EDIT - and if you're specifically looking at implementing SOCKS, you should read the protocol definition: http://www.openssh.org/txt/socks4.protocol . [编辑-如果您专门研究实现SOCKS,则应阅读协议定义: http : //www.openssh.org/txt/socks4.protocol Theres really only one message you need to implement in a basic proxy (CONNECT) and all you do is parse the target IP/port, open a socket and start relaying data to the incoming socket that sent the request.] 实际上,您只需要在基本代理(CONNECT)中实现一条消息,而您要做的就是解析目标IP /端口,打开套接字并开始将数据中继到发送请求的传入套接字。]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM