-
-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce ranch_transport:peercert/1 callback #337
base: master
Are you sure you want to change the base?
Conversation
@essen could you take a look, please? |
It looks fine but can you explain the motivation behind this so we can prioritize? |
I wonder, why should this be in |
Yeah, the motivation behind that - we are using the TLS, with I agree, the |
I'm not convinced, or maybe I just don't get it 😅 Having the But I'm not the one who is calling the shots here, so this is just my two cents 😉 @essen, what do you think? |
Yes, I understand that, of course, and because of that, I need this fix for this PR - ninenines/cowboy#1559 |
Regarding the
I absolutely agree with you, and maybe better make such callback an optional. But I don’t do that, because the ranch_tcp already has some callbacks that is not implemented, but throw an error in case they are called. So, it’s possibly make sense make them optional too |
I think we should implement them and throw an error to make it clearer to the user that the operation is not supported. I'm not against making all 3 callbacks optional for people who write their own transport module but it hasn't come up before. |
So if we add |
OK clarifying, when I say implement them I mean in As for |
As for ranch_transport, we should only add them there if they are set as
optional, and otherwise not add them at all.
But, right now all callbacks in ranch_transport are mandatory, not optional...
|
I'm not sure how that's a problem, we can have mandatory and optional callbacks. |
I'm a little bit confused, what's the final idea/proposal/solution? |
There are 2 callbacks right now implemented to throw For other functions like |
I'm definitely don't understand you. We have the ranch and ranch_transport behavior, this behavior abstracts some common cases of transports/protocol, but also, it could also need some transports/protocol specific. The most important is that behavior said to the implementations what functions and what behavior MUST be implemented. But you said:
In this case, the peercert which needed by ranch is will be called from ranch_transport implementation, but will not be defined in behavior. So, how 3rd party ranch_transport implementation should know that they have to implement and expose such function? |
I'm sorry =^^= I think I know where the source of the confusion lies, I just can't find a good explanation =^^= I guess you're thinking of (@Maria-12648430, you're better at explaining stuff than me, help us already XD) |
In short, it's not super important, don't worry about it. |
Is any chance this PR will be merged, I wouldn't like to fork cowboy and ranch, to workaround the following error:
|
@juise I may be mistaken, but it seems to me that that error has nothing to do with the suggested change to |
@juise @Maria-12648430 yeah, I wonder, too. Having Anyway, @essen may want to merge #338 first, so the tests will pass again. And @juise, even if this gets merged now, it requires another PR at cowboy to be accepted to use this, and that cowboy version would not work together with older ranch versions where the |
@juise oh wait, I remember... You had some sort of custom transport 😅 |
There's some flaky tests it seems but master is using Actions now, so please rebase so your PR can go through CI. Thanks! |
This callback should be used from cowboy_http and cowboy_http2 instead of a direct call to ssl:peercert/1.