Jump to content

Search the Community

Showing results for tags 'proxy'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 3 results

  1. Hi, After updating from v8.57 to 8.68, the proxy setting in my TsslHttpCli component did not work anymore. Proxy: http://xxx.xxx.xxx.xxx:8080/wpad.dat Port: 8080 ProxyUsername / ProxyPassword are also set In unit OverbyteIcsHttpProt, function THttpCli.PrepareNTLMAuth(var FlgClean : Boolean) : Boolean; I did revert that part: 8.68 code: { this flag can tell if we proceed with OnRequestDone or will try } { to authenticate } Result := FALSE; if (httpoNoNTLMAuth in FOptions) and (((FStatusCode = 401) and (FServerAuth = httpAuthNtlm)) or ((FStatusCode = 407) and (FProxyAuth = httpAuthNtlm))) then Exit else if (FStatusCode = 407) and (FDoAuthor.Count > 0) and (FProxyAuthBasicState = basicNone) {$IFDEF UseDigestAuthentication} and (FProxyAuthDigestState = digestNone) {$ENDIF} then begin // V8.61 OAS : remove case where user and PW are empty because used for User credentials { We can handle authorization } TmpInt := FDoAuthor.Count - 1; while TmpInt >= 0 do begin if CompareText(Copy(FDoAuthor.Strings[TmpInt], 1, 4), 'NTLM') = 0 then begin Result := TRUE; if Assigned(FOnBeforeAuth) then FOnBeforeAuth(Self, httpAuthNtlm, FALSE, FDoAuthor.Strings[TmpInt], Result); if Result then begin if (FProxyUsername = '') and (FProxyPassword = '') and not Assigned(FAuthNtlmSession) then // V8.61 FAuthNtlmSession := TNtlmAuthSession.Create (cuOutbound) ; // Create session for proxy NTLM StartAuthNTLM; if FAuthNTLMState in [ntlmMsg1, ntlmMsg3] then FlgClean := True; Break; end; end; Dec(TmpInt); end; end reverted to 8.57 code: { this flag can tell if we proceed with OnRequestDone or will try } { to authenticate } Result := FALSE; if (httpoNoNTLMAuth in FOptions) and (((FStatusCode = 401) and (FServerAuth = httpAuthNtlm)) or ((FStatusCode = 407) and (FProxyAuth = httpAuthNtlm))) then Exit; if (FStatusCode = 401) and (FDoAuthor.Count > 0) and (FAuthBasicState = basicNone) and {$IFDEF UseDigestAuthentication} (FAuthDigestState = digestNone) and {$ENDIF} (FCurrUserName <> '') and (FCurrPassword <> '') then begin { We can handle authorization } TmpInt := FDoAuthor.Count - 1; while TmpInt >= 0 do begin if CompareText(Copy(FDoAuthor.Strings[TmpInt], 1, 4), 'NTLM') = 0 then begin Result := TRUE; if Assigned(FOnBeforeAuth) then FOnBeforeAuth(Self, httpAuthNtlm, FALSE, FDoAuthor.Strings[TmpInt], Result); if Result then begin StartAuthNTLM; if FAuthNTLMState in [ntlmMsg1, ntlmMsg3] then FlgClean := True; Break; end; end; Dec(TmpInt); end; end and... miracle: it did work again !! (with everything else from v8.68).... I am NOT sure that is a bug: I might have something wrong in my code leading to that and need to set some properties to my TSslHttpCli to avoid that... But I don't know what... if somebody can help, thanks in advance Mel
  2. Keesver

    Chain of two HttpProxyServer servers

    Hello, We want to add remote support to our application and for this we want to use two idHttpProxyServer's chained together. The first server resides on our public server, the second instance resides on the customers network. This is the code we are using: public server: constructor TRemoteServer.Create(IP: string; Port: Integer); begin IdHTTPProxyServer1 := TIdHTTPProxyServer.Create(nil); IdHTTPProxyServer1.ReuseSocket := rsTrue; IdHTTPProxyServer1.DefaultPort := Port; IdHTTPProxyServer1.OnHTTPBeforeCommand := HTTPBeforeCommandHandler; var handler := IdHTTPProxyServer1.CommandHandlers.Add; handler.Command := 'DEST'; handler.HelpSuperScript := 'Sets caller as a DESTINATION for remote support (usage DEST PIN URL)'; handler.OnCommand := DEST_Handler; if (IP <> '') and (Port <> 0) then begin Writeln('Starting server, binding to: ' + IP + '-' + Port.ToString); var bind := IdHTTPProxyServer1.Bindings.Add; bind.IP := IP; bind.Port := Port; bind.ReuseSocket := rsTrue; end else Writeln('Starting server, default binding'); IdHTTPProxyServer1.Active := True; Writeln('Server running, listening on: ' + IdHTTPProxyServer1.Bindings[0].IP + ' - ' + IdHTTPProxyServer1.Bindings[0].Port.ToString); end; procedure TRemoteServer.DEST_Handler(ASender: TIdCommand); begin Writeln(ASender.RawLine); dest_ip := ASender.Context.Binding.PeerIP; dest_port := ASender.Context.Binding.PeerPort; dest_pin := ASender.Params[0]; dest_url := ASender.Params[1]; Writeln('Address: ' + dest_ip + ' - ' + dest_port.ToString); end; procedure TRemoteServer.HTTPBeforeCommandHandler(AContext: TIdHTTPProxyServerContext); begin if dest_ip <> '' then begin Writeln('Command redirected to DESTINATION: ' + dest_ip + ' - ' + dest_port.ToString); var tempIO := TIdIOHandlerStack.Create(AContext.OutboundClient); tempIO.ReuseSocket := rsTrue; // tempIO.BoundIP := '10.0.2.4'; //IdHTTPProxyServer1.Bindings[0].IP; tempIO.BoundPort := 443; // IdHTTPProxyServer1.Bindings[0].Port; var tempProxy := TIdConnectThroughHttpProxy.Create(AContext.OutboundClient); tempProxy.Enabled := True; tempProxy.Host := dest_ip; tempProxy.Port := dest_port; tempIO.TransparentProxy := tempProxy; AContext.OutboundClient.IOHandler := tempIO; end; end; Client code: procedure TForm1.ConnectToRemote(Connection: string); begin HTTPProxyServer.Active := False; IdTCPClient1.Disconnect; IdTCPClient1.Host := <SERVER IP/URL>; //Connection.Split([':'])[0]; IdTCPClient1.Port := <SERVER PORT>; // Connection.Split([':'])[1].ToInteger; IdTCPClient1.Connect; // Tell server we are there IdTCPClient1.SendCmd('DEST 4444 https://abc.com'); HTTPProxyServer.Bindings.Clear; var bind := HTTPProxyServer.Bindings.Add; bind.IP := IdTCPClient1.Socket.Binding.IP; bind.Port := IdTCPClient1.Socket.Binding.Port; bind.ReuseSocket := rsTrue; HTTPProxyServer.Active := True; end; This setup works when we run both server and client on the same computer. However, when we put the server on a remote computer, it does not work. Should this work, or do we need other means to make this happen? Thanks and regards, Kees
  3. Hi, I am trying to figure out how to connect to office 365 through a proxy server. My application is working well if I connect without a proxy. But now the requirement changed and direct connection to internet is not allowed and I have to use a proxy. I can connect to office 365 from the production machine through proxy using a browser. So the connection setup is good. Now I need to change my application to use a proxy. So I looked around and found that I have to use TIdIOHandlerStack and IdConnectThroughHttpProxy1 to achieve it. But the help document is not that great. So looking for suggestions/help. My code looks like this. type TForm1 = class(TForm) Button1: TButton; IdIMAP: TIdIMAP4; IdConnectThroughHttpProxy1: TIdConnectThroughHttpProxy; IdIOHandlerStack1: TIdIOHandlerStack; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin IdIMAP.Username := 'test@test.com'; // outlook user name IdIMAP.Password := 'xxxxx'; // outlook user password IdIMAP.Port := 993; // outlook server port IdIMAP.Host := 'outlook.office365.com'; // outlook server IdIMAP.AuthType := iatUserPass; IdConnectThroughHttpProxy1.Host := 'x.x.x.x'; // Proxy server IdConnectThroughHttpProxy1.Port := 1234; // Proxy server port IdIOHandlerStack1.TransparentProxy := IdConnectThroughHttpProxy1; IdIMAP.IOHandler := IdIOHandlerStack1; try Memo1.Lines.Clear; Memo1.Lines.Add('Trying to connect to server...'); if not IdIMAP.Connected then begin if IdIMAP.Connect(false) then Memo1.Lines.Add('Connected to server') else Memo1.Lines.Add('NOT Connected to server') end; Memo1.Lines.Add('Trying to login to server...'); if not(IdIMAP.ConnectionState in [csAuthenticated, csSelected]) then IdIMAP.Login; Memo1.Lines.Add('Logged in to server'); except on E: Exception do begin Memo1.Lines.Add('Error while connecting: ' + E.Message); end; end; end; When I try this, I get "Error while connecting: 403 forbidden error" Thanks for your time, Kind regards, Soji.
×