andremussche/DelphiWebsockets

IdIOHandlerWebsocket.pas

Yvi71 opened this issue · 11 comments

Yvi71 commented

Hi,
when trying to use your websockets implementation with openssl, i found a "problem" in the IdIOHandlerWebsocket.pas in the function WriteData. At the very end of this function the data is written to the binding. The binding writes the data directly, bypassing the sslsocket, which crashes the connection.

function TIdIOHandlerWebsocket.WriteData(aData: TIdBytes; aType: TWSDataCode; aFIN, aRSV1, aRSV2, aRSV3: boolean): integer;

...
Result := Binding.Send(bData, ioffset);

Changing the line to
Result := inherited WriteDataToTarget(bdata,iOffset, (Length(bData)-ioffset));

works, though.

It took me some time to figure this out, so maybe this may help others.

best regards,
yves

@Yvi71 I am trying to use this implementation with ssl, but, it seems that I am far away from the solution. Can you share your code or what you had to do?

Yvi71 commented

Hi Robert,
i had to do some changes to the code of andre to geht it work with SSL. Currently i am on vacations in italy, but should be back in monday. I can send you my changes then or upload it here as a fork.

Best regards,
yves

Am 20. August 2015 21:02:22 MESZ, schrieb Roberto Schneiders notifications@github.com:

@Yvi71 I am trying to use this implementation with ssl, but, it seems
that I am far away from the solution. Can you share your code or what
you had to do?

@Yvi71 That would be great. Thank you.

Yvi71 commented

Hi Roberto,
pls mail me and i will send you what i have.
regards,
yves

Frees commented

@Yvi71 Why don't you push your changes to github?

sorry for the late reaction, but I committed the proposed change now.
@Yvi71: is this the only change needed to get it working?

Yvi71 commented

Hi Andre,
no, that wasn't the only change to get it working. Unfortunately i hadn't the time to reintegrate the changes back to your base.
If you give me an email - adress, i can send you what i have.

Am 1. Oktober 2015 08:41:50 MESZ, schrieb "André Mussche" notifications@github.com:

sorry for the late reaction, but I committed the proposed change now.
@Yvi71: is this the only change needed to get it working?


Reply to this email directly or view it on GitHub:
#1 (comment)

@Yvi71: okay, I have send you an email, thanks in advance!
(I will try to merge it)

Yvi71 commented

@andremussche, I sent the stuff over to you.
If i had to merge it, i'd maybe define a compilerswitch to back out if the ssl stuff if not needed, to keep out the extra code for openssl. But i hope, for our all best, that encrypted traffic will be the default ;) just in these days - even though ssl / tls for sure isn't the holy grale. It's better than nothing..

best regards,
yvi

Yvi71 commented

Hi @andremussche,
ok, i merged it finally. were not too many changes, after all (most was to rename back the classnames and remove some debug code). also added the mentioned compiler switch to turn off ssl support.

best regards,
yves

thanks,
I made a big refactoring some time ago to support both (https and https) independent of a compiler switch. I have put this in a seperate branch (\main\SSL support) now. I am testing this and when it is stable I will merge it back to the main branch.