I have the first error:
Erreur: SSL2 Token

and second:
Connection failed : #404 : Connection aborted on request

Here my little code to get a Token on a server:

function TOPSKey.GetRemoteToken : String;
var
  Data    : AnsiString;
  RcvStrm : TMemoryStream;
  SndStrm : TMemoryStream;
  c       : PChar;
  Cle     : String;
begin
  Result                := '';
  SndStrm               := TMemoryStream.Create;
  RcvStrm               := TMemoryStream.Create;
  Data                  := 'grant_type=client_credentials';

  SSL2.Proxy            := Trim(Main.ProxyHost);
  SSL2.ProxyPort        := Trim(Main.ProxyPort);
  SSL2.ProxyUsername    := Trim(Main.ProxyUser);
  SSL2.ProxyPassword    := Trim(Main.ProxyPwd);

  SSL2.SendStream       := SndStrm;
  SSL2.SendStream.Write(Data[1], Length(Data));
  SSL2.SendStream.Seek(0,0);
  SSL2.RcvdStream       := RcvStrm;
  SSL2.URL              := 'https://xxx.xxx.xxx.xxx/auth/accesstoken';
  try
    SSL2.Post;
  except
    ShowMessage('Erreur: SSL2 Token');
  end;

  Case SSL2.StatusCode of
   200: // Ok
        Begin
          RcvStrm.Seek(0, 0);
          SetLength(Data, RcvStrm.Size);
          RcvStrm.Read(Data[1], Length(Data));

          c := PChar(Data);
          If Scan('"access_token" : "', '",', c, Cle) then
            result  := Cle
          else
            ShowMessage(Data);

          RcvStrm.Free;
          SndStrm.Free;
        end;
  Else // Connection Failed
        Begin
Showmessage('Connection failed : #' + IntToStr(SSL2.StatusCode) + ' : ' + SSL2.ReasonPhrase);

          Exit;
        end;
  End;

end;

procedure TOPSKey.ssl2BeforeHeaderSend(Sender: TObject;
  const Method: String; Headers: TStrings);
begin
  Headers.Add('Authorization: Basic ..........JQ0R6QWQ0ME1uMA==');
end;



Le 04/11/2013 14:48, Bruno Mannina a écrit :
Hi all,

I get this error when I try my little programme behind a proxy server:

Connection failed : #404 : Connection aborted on request

Any ideas are welcome,

Note: if my little prog is not behind a proxy, it works fine

regards,
Bruno

Le 04/11/2013 00:19, Bruno Mannina a écrit :
Dear ICS support, users,

Delphi 7

I try to use HTTP-SSL behind a proxy server, so I give host/port/user/pwd to the httpssl component.

But it seems to not work.

I added also ssl context to the HttpSsl component.

I must add something more ?

Thanks a lot,
Bruno

---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com




---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to