[Gambas-user] Gambas3, ServerSocket and SSL support

Benoît Minisini gambas at ...1...
Fri Sep 25 18:39:25 CEST 2015


Le 25/09/2015 18:29, Tobias Boege a écrit :
> On Fri, 25 Sep 2015, Alexie wrote:
>> Hi All,
>>
>> Gambas3 has a lot of networking features, including acting like a (Web)
>> Server. Only thing what is lacking is SSL support and IPv6 (separate topic
>> :-)) ... I made some code for DomotiGa, to support SSL in the ServerSocket.
>> I basically create a wrapper around the ServerSocket and Socket, called the
>> 'CServerSocket.class' and 'CSocket.class'. They resemble almost the same
>> features/parameters/events of the original classes ... Including native
>> support for HTTP and WebSocket, so you don't have to decode/parse it
>> yourself - you get directly the good data with a read event ... It has been
>> tested on Ubuntu and Raspbian devices. Also I have done some benchmarking
>> and didn't notice impact on performance.
>>
>> Attached is the code, including an example to use the 'new'
>> CServerSocket.class and CSocket.class.
>>
>> Just let me know if you like it or find bugs!
>>
>
> It seems you are using OpenSSL libraries via Extern. We already have a
> gb.openssl component, but it lacks SSL support. (Back then, I only cared
> to transfer hashes and ciphers from libcrypto.)
>
> If you know C, your work hours might be most profitable if you modify
> gb.openssl instead of hacking with Extern. Once this modification is good
> enough that you have no Extern left in your classes, those classes can
> easily wander into a Gambas component like "gb.openssl.net" and override
> gb.net's classes.
>
> Regards,
> Tobi
>

Cool.

The ServerSocket seams clean, but the Socket class should have nothing 
related to a specific protocol. Those parts should have been put into 
other classes like HttpSocket and WebSocket (if it is not the same thing).

And as Tobias said, all external functions should be replaced by 
functions in the gb.openssl component, so that dependencies are 
correctly managed.

The final result will be put in a component named "gb.net.ssl" (not 
openssl, because the openssl is inside gb.openssl, and theoritically we 
could have a compatible gb.mybetterssl component).

Regards,

-- 
Benoît Minisini




More information about the User mailing list