1
2
3
4
5
6
7
8
9
|
<tt>
<div>Hi everyone, newb questions here:</div><div><br></div><div>Is the reason why the type specification for the init callback lists various "<span class="p" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre">{</span><span class="n" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre">loop</span><span class="p" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:16px;white-space:pre">,..." </span><font face="arial, helvetica, sans-serif"><span class="p" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-size:12px;line-height:16px;white-space:pre">tuples, because a single module can implement cowboy_loop_handler and cowboy_http_handler?</span></font></div><br>
<div><font face="arial, helvetica, sans-serif"><span class="p" style="margin:0px;padding:0px;border:0px;color:rgb(51,51,51);font-size:12px;line-height:16px;white-space:pre">And this way, a dializier warning will not be triggered?</span><span style="color:rgb(51,51,51);font-size:12px;line-height:16px;white-space:pre;background-color:rgb(255,255,204)"> </span></font></div><br>
<a href="https://github.com/extend/cowboy/blob/master/src/cowboy_http_handler.erl#L39">https://github.com/extend/cowboy/blob/master/src/cowboy_http_handler.erl#L39</a><div><br></div><div>Because looking at the handler code,�<a href="https://github.com/extend/cowboy/blob/master/src/cowboy_protocol.erl#L473">https://github.com/extend/cowboy/blob/master/src/cowboy_protocol.erl#L473</a>�if the {loop, * is returned from init, then the�<font face="arial, helvetica, sans-serif"><span class="nf" style="font-size:13px;line-height:19px;margin:0px;padding:0px;border:0px;color:rgb(153,0,0);font-weight:bold">handle</span><span class="p" style="color:rgb(51,51,51);font-size:13px;line-height:19px;margin:0px;padding:0px;border:0px">(</span><span class="nv" style="font-size:13px;line-height:19px;margin:0px;padding:0px;border:0px;color:rgb(0,128,128)">Req</span><span class="p" style="color:rgb(51,51,51);font-size:13px;line-height:19px;margin:0px;padding:0px;border:0px">,</span><span style="background-color:rgb(248,248,248);color:rgb(51,51,51);font-size:13px;line-height:19px"> </span><span class="nv" style="font-size:13px;line-height:19px;margin:0px;padding:0px;border:0px;color:rgb(0,128,128)">State</span><span class="p" style="color:rgb(51,51,51);font-size:13px;line-height:19px;margin:0px;padding:0px;border:0px">) will not be processed.</span></font></div><br>
<div><span class="p" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:19px;margin:0px;padding:0px;border:0px"><br></span></div><div><span class="p" style="color:rgb(51,51,51);font-size:13px;line-height:19px;margin:0px;padding:0px;border:0px"><font face="arial, helvetica, sans-serif">Also, is it safe to say that Handler:init is like "before" in lot's of web frameworks. I can place validation\authentication logic there.</font></span></div><br>
<div><span class="p" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:13px;line-height:19px;margin:0px;padding:0px;border:0px"><br></span></div><div>Sincerely,</div><div><br>
<br></div><div>-rambocoder</div><br>
</tt>
|