[fpc-pascal] https support; call for testers
Reinier Olislagers
reinierolislagers at gmail.com
Mon Apr 14 11:26:33 CEST 2014
On 13/04/2014 22:29, Michael Van Canneyt wrote:
> On Sun, 13 Apr 2014, Reinier Olislagers wrote:
>> On 11/04/2014 15:27, Reinier Olislagers wrote:
>>> On 11/04/2014 15:00, Michael Van Canneyt wrote:
>> If you want to use client side certificates with httpclient, how would
>> you do specify that?
>
> I don't want to burden the component with too much properties.
>
> So, I have implemented 2 methods:
>
> 1. The socket handler is now created in a virtual method:
> GetSocketHandler
> it can be overridden to implement custom behaviour.
>
> 2. There is an event OnGetSocketHandler which can be assigned to create
> the socket.
> the default GetSocketHandler calls this event, and if the event
> handler is not
> set or returns a Nil handler, it will create a default handler.
Suggest promoting OnGetSocketHandler to public:
Index: packages/fcl-web/src/base/fphttpclient.pp
===================================================================
--- packages/fcl-web/src/base/fphttpclient.pp (revision 27579)
+++ packages/fcl-web/src/base/fphttpclient.pp (working copy)
@@ -266,6 +266,7 @@
Property OnPassword;
Property OnDataReceived;
Property OnHeaders;
+ Property OnGetSocketHandler;
end;
EHTTPClient = Class(Exception);
I've tested with code like this in the callback:
AHandler:=nil;
if UseSSL and (FClientCertificate<>'') then
begin
// Only set up client certificate if needed.
// If not, let normal fphttpclient flow create
// required socket handler
AHandler:=TSSLSocketHandler.Create;
(AHandler as
TSSLSocketHandler).Certificate.FileName:=FClientCertificate;
end;
which seems to work fine (no crash, stepping through the code gave good
init) but I can't test further as I've misconfigured my server (can't
get it to accept client certs from browser either; probably need some
more fiddling with CA files)
Thanks!
More information about the fpc-pascal
mailing list