🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #5463

HTTPS Proxy

#5463
From: Hugo Dias
Date: Wed, 15 Sep 2004 17:35
86 lines
3097 bytes
I'm trying to develop an HTTPS proxy, but i simply can't pass the data 
between
sockets . ReadBuffer and WriteBuffer are not working.

Any ideas ? Thanks in advance.


Thanks in advoid __fastcall TForm1::IdTCPServer1CommandConnectCommand(
      TIdCommand *ASender)
{
 TIdTCPClient *Client = new TIdTCPClient(NULL);
 try
 {
  String aux = 
ASender->UnparsedParams.SubString(1,ASender->UnparsedParams.Pos(" ")-1);
  Client->Host = aux.SubString(1,aux.Pos(":")-1);
  Client->Port = aux.SubString(aux.Pos(":")+1,aux.Length()).ToInt();

  Client->Connect();
  try
  {
   ASender->Thread->Connection->WriteLn("HTTP/1.0 200 Connection 
established");
   ASender->Thread->Connection->WriteLn("Proxy-agent: IronClad/1.1");
   ASender->Thread->Connection->WriteLn("\r\n");

   while(ASender->Thread->Connection->Connected() && Client->Connected())
   {
    char buf[8192];
    memset(buf,0,8192);
    ASender->Thread->Connection->ReadBuffer(buf,8192);
    Client->WriteBuffer(buf,8192);
    memset(buf,0,8192);
    Client->ReadBuffer(buf,8192);
    ASender->Thread->Connection->WriteBuffer(buf,8192);
   }
  }
  catch(...)
  {
  }
 }
 __finally
 {
  delete Client;
 }
}

void __fastcall TForm1::IdTCPServer1CommandConnectCommand(
      TIdCommand *ASender)
{
 TIdTCPClient *Client = new TIdTCPClient(NULL);
 try
 {
  String aux = 
ASender->UnparsedParams.SubString(1,ASender->UnparsedParams.Pos(" ")-1);
  Client->Host = aux.SubString(1,aux.Pos(":")-1);
  Client->Port = aux.SubString(aux.Pos(":")+1,aux.Length()).ToInt();

  Client->Connect();
  try
  {
   ASender->Thread->Connection->WriteLn("HTTP/1.0 200 Connection 
established");
   ASender->Thread->Connection->WriteLn("Proxy-agent: IronClad/1.1");
   ASender->Thread->Connection->WriteLn("\r\n");

   while(ASender->Thread->Connection->Connected() && Client->Connected())
   {
    char buf[8192];
    memset(buf,0,8192);
    ASender->Thread->Connection->ReadBuffer(buf,8192);
    Client->WriteBuffer(buf,8192);
    memset(buf,0,8192);
    Client->ReadBuffer(buf,8192);
    ASender->Thread->Connection->WriteBuffer(buf,8192);
   }
  }
  catch(...)
  {
  }
 }
 __finally
 {
  delete Client;
 }
} 
Technical Details
Message-ID: <41487d4e@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,90d3c96131bea465,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Hugo Dias" <synchron@no-spam.synchron-systems.com>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: HTTPS Proxy
Date: Wed, 15 Sep 2004 18:35:17 +0100
Lines: 88
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 83.144.132.61
Message-ID: <41487d4e@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1095269710 83.144.132.61 (15 Sep 2004 10:35:10 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail