⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpproxysocket.h

📁 HTTP是一个基于文本的协议
💻 H
字号:
#if (!defined(__NEURO__PROXY__SOCKET__))
#define __NEURO__PROXY__SOCKET__



#include "SocketClient.h"



class CHttpProxySocketClient : public CSocketClient {
public:
	
	CString HttpServer;
	int		Port;

	virtual void AutoDetectProxy()
	{
		throw new CSocketException("Auto Detection Not Implemented Here. Please Contact Akash Kava at ackava@neurospeech.com","");
	}

	virtual void SetProxySettings(LPCTSTR lpszHttpServer,int nPort)
	{
		HttpServer = lpszHttpServer;
		Port = nPort;
	}

	virtual void ConnectTo(LPCTSTR lpszHost , int nPort)
	{

		// If No Http Proxy Server Specified then connect to host directly..
		if(HttpServer.IsEmpty())
		{
			CSocketClient::ConnectTo(lpszHost,nPort);
			return;
		}

		CSocketClient::ConnectTo(HttpServer,Port);
		
		CString Line;
		
		Line.Format("CONNECT %s:%d HTTP/1.0",lpszHost,nPort);
		(*this)<<Line;
		Line.Format("host: %s:%d",lpszHost,nPort);
		(*this)<<Line;
		Line.Empty();
		(*this)<<Line;

		
		
		(*this)>>Line;

		int i = Line.Find(' ');
		if(i!=-1)
			Line = Line.Mid(i+1);


		if(Line.Left(3)!="200")
		{


			// Sorry Guys Http Proxy Authentication Not Implemented !!!
			if(Line.Left(3)=="407")
			{
				AfxMessageBox("Sorry Guys Http Proxy Authentication Not Implemented in Demo!!!");
			}


			throw new CSocketException("Proxy Connection Denied",Line.Mid(4));
		}


		do
		{
			(*this)>>Line;
			if(Line.IsEmpty())
				break;
		}while(true);


	}

};


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -