Delphi Synapse + Proxy

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by immortalist, 31 Jan 2011.

  1. immortalist

    immortalist Member

    Joined:
    16 Jan 2010
    Messages:
    99
    Likes Received:
    64
    Reputations:
    37
    Имеется функция:
    Code:
    function send(method,zap,cooc,params,ref,mime,proxyTYPE,proxy,port,proxyUSER,proxyPASS:string;headerS:array of string):string;
    var Header : TStringList;
    	  Contents : TStringList;
    	  httpsend: THTTPSend;
        ss: TStringStream;
        i:integer;
        rev:string;
    begin
      Header := TStringList.Create;
      Contents := TStringList.Create;
      ss := TStringStream.Create('');
      httpsend:=THTTPSend.Create;
      HTTPsend.UserAgent:='Opera 9.0';
      httpsend.Headers.Insert(0,'Referer: '+ref);//referer
      httpsend.Cookies.Text:=cooc;                //coocies
      httpsend.MimeType:=mime;
      for i:=1 to 100 do begin
        if trim(headers[i])<>''then
          Header.Add(headers[i])
        else break;
      end;
      httpsend.Headers.AddStrings(Header);        //headers
      if proxyTYPE='HTTP' then begin
        httpsend.ProxyHost:=proxy;
        httpsend.ProxyPort:=port;
      end else if proxyTYPE='SOCKS 4' then begin
        HTTPsend.Sock.SocksIP := proxy;
        HTTPsend.Sock.SocksPort := port;
      end else if proxyTYPE='SOCKS 5' then begin
        HTTPsend.Sock.SocksIP := proxy;
        HTTPsend.Sock.SocksPort := port;
        HTTPsend.Sock.SocksUsername := proxyUSER;
        HTTPsend.Sock.SocksPassword := proxyPASS;
      end;
      if method='GET' then begin
        httpsend.HTTPMethod('GET',zap );
      end;
      if method='POST' then begin
        ss.WriteString(params);
        httpsend.Document.LoadFromStream(ss);
        httpsend.HTTPMethod('POST',zap);
      end;
      Contents.LoadFromStream(httpsend.Document);
      rev := Contents.Text;
      if pos('302',IntToStr(HTTPsend.ResultCode))<>0 then begin
        result:='302';
      end else    if pos('500',IntToStr(HTTPsend.ResultCode))<>0 then begin
        result:='500';
      end else   if pos('404',IntToStr(HTTPsend.ResultCode))<>0 then begin
        result:='404';
      end else   if pos('400',IntToStr(HTTPsend.ResultCode))<>0 then begin
        result:='400';
      end else
        result:=rev;
      httpsend.Free;
      header.Free;
      contents.Free;
      ss.Free;
      exit;
    end;
    
    При запросе вида
    Code:
    rev:=send('GET','http://www.whatismyip.com/automation/n09230945.asp','','','','application/x-www-form-urlencoded;',proxytype,prx,prt, '', '', head);
    В ответ получаю ошибку 500. В чем может быть проблема? При запросе на любой адрес, с любой прокси.
     
  2. Stalker Mailer

    Stalker Mailer New Member

    Joined:
    18 Dec 2015
    Messages:
    1
    Likes Received:
    0
    Reputations:
    0
    библиотеки положи
     
  3. Mrgun

    Mrgun New Member

    Joined:
    20 Feb 2016
    Messages:
    6
    Likes Received:
    0
    Reputations:
    0
    ssl библиотеки в папку с программой а в USES - ssl_openssl
     
  4. ol1ver

    ol1ver Active Member

    Joined:
    22 Jul 2011
    Messages:
    237
    Likes Received:
    155
    Reputations:
    0
    Археологи