Think about Loose Coupling | |
PerlMonks |
Re^5: Dynamic SNI certificates while upgrading to SSLby FloydATC (Deacon) |
on May 12, 2017 at 06:22 UTC ( [id://1190116]=note: print w/replies, xml ) | Need Help?? |
I hope you don't mind me necroing this old topic but I solved the exact same problem successfully by forking the process this way: my $pid = open(my $pipe, "-|");In the child process I then upgrade the client socket to SSL, contact the server and relay data between the two. Whatever info I need to send back to the parent process I can just print to STDOUT. The parent process has a very tight main loop switching between accept()'ing new connections and using IO::Select to determine which $pipe sockets are ready for non-blocking reads. In another project of mine (not SSL related) I went a little further and established a plain two-way socket between the two processes and used non-blocking/select based sysread/syswrite on those as well. Non-blocking sockets between forked processes are actually a lot of fun :-) Admittedly, the forking model does have its limitations when it comes to scaling, but it's relatively simple to get up and running and I found it quite sufficient for doing simple traffic inspection.
-- FloydATC
I got 99 problems, most of them have to do with printers.
In Section
Seekers of Perl Wisdom
|
|