<div dir="ltr"><div>But then I would have to check the client cert for each and every request.  I should have to check the cert only once at connect time and then be able to pass the result of that check in the request to each handler.<br>
<br></div>Anyway I've gone ahead and implemented what I need in a generic manner and it seems to work well.  I think it would be a useful addition to Cowboy.  If you agree I could write some more documentation for it.<br>
<div><br><a href="https://github.com/goertzenator/cowboy/tree/onconnect">https://github.com/goertzenator/cowboy/tree/onconnect</a><br><br></div><div>I added a "onconnect" hook and "connection metadata" to cowboy_req.  The connection metadata works like existing metadata, but is preserved from request to request on the same connection.  The onconnect hook provides initial values for the connection metadata.<br>
<br></div><div>Dan.<br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 5, 2014 at 3:04 AM, Loïc Hoguin <span dir="ltr"><<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 06/05/2014 01:44 AM, Daniel Goertzen wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
<br>
<br>
<br>
On Wed, Jun 4, 2014 at 4:48 PM, Loïc Hoguin <<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a><br></div><div class="">
<mailto:<a href="mailto:essen@ninenines.eu" target="_blank">essen@ninenines.eu</a>>> wrote:<br>
<br>
    On 06/04/2014 10:08 PM, Daniel Goertzen wrote:<br>
<br>
        I am having very good luck with Cowboy so far, but I have some<br>
        questions:<br>
<br>
        1. There doesn't appear to be any way to do client certificate<br>
        authorization in Cowboy, although I see there is an example for<br>
        doing<br>
        exactly that with Ranch.  I think I could modify Cowboy to do what I<br>
        want, but I thought I would ask if there were other options<br>
        before doing<br>
        that.<br>
<br>
<br>
    Same as Ranch really, you just gotta take the socket and then call<br>
    the ssl functions.<br>
<br>
<br>
Yes, but in cowboy there's no API to get at the socket.<br>
</div></blockquote>
<br>
There is the undocumented function cowboy_req:get/1 which is meant for that kind of "special" use.<div class="HOEnZb"><div class="h5"><br>
<br>
-- <br>
Loïc Hoguin<br>
<a href="http://ninenines.eu" target="_blank">http://ninenines.eu</a><br>
</div></div></blockquote></div><br></div>