How to 'upgrade' a Microsoft.AspNetCore.Connections.ConnectionContext to a SslStream? #55071
-
I'm using (minimal) Kestrel in a multi-purpose setup:
I'm struggling with the latter as I'm implementing the MySQL wire protocol server side (don't ask, there is a business reason). The problem is that during the handshake phase the client wants to upgrade the connection to SSL which usually is done like:
However, that requires a stream which is readable and writable. Unfortunately I only have:
... which can't be used on
My only 'escape' for now is trying to implement a duplex stream as wrapper for both streams above which then could be stuffed into Isn't there a read/write stream with Microsoft.AspNetCore.Connections.ConnectionContext which I could upgrade midstream to a SslStream? What am I missing? Side note: this was a 'walk in the park' with legacy System.Net.HttpListener. I would expect something similar with Kestrel... Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
You can copy the code from kestrel: |
Beta Was this translation helpful? Give feedback.
-
@davidfowl thanks for your suggestion. Unfortunately it appears not to work due to compile error below. What am I missing? |
Beta Was this translation helpful? Give feedback.
-
Thanks again @davidfowl. For anyone else running into that problem: I finally got it working by pulling together the files below from sources + tweaking task related code which still won't compile in DuplexPipeStream.cs. Not sure if this will hold water, but it's my only option for now. :-( @danroth27 I wonder why it has to be so complicated with Kestrel to upgrade a socket to SSL?!? This was simple 'one-liner' with legacy System.Net.HttpListener... |
Beta Was this translation helpful? Give feedback.
Thanks again @davidfowl.
For anyone else running into that problem: I finally got it working by pulling together the files below from sources + tweaking task related code which still won't compile in DuplexPipeStream.cs. Not sure if this will hold water, but it's my only option for now. :-(
@danroth27 I wonder why it has to be so complicated with Kestrel to upgrade a socket to SSL?!? This was simple 'one-liner' with legacy System.Net.HttpListener...