A HTTP Proxy Server Code under Linux. Linux 下 HTTP 代理服务器代码

该HTTP代理服务器采用多线程技术处理客户端请求,并通过信号处理确保稳定性。支持特定端口上的代理服务,利用超时链接处理提高效率。项目文档齐全,包括UML设计图与API文档。

 HTTP 代理务器 ProxyServer 文档

一 功能说明与技术特点

在特定端口上提供 HTTP 代理服。 使用多线程技术, 处理系统信号与超时连接。具体如下:

1 线程

ThreadManager 创建线处理客户端的代理请求。

2 信号处理

ProxyServer 类中使用系统函数 signal 处理 SIGINT SIGQUIT 信号。

3 超时链接

ThreadManager 类的 transBetSerAndCli 函数中调用系统函数 select 处理超时链接。在 SocketManager 类中创建客户端线程时使用系统函数 setsockopt 设置链接等待时间。

4 运行

直接运行则在 3128 端口上提供 HTTP 代理服务, 也可在 ProxyServer 加端口号在特定端口提供 HTTP 代理服务。

二 文档与设计

本程序使用 DOXYGEN 软件对代码及注释产生文档, 用 UMBRELLA 设计 UML Class 图。 使用 Makefile 进行编译链接。 Makefile 使用示例:

make 生成可执行文件

make doc 根据代码使用 DOXYGEN 生成文档

make test 进行单元测试

make clean_all 对一切编译链接和产生的文件和产生的文档进行清理。

make clean_output 清理编译链接中产生的 OBJECT 文件。

文件清

/design

Class Diagram.png UML 类图(设计图)

ProxyServer.xmi umbrella 类图设计文件

/DOC_OUTPUT

/html DOXYGEN 产生 HTML 形式的 API 文档

/shell Makefile 中要调用的 shell 程序

/src 源代码文件夹, 详细请看 API 文档

/Test 单元测试的可执行文件

Makefile make 文件

ProxyServer 代理服务器可执行文件

ProxyServerDOXY.cfg DOXYGEN 配置文件

ReadMe.rtf 说明文档

 

程序发布在google code. 地址如下: http://code.google.com/p/adsproxyserver/
[20:43:02.961] Log Level: 2 [20:43:02.986] SSH Resolver called for "ssh-remote+root", attempt 1 [20:43:02.992] remote.SSH.useLocalServer = false [20:43:02.993] remote.SSH.useExecServer = true [20:43:02.993] remote.SSH.bindHost = {} [20:43:02.993] remote.SSH.showLoginTerminal = false [20:43:02.993] remote.SSH.remotePlatform = {} [20:43:02.993] remote.SSH.path = [20:43:02.994] remote.SSH.configFile = [20:43:02.994] remote.SSH.useFlock = true [20:43:02.994] remote.SSH.lockfilesInTmp = false [20:43:02.997] remote.SSH.localServerDownload = auto [20:43:02.997] remote.SSH.remoteServerListenOnSocket = false [20:43:02.998] remote.SSH.defaultExtensions = [] [20:43:02.998] remote.SSH.defaultExtensionsIfInstalledLocally = [] [20:43:02.998] remote.SSH.loglevel = 2 [20:43:02.998] remote.SSH.enableDynamicForwarding = true [20:43:02.998] remote.SSH.enableRemoteCommand = false [20:43:02.998] remote.SSH.serverPickPortsFromRange = {} [20:43:02.998] remote.SSH.serverInstallPath = {} [20:43:02.998] remote.SSH.permitPtyAllocation = false [20:43:02.998] remote.SSH.preferredLocalPortRange = undefined [20:43:02.999] remote.SSH.useCurlAndWgetConfigurationFiles = false [20:43:02.999] remote.SSH.experimental.chat = true [20:43:02.999] remote.SSH.experimental.enhancedSessionLogs = true [20:43:02.999] remote.SSH.httpProxy = {"*":""} [20:43:02.999] remote.SSH.httpsProxy = {"*":""} [20:43:03.009] VS Code version: 1.101.1 [20:43:03.010] Remote-SSH version: remote-ssh@0.120.0 [20:43:03.010] win32 x64 [20:43:03.015] SSH Resolver called for host: root [20:43:03.015] Setting up SSH remote "root" [20:43:03.025] Using commit id "18e3a1ec544e6907be1e944a94c496e302073435" and quality "stable" for server [20:43:03.025] Extensions to install: [20:43:03.032] Install and start server if needed [20:43:06.034] Checking ssh with "C:\Program Files (x86)\Common Files\Oracle\Java\java8path\ssh.exe -V" [20:43:06.037] Got error from ssh: spawn C:\Program Files (x86)\Common Files\Oracle\Java\java8path\ssh.exe ENOENT [20:43:06.037] Checking ssh with "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe -V" [20:43:06.039] Got error from ssh: spawn C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe ENOENT [20:43:06.039] Checking ssh with "C:\Windows\system32\ssh.exe -V" [20:43:06.040] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT [20:43:06.040] Checking ssh with "C:\Windows\ssh.exe -V" [20:43:06.041] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT [20:43:06.042] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V" [20:43:06.042] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT [20:43:06.043] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V" [20:43:06.043] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT [20:43:06.043] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V" [20:43:06.071] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2 [20:43:06.076] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 51109 root sh [20:43:06.078] Generated SSH command: 'type "C:\Users\chen\AppData\Local\Temp\vscode-linux-multi-line-command-root-258649359.sh" | "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 51109 root sh' [20:43:06.078] Using connect timeout of 17 seconds [20:43:06.079] Terminal shell path: C:\Windows\System32\cmd.exe [20:43:09.884] > root@192.168.124.6's password: [20:43:09.884] Got some output, clearing connection timeout [20:43:09.885] Showing password prompt [20:43:17.794] Got password response [20:43:17.794] "install" wrote data to terminal: "******" [20:43:17.847] > [20:43:18.372] > d55f9866d272: running > Script executing under PID: 18331 [20:43:18.448] > Found existing installation at /root/.vscode-server... > Starting VS Code CLI... > Removing old logfile at /root/.vscode-server/.cli.18e3a1ec544e6907be1e944a94c496e302073435.log > Spawned remote CLI: 18357 > Waiting for server log... [20:43:18.583] > Waiting for server log... > Waiting for server log... > Waiting for server log... [20:43:18.624] > Exec server process not found > sh: 418: kill: No such process [20:43:18.631] > [2023-03-02 21:21:50] error This machine does not meet Visual Studio Code Server's prerequisites, expected either... > - find GLIBC >= v2.28.0 (but found v2.27.0 instead) for GNU environments > - find /lib/ld-musl-aarch64.so.1, which is required to run the Visual Studio Code Server in musl environments > d55f9866d272: start > exitCode==207== > listeningOn==== > osReleaseId==ubuntu== > arch==aarch64== > vscodeArch==arm64== > bitness==64== > tmpDir==/run/user/0== > platform==linux== > unpackResult==== [20:43:18.640] > > didLocalDownload==0== > downloadTime==== > installTime==== > serverStartTime==== > execServerToken==a11aaa11-1a1a-1a11-111a-11aa111111a1== > platformDownloadPath==cli-alpine-arm64== > SSH_AUTH_SOCK==== > DISPLAY==== > d55f9866d272: end [20:43:18.640] Received install output: exitCode==207== listeningOn==== osReleaseId==ubuntu== arch==aarch64== vscodeArch==arm64== bitness==64== tmpDir==/run/user/0== platform==linux== unpackResult==== didLocalDownload==0== downloadTime==== installTime==== serverStartTime==== execServerToken==a11aaa11-1a1a-1a11-111a-11aa111111a1== platformDownloadPath==cli-alpine-arm64== SSH_AUTH_SOCK==== DISPLAY==== [20:43:18.641] Resolver error: Error: 远程主机不满足运行VS Code服务器的先决条件 at y.ServerInstallError (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:744694) at p (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:739113) at t.handleInstallOutput (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:740589) at t.tryInstall (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:865534) at async c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:824246 at async t.withShowDetailsEvent (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:827501) at async A (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:820760) at async t.resolve (c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:824898) at async c:\Users\chen\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:1113660 [20:43:18.648] ------ [20:43:18.649] ---------- [Session Summary] ----------- [20:43:18.649] [LinuxPrereqs]: 远程主机可能不符合 glibc 和 libstdc++ VS Code 服务器的先决条件 (远程主机不满足运行VS Code服务器的先决条件) [20:43:18.649] ---------------------------------------- [20:43:18.858] > [20:43:19.386] Opening exec server for ssh-remote+root [20:43:19.439] Initizing new exec server for ssh-remote+root [20:43:19.439] Using commit id "18e3a1ec544e6907be1e944a94c496e302073435" and quality "stable" for server [20:43:19.439] Extensions to install: [20:43:19.462] Opening exec server for ssh-remote+root [20:43:19.464] Install and start server if needed [20:43:19.904] "install" terminal command done [20:43:19.905] Install terminal quit with output: [20:43:21.556] getPlatformForHost was canceled [20:43:21.556] Exec server for ssh-remote+root failed: Error: 已取消连接 [20:43:21.556] Existing exec server for ssh-remote+root errored (Error: 已取消连接) [20:43:21.556] Initizing new exec server for ssh-remote+root [20:43:21.557] Error opening exec server for ssh-remote+root: Error: 已取消连接 [20:43:21.557] ---------- [Session Summary] ----------- [20:43:21.557] [LinuxPrereqs]: 远程主机可能不符合 glibc 和 libstdc++ VS Code 服务器的先决条件 (远程主机不满足运行VS Code服务器的先决条件) [20:43:21.557] ---------------------------------------- [20:43:21.557] Using commit id "18e3a1ec544e6907be1e944a94c496e302073435" and quality "stable" for server [20:43:21.557] Extensions to install: [20:43:21.562] Install and start server if needed
最新发布
06-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值