diff options
Diffstat (limited to '_build/static/archives/extend/2014-September')
15 files changed, 1466 insertions, 0 deletions
diff --git a/_build/static/archives/extend/2014-September/000458.html b/_build/static/archives/extend/2014-September/000458.html new file mode 100644 index 00000000..8b93f654 --- /dev/null +++ b/_build/static/archives/extend/2014-September/000458.html @@ -0,0 +1,85 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] Using cowboy_req:body more than once per request + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Using%20cowboy_req%3Abody%20more%20than%20once%20per%20request&In-Reply-To=%3CCA%2BdV7cT%2BPOGJM%3DnqBcvnP_NoZUa%3D_ZHjGx-9gBQ%2B09Pe7aE2bg%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + + <LINK REL="Next" HREF="000462.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] Using cowboy_req:body more than once per request</H1> + <B>Paulo F. Oliveira</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Using%20cowboy_req%3Abody%20more%20than%20once%20per%20request&In-Reply-To=%3CCA%2BdV7cT%2BPOGJM%3DnqBcvnP_NoZUa%3D_ZHjGx-9gBQ%2B09Pe7aE2bg%40mail.gmail.com%3E" + TITLE="[99s-extend] Using cowboy_req:body more than once per request">paulo.ferraz.oliveira at gmail.com + </A><BR> + <I>Mon Sep 15 23:24:20 CEST 2014</I> + <P><UL> + + <LI>Next message: <A HREF="000462.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#458">[ date ]</a> + <a href="thread.html#458">[ thread ]</a> + <a href="subject.html#458">[ subject ]</a> + <a href="author.html#458">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>Hi. + +I recently implemented a checksum header (X-Checksum) that allows +validating the content of a request's body by hash comparison (just to give +you some context). I'm using the onrequest hook to affect all requests (and +be able to reply appropriately for non-conformance to the hash function +result) but can't figure out how to not read the request body twice, i.e. I +read it in the onrequest hook but later on need to read it again in the +route handler, but I can't (from the manual, for cowboy_req:body: "This +function can only be called once. Cowboy will not cache the result of this +call."). At the moment, and because the API consumers were in a hurry, the +solution I found (I understand it might be an ugly hack), was to read the +body, store it in the Req's meta (property body, for example) and then +access that property later on, instead of using cowboy_req:body. I'm not +quite happy with this solution and was wondering if there is anything more +elegant that I can implement. + +Thanks. + +Cheers. + +- Paulo F. Oliveira +-------------- next part -------------- +An HTML attachment was scrubbed... +URL: <<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20140915/26d4e023/attachment-0001.html">http://lists.ninenines.eu/archives/extend/attachments/20140915/26d4e023/attachment-0001.html</A>> +</PRE> + + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + + <LI>Next message: <A HREF="000462.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#458">[ date ]</a> + <a href="thread.html#458">[ thread ]</a> + <a href="subject.html#458">[ subject ]</a> + <a href="author.html#458">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/000459.html b/_build/static/archives/extend/2014-September/000459.html new file mode 100644 index 00000000..c360f518 --- /dev/null +++ b/_build/static/archives/extend/2014-September/000459.html @@ -0,0 +1,81 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] :binding doc + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20%3Abinding%20doc&In-Reply-To=%3CCA%2BdV7cTDYsbcVjwO3wxNpzpo0V3gcO%2BXoY44Yjbc6K1OB8zuVw%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000464.html"> + <LINK REL="Next" HREF="000460.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] :binding doc</H1> + <B>Paulo F. Oliveira</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20%3Abinding%20doc&In-Reply-To=%3CCA%2BdV7cTDYsbcVjwO3wxNpzpo0V3gcO%2BXoY44Yjbc6K1OB8zuVw%40mail.gmail.com%3E" + TITLE="[99s-extend] :binding doc">paulo.ferraz.oliveira at gmail.com + </A><BR> + <I>Mon Sep 15 23:34:48 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000464.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI>Next message: <A HREF="000460.html">[99s-extend] :binding doc +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#459">[ date ]</a> + <a href="thread.html#459">[ thread ]</a> + <a href="subject.html#459">[ subject ]</a> + <a href="author.html#459">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>Hi. + +This can be read in the cowboy_req:binding doc: "By default the value is a +binary, however constraints may change the type of this value (for example +automatically converting numbers to integer)." + +What constraints are we talking about here? + +Also, there's no reference to the fact that the bindings are URL-decoded, +even though they appear to be. + +Cheers. + +- Paulo F. Oliveira +-------------- next part -------------- +An HTML attachment was scrubbed... +URL: <<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20140915/5f3302e4/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20140915/5f3302e4/attachment.html</A>> +</PRE> + + + + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000464.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI>Next message: <A HREF="000460.html">[99s-extend] :binding doc +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#459">[ date ]</a> + <a href="thread.html#459">[ thread ]</a> + <a href="subject.html#459">[ subject ]</a> + <a href="author.html#459">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/000460.html b/_build/static/archives/extend/2014-September/000460.html new file mode 100644 index 00000000..a544862a --- /dev/null +++ b/_build/static/archives/extend/2014-September/000460.html @@ -0,0 +1,75 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] :binding doc + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20%3Abinding%20doc&In-Reply-To=%3CCA%2BdV7cQkY9k0RSaR%2B_ja1MQae%3Df-Yb2Wp7aFGok3ORA%3DjSE%2BaA%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000459.html"> + <LINK REL="Next" HREF="000461.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] :binding doc</H1> + <B>Paulo F. Oliveira</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20%3Abinding%20doc&In-Reply-To=%3CCA%2BdV7cQkY9k0RSaR%2B_ja1MQae%3Df-Yb2Wp7aFGok3ORA%3DjSE%2BaA%40mail.gmail.com%3E" + TITLE="[99s-extend] :binding doc">paulo.ferraz.oliveira at gmail.com + </A><BR> + <I>Mon Sep 15 23:55:39 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000459.html">[99s-extend] :binding doc +</A></li> + <LI>Next message: <A HREF="000461.html">[99s-extend] :binding doc +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#460">[ date ]</a> + <a href="thread.html#460">[ thread ]</a> + <a href="subject.html#460">[ subject ]</a> + <a href="author.html#460">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>OK, I guess "constraints" refers to this: +<A HREF="http://ninenines.eu/docs/en/cowboy/HEAD/guide/routing/#constraints">http://ninenines.eu/docs/en/cowboy/HEAD/guide/routing/#constraints</A> + +:<i>D +</I> +Cheers. + +- Paulo F. Oliveira +-------------- next part -------------- +An HTML attachment was scrubbed... +URL: <<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20140915/d97a6072/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20140915/d97a6072/attachment.html</A>> +</PRE> + + + + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000459.html">[99s-extend] :binding doc +</A></li> + <LI>Next message: <A HREF="000461.html">[99s-extend] :binding doc +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#460">[ date ]</a> + <a href="thread.html#460">[ thread ]</a> + <a href="subject.html#460">[ subject ]</a> + <a href="author.html#460">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/000461.html b/_build/static/archives/extend/2014-September/000461.html new file mode 100644 index 00000000..68f764da --- /dev/null +++ b/_build/static/archives/extend/2014-September/000461.html @@ -0,0 +1,74 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] :binding doc + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20%3Abinding%20doc&In-Reply-To=%3C54176510.9040100%40ninenines.eu%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000460.html"> + <LINK REL="Next" HREF="000465.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] :binding doc</H1> + <B>Loïc Hoguin</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20%3Abinding%20doc&In-Reply-To=%3C54176510.9040100%40ninenines.eu%3E" + TITLE="[99s-extend] :binding doc">essen at ninenines.eu + </A><BR> + <I>Tue Sep 16 00:15:44 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000460.html">[99s-extend] :binding doc +</A></li> + <LI>Next message: <A HREF="000465.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#461">[ date ]</a> + <a href="thread.html#461">[ thread ]</a> + <a href="subject.html#461">[ subject ]</a> + <a href="author.html#461">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>On 09/15/2014 11:34 PM, Paulo F. Oliveira wrote: +><i> Also, there's no reference to the fact that the bindings are +</I>><i> URL-decoded, even though they appear to be. +</I> +Cowboy decodes everything. If you feel it's helpful to mention, please +send a patch. + +-- +Loïc Hoguin +<A HREF="http://ninenines.eu">http://ninenines.eu</A> +</PRE> + + + + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000460.html">[99s-extend] :binding doc +</A></li> + <LI>Next message: <A HREF="000465.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#461">[ date ]</a> + <a href="thread.html#461">[ thread ]</a> + <a href="subject.html#461">[ subject ]</a> + <a href="author.html#461">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/000462.html b/_build/static/archives/extend/2014-September/000462.html new file mode 100644 index 00000000..f8727d7c --- /dev/null +++ b/_build/static/archives/extend/2014-September/000462.html @@ -0,0 +1,101 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] Using cowboy_req:body more than once per request + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Using%20cowboy_req%3Abody%20more%20than%20once%20per%20request&In-Reply-To=%3C541766A3.4070309%40ninenines.eu%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000458.html"> + <LINK REL="Next" HREF="000463.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] Using cowboy_req:body more than once per request</H1> + <B>Loïc Hoguin</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Using%20cowboy_req%3Abody%20more%20than%20once%20per%20request&In-Reply-To=%3C541766A3.4070309%40ninenines.eu%3E" + TITLE="[99s-extend] Using cowboy_req:body more than once per request">essen at ninenines.eu + </A><BR> + <I>Tue Sep 16 00:22:27 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000458.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI>Next message: <A HREF="000463.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#462">[ date ]</a> + <a href="thread.html#462">[ thread ]</a> + <a href="subject.html#462">[ subject ]</a> + <a href="author.html#462">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>It seems a bit weird to me to read the body and validate it before +validating the request itself. + +I would explicitly put these checks in the handler directly. This of +course means that there is no need to read it twice anymore. + +On 09/15/2014 11:24 PM, Paulo F. Oliveira wrote: +><i> Hi. +</I>><i> +</I>><i> I recently implemented a checksum header (X-Checksum) that allows +</I>><i> validating the content of a request's body by hash comparison (just to +</I>><i> give you some context). I'm using the onrequest hook to affect all +</I>><i> requests (and be able to reply appropriately for non-conformance to the +</I>><i> hash function result) but can't figure out how to not read the request +</I>><i> body twice, i.e. I read it in the onrequest hook but later on need to +</I>><i> read it again in the route handler, but I can't (from the manual, for +</I>><i> cowboy_req:body: "This function can only be called once. Cowboy will not +</I>><i> cache the result of this call."). At the moment, and because the API +</I>><i> consumers were in a hurry, the solution I found (I understand it might +</I>><i> be an ugly hack), was to read the body, store it in the Req's meta +</I>><i> (property body, for example) and then access that property later on, +</I>><i> instead of using cowboy_req:body. I'm not quite happy with this solution +</I>><i> and was wondering if there is anything more elegant that I can implement. +</I>><i> +</I>><i> Thanks. +</I>><i> +</I>><i> Cheers. +</I>><i> +</I>><i> - Paulo F. Oliveira +</I>><i> +</I>><i> +</I>><i> _______________________________________________ +</I>><i> Extend mailing list +</I>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A> +</I>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A> +</I>><i> +</I> +-- +Loïc Hoguin +<A HREF="http://ninenines.eu">http://ninenines.eu</A> +</PRE> + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000458.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI>Next message: <A HREF="000463.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#462">[ date ]</a> + <a href="thread.html#462">[ thread ]</a> + <a href="subject.html#462">[ subject ]</a> + <a href="author.html#462">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/000463.html b/_build/static/archives/extend/2014-September/000463.html new file mode 100644 index 00000000..1e618983 --- /dev/null +++ b/_build/static/archives/extend/2014-September/000463.html @@ -0,0 +1,82 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] Using cowboy_req:body more than once per request + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Using%20cowboy_req%3Abody%20more%20than%20once%20per%20request&In-Reply-To=%3CCA%2BdV7cSQc%3D3wsQrYkg2p6R9M7n_HmZpF6kOt%3D4CbaphUUx4oGQ%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000462.html"> + <LINK REL="Next" HREF="000464.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] Using cowboy_req:body more than once per request</H1> + <B>Paulo F. Oliveira</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Using%20cowboy_req%3Abody%20more%20than%20once%20per%20request&In-Reply-To=%3CCA%2BdV7cSQc%3D3wsQrYkg2p6R9M7n_HmZpF6kOt%3D4CbaphUUx4oGQ%40mail.gmail.com%3E" + TITLE="[99s-extend] Using cowboy_req:body more than once per request">paulo.ferraz.oliveira at gmail.com + </A><BR> + <I>Tue Sep 16 00:35:20 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000462.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI>Next message: <A HREF="000464.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#463">[ date ]</a> + <a href="thread.html#463">[ thread ]</a> + <a href="subject.html#463">[ subject ]</a> + <a href="author.html#463">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>Hi. + +><i> It seems a bit weird to me to read the body and validate it before validating the request itself. +</I> +It certainly seems like it, but I had no immediate solution and +instead of changing a dozen handlers, this seemed faster to implement +:<i>D. I don't understand what you mean by "validating the request +</I>itself". I read the header (I mentioned previously) and the body and +check one against the other. They are present and enough for the +_validator_ to make a decision, but I might be missing something here. + +><i> I would explicitly put these checks in the handler directly. This of course means that there is no need to read it twice anymore. +</I> +I've been trying to find a way to easily share code between handlers +without having to rewrite a lot of code (even if I do decide to put +things in a library function - or several). I recently came across +<A HREF="https://github.com/opscode/mixer.">https://github.com/opscode/mixer.</A> Have you ever used it? + +Thanks. + +- Paulo F. Oliveira +</PRE> + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000462.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI>Next message: <A HREF="000464.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#463">[ date ]</a> + <a href="thread.html#463">[ thread ]</a> + <a href="subject.html#463">[ subject ]</a> + <a href="author.html#463">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/000464.html b/_build/static/archives/extend/2014-September/000464.html new file mode 100644 index 00000000..2df89a6e --- /dev/null +++ b/_build/static/archives/extend/2014-September/000464.html @@ -0,0 +1,89 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] Using cowboy_req:body more than once per request + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Using%20cowboy_req%3Abody%20more%20than%20once%20per%20request&In-Reply-To=%3C54176B4C.1060101%40ninenines.eu%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000463.html"> + <LINK REL="Next" HREF="000459.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] Using cowboy_req:body more than once per request</H1> + <B>Loïc Hoguin</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Using%20cowboy_req%3Abody%20more%20than%20once%20per%20request&In-Reply-To=%3C54176B4C.1060101%40ninenines.eu%3E" + TITLE="[99s-extend] Using cowboy_req:body more than once per request">essen at ninenines.eu + </A><BR> + <I>Tue Sep 16 00:42:20 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000463.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI>Next message: <A HREF="000459.html">[99s-extend] :binding doc +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#464">[ date ]</a> + <a href="thread.html#464">[ thread ]</a> + <a href="subject.html#464">[ subject ]</a> + <a href="author.html#464">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>On 09/16/2014 12:35 AM, Paulo F. Oliveira wrote: +><i> Hi. +</I>><i> +</I>>><i> It seems a bit weird to me to read the body and validate it before validating the request itself. +</I>><i> +</I>><i> It certainly seems like it, but I had no immediate solution and +</I>><i> instead of changing a dozen handlers, this seemed faster to implement +</I>><i> :D. I don't understand what you mean by "validating the request +</I>><i> itself". I read the header (I mentioned previously) and the body and +</I>><i> check one against the other. They are present and enough for the +</I>><i> _validator_ to make a decision, but I might be missing something here. +</I> +Like, is it the right method? Are the bindings/qs parameters/headers +present and valid? And so on. The body should be the last thing you +check, due to how expensive it can be, not the first. + +>><i> I would explicitly put these checks in the handler directly. This of course means that there is no need to read it twice anymore. +</I>><i> +</I>><i> I've been trying to find a way to easily share code between handlers +</I>><i> without having to rewrite a lot of code (even if I do decide to put +</I>><i> things in a library function - or several). I recently came across +</I>><i> <A HREF="https://github.com/opscode/mixer.">https://github.com/opscode/mixer.</A> Have you ever used it? +</I> +I usually share code by writing functions. Then I call these functions +where needed. + +-- +Loïc Hoguin +<A HREF="http://ninenines.eu">http://ninenines.eu</A> +</PRE> + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000463.html">[99s-extend] Using cowboy_req:body more than once per request +</A></li> + <LI>Next message: <A HREF="000459.html">[99s-extend] :binding doc +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#464">[ date ]</a> + <a href="thread.html#464">[ thread ]</a> + <a href="subject.html#464">[ subject ]</a> + <a href="author.html#464">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/000465.html b/_build/static/archives/extend/2014-September/000465.html new file mode 100644 index 00000000..66ac7abc --- /dev/null +++ b/_build/static/archives/extend/2014-September/000465.html @@ -0,0 +1,137 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] Newbie, Cowboy + Websocket + Audio Recording + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Newbie%2C%20Cowboy%20%2B%20Websocket%20%2B%20Audio%20Recording&In-Reply-To=%3CCA%2Bycm%3D6T4gu%3D48%3DVfP3aiVdJFAg--s%2BxGaT2RtGm1KU8qyLiTw%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000461.html"> + <LINK REL="Next" HREF="000466.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] Newbie, Cowboy + Websocket + Audio Recording</H1> + <B>Juan Matías</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Newbie%2C%20Cowboy%20%2B%20Websocket%20%2B%20Audio%20Recording&In-Reply-To=%3CCA%2Bycm%3D6T4gu%3D48%3DVfP3aiVdJFAg--s%2BxGaT2RtGm1KU8qyLiTw%40mail.gmail.com%3E" + TITLE="[99s-extend] Newbie, Cowboy + Websocket + Audio Recording">jmrepetti at gmail.com + </A><BR> + <I>Mon Sep 29 18:52:16 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000461.html">[99s-extend] :binding doc +</A></li> + <LI>Next message: <A HREF="000466.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#465">[ date ]</a> + <a href="thread.html#465">[ thread ]</a> + <a href="subject.html#465">[ subject ]</a> + <a href="author.html#465">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>Hello list, I hope this is the right place to ask this. + +I'm learning Erlang, and I wanted to create a Cowboy app to record audio +from a web browser. + +Based on the websocket example in the Cowboy source code, I get the user +mic input and send this input to the websocket. + +I created a "recorder" module, which functionality is to save the data to +the a file. + + +*#rawe_handler.erl*-module(rawec_handler). +-behaviour(cowboy_websocket_handler). +...... +init(_, _, _) -> + case whereis(recorder) of + undefined -> + RecorderPid = recorder:start(), + register(recorder, RecorderPid); + _ -> ok + end, + {upgrade, protocol, cowboy_websocket}. +..... +websocket_handle(_Frame, Req, State) -> + RecorderPid = whereis(recorder), + RecorderPid ! {rec, _Frame/binary}, + {ok, Req, State}. + +*#recorder.erl* +-module(recorder). + +-export([start/0, recorder_fun/1]). +-compile([debug_info]). + +recorder_fun(IoDevice) -> + receive + {rec, Data} -> + ok = file:write(IoDevice, Data), + io:format(Data), + recorder_fun(IoDevice); + {stop, _} -> + %%Close file + file:close(IoDevice) + end. + +start() -> + {ok, IoDevice} = file:open("/tmp/test_binary.wav", [write, +binary]), + spawn(recorder, recorder_fun, [IoDevice]). + + +When I start the console, and allow the microphone on the browser, I see +this error on the console: + +=ERROR REPORT==== 29-Sep-2014::18:13:03 === +Ranch listener http had connection process started with +cowboy_protocol:start_link/4 at <0.178.0> exit with reason: +*{[{reason,badarith},{mfa,{rawec_handler,websocket_handle,3*}},{stacktrace,[{rawec_handler,websocket_handle,3,[{file,"src/rawec_handler.erl"},{line,35}]},{cowboy_websocket,handler_call,7,[{file,"src/cowboy_websocket.erl"},{line,588}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,435}]}]},{msg,{binary,<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0....(ETC, +DATA STREAM CONTINUES) + +Probably my approach to do this is totally wrong. I there any obvious +problem here? +Can someone point me to a right direction?. Maybe I should write directly +to a file in the *websocket_handle *funcion, but how can I keep a file +opened during the streaming? + +The github repo is here: <A HREF="https://github.com/jmrepetti/rawec">https://github.com/jmrepetti/rawec</A> with the whole +source code if you want to take a look. + + +Thanks in advance, +Matias. +-------------- next part -------------- +An HTML attachment was scrubbed... +URL: <<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20140929/84fe21a4/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20140929/84fe21a4/attachment.html</A>> +</PRE> + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000461.html">[99s-extend] :binding doc +</A></li> + <LI>Next message: <A HREF="000466.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#465">[ date ]</a> + <a href="thread.html#465">[ thread ]</a> + <a href="subject.html#465">[ subject ]</a> + <a href="author.html#465">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/000466.html b/_build/static/archives/extend/2014-September/000466.html new file mode 100644 index 00000000..94dd1886 --- /dev/null +++ b/_build/static/archives/extend/2014-September/000466.html @@ -0,0 +1,161 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] Newbie, Cowboy + Websocket + Audio Recording + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Newbie%2C%20Cowboy%20%2B%20Websocket%20%2B%20Audio%20Recording&In-Reply-To=%3CCAKAMJXghRnTZ1CTPkTBapOgh7BnFLUnvL%2B%2BVVedyXuAzWT6HSQ%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000465.html"> + <LINK REL="Next" HREF="000467.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] Newbie, Cowboy + Websocket + Audio Recording</H1> + <B>Eduardo Gurgel</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Newbie%2C%20Cowboy%20%2B%20Websocket%20%2B%20Audio%20Recording&In-Reply-To=%3CCAKAMJXghRnTZ1CTPkTBapOgh7BnFLUnvL%2B%2BVVedyXuAzWT6HSQ%40mail.gmail.com%3E" + TITLE="[99s-extend] Newbie, Cowboy + Websocket + Audio Recording">edgurgel at gmail.com + </A><BR> + <I>Tue Sep 30 00:53:26 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000465.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + <LI>Next message: <A HREF="000467.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#466">[ date ]</a> + <a href="thread.html#466">[ thread ]</a> + <a href="subject.html#466">[ subject ]</a> + <a href="author.html#466">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>Looking on the output it says: + +*{reason,badarith} *on this line: + +RecorderPid ! {rec, _Frame/binary}, + +This may help you somehow. + +BTW, variables starting with _ are usually used to show unused variables +and stop warnings from the compiler. + +On 30 September 2014 05:52, Juan Matías <<A HREF="https://lists.ninenines.eu/listinfo/extend">jmrepetti at gmail.com</A>> wrote: + +><i> Hello list, I hope this is the right place to ask this. +</I>><i> +</I>><i> I'm learning Erlang, and I wanted to create a Cowboy app to record audio +</I>><i> from a web browser. +</I>><i> +</I>><i> Based on the websocket example in the Cowboy source code, I get the user +</I>><i> mic input and send this input to the websocket. +</I>><i> +</I>><i> I created a "recorder" module, which functionality is to save the data to +</I>><i> the a file. +</I>><i> +</I>><i> +</I>><i> *#rawe_handler.erl*-module(rawec_handler). +</I>><i> -behaviour(cowboy_websocket_handler). +</I>><i> ...... +</I>><i> init(_, _, _) -> +</I>><i> case whereis(recorder) of +</I>><i> undefined -> +</I>><i> RecorderPid = recorder:start(), +</I>><i> register(recorder, RecorderPid); +</I>><i> _ -> ok +</I>><i> end, +</I>><i> {upgrade, protocol, cowboy_websocket}. +</I>><i> ..... +</I>><i> websocket_handle(_Frame, Req, State) -> +</I>><i> RecorderPid = whereis(recorder), +</I>><i> RecorderPid ! {rec, _Frame/binary}, +</I>><i> {ok, Req, State}. +</I>><i> +</I>><i> *#recorder.erl* +</I>><i> -module(recorder). +</I>><i> +</I>><i> -export([start/0, recorder_fun/1]). +</I>><i> -compile([debug_info]). +</I>><i> +</I>><i> recorder_fun(IoDevice) -> +</I>><i> receive +</I>><i> {rec, Data} -> +</I>><i> ok = file:write(IoDevice, Data), +</I>><i> io:format(Data), +</I>><i> recorder_fun(IoDevice); +</I>><i> {stop, _} -> +</I>><i> %%Close file +</I>><i> file:close(IoDevice) +</I>><i> end. +</I>><i> +</I>><i> start() -> +</I>><i> {ok, IoDevice} = file:open("/tmp/test_binary.wav", [write, +</I>><i> binary]), +</I>><i> spawn(recorder, recorder_fun, [IoDevice]). +</I>><i> +</I>><i> +</I>><i> When I start the console, and allow the microphone on the browser, I see +</I>><i> this error on the console: +</I>><i> +</I>><i> =ERROR REPORT==== 29-Sep-2014::18:13:03 === +</I>><i> Ranch listener http had connection process started with +</I>><i> cowboy_protocol:start_link/4 at <0.178.0> exit with reason: +</I>><i> *{[{reason,badarith},{mfa,{rawec_handler,websocket_handle,3*}},{stacktrace,[{rawec_handler,websocket_handle,3,[{file,"src/rawec_handler.erl"},{line,35}]},{cowboy_websocket,handler_call,7,[{file,"src/cowboy_websocket.erl"},{line,588}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,435}]}]},{msg,{binary,<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0....(ETC, +</I>><i> DATA STREAM CONTINUES) +</I>><i> +</I>><i> Probably my approach to do this is totally wrong. I there any obvious +</I>><i> problem here? +</I>><i> Can someone point me to a right direction?. Maybe I should write directly +</I>><i> to a file in the *websocket_handle *funcion, but how can I keep a file +</I>><i> opened during the streaming? +</I>><i> +</I>><i> The github repo is here: <A HREF="https://github.com/jmrepetti/rawec">https://github.com/jmrepetti/rawec</A> with the +</I>><i> whole source code if you want to take a look. +</I>><i> +</I>><i> +</I>><i> Thanks in advance, +</I>><i> Matias. +</I>><i> +</I>><i> _______________________________________________ +</I>><i> Extend mailing list +</I>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A> +</I>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A> +</I>><i> +</I>><i> +</I> + +-- +Eduardo +-------------- next part -------------- +An HTML attachment was scrubbed... +URL: <<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20140930/6d952ce6/attachment-0001.html">http://lists.ninenines.eu/archives/extend/attachments/20140930/6d952ce6/attachment-0001.html</A>> +</PRE> + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000465.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + <LI>Next message: <A HREF="000467.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#466">[ date ]</a> + <a href="thread.html#466">[ thread ]</a> + <a href="subject.html#466">[ subject ]</a> + <a href="author.html#466">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/000467.html b/_build/static/archives/extend/2014-September/000467.html new file mode 100644 index 00000000..722b40d2 --- /dev/null +++ b/_build/static/archives/extend/2014-September/000467.html @@ -0,0 +1,170 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] Newbie, Cowboy + Websocket + Audio Recording + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Newbie%2C%20Cowboy%20%2B%20Websocket%20%2B%20Audio%20Recording&In-Reply-To=%3CCA%2Bycm%3D5YMMKFpZnfGrOBLu5Jn4WFAiX7BmwbKBti2YsVmJ5JjQ%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000466.html"> + + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] Newbie, Cowboy + Websocket + Audio Recording</H1> + <B>Juan Matías</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Newbie%2C%20Cowboy%20%2B%20Websocket%20%2B%20Audio%20Recording&In-Reply-To=%3CCA%2Bycm%3D5YMMKFpZnfGrOBLu5Jn4WFAiX7BmwbKBti2YsVmJ5JjQ%40mail.gmail.com%3E" + TITLE="[99s-extend] Newbie, Cowboy + Websocket + Audio Recording">jmrepetti at gmail.com + </A><BR> + <I>Tue Sep 30 12:38:15 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000466.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + + <LI> <B>Messages sorted by:</B> + <a href="date.html#467">[ date ]</a> + <a href="thread.html#467">[ thread ]</a> + <a href="subject.html#467">[ subject ]</a> + <a href="author.html#467">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>Thanks, that fixed the error. Now I'm having other but I'll investigate. + + + +On Tue, Sep 30, 2014 at 12:53 AM, Eduardo Gurgel <<A HREF="https://lists.ninenines.eu/listinfo/extend">edgurgel at gmail.com</A>> wrote: + +><i> Looking on the output it says: +</I>><i> +</I>><i> *{reason,badarith} *on this line: +</I>><i> +</I>><i> RecorderPid ! {rec, _Frame/binary}, +</I>><i> +</I>><i> This may help you somehow. +</I>><i> +</I>><i> BTW, variables starting with _ are usually used to show unused variables +</I>><i> and stop warnings from the compiler. +</I>><i> +</I>><i> On 30 September 2014 05:52, Juan Matías <<A HREF="https://lists.ninenines.eu/listinfo/extend">jmrepetti at gmail.com</A>> wrote: +</I>><i> +</I>>><i> Hello list, I hope this is the right place to ask this. +</I>>><i> +</I>>><i> I'm learning Erlang, and I wanted to create a Cowboy app to record audio +</I>>><i> from a web browser. +</I>>><i> +</I>>><i> Based on the websocket example in the Cowboy source code, I get the user +</I>>><i> mic input and send this input to the websocket. +</I>>><i> +</I>>><i> I created a "recorder" module, which functionality is to save the data to +</I>>><i> the a file. +</I>>><i> +</I>>><i> +</I>>><i> *#rawe_handler.erl*-module(rawec_handler). +</I>>><i> -behaviour(cowboy_websocket_handler). +</I>>><i> ...... +</I>>><i> init(_, _, _) -> +</I>>><i> case whereis(recorder) of +</I>>><i> undefined -> +</I>>><i> RecorderPid = recorder:start(), +</I>>><i> register(recorder, RecorderPid); +</I>>><i> _ -> ok +</I>>><i> end, +</I>>><i> {upgrade, protocol, cowboy_websocket}. +</I>>><i> ..... +</I>>><i> websocket_handle(_Frame, Req, State) -> +</I>>><i> RecorderPid = whereis(recorder), +</I>>><i> RecorderPid ! {rec, _Frame/binary}, +</I>>><i> {ok, Req, State}. +</I>>><i> +</I>>><i> *#recorder.erl* +</I>>><i> -module(recorder). +</I>>><i> +</I>>><i> -export([start/0, recorder_fun/1]). +</I>>><i> -compile([debug_info]). +</I>>><i> +</I>>><i> recorder_fun(IoDevice) -> +</I>>><i> receive +</I>>><i> {rec, Data} -> +</I>>><i> ok = file:write(IoDevice, Data), +</I>>><i> io:format(Data), +</I>>><i> recorder_fun(IoDevice); +</I>>><i> {stop, _} -> +</I>>><i> %%Close file +</I>>><i> file:close(IoDevice) +</I>>><i> end. +</I>>><i> +</I>>><i> start() -> +</I>>><i> {ok, IoDevice} = file:open("/tmp/test_binary.wav", [write, +</I>>><i> binary]), +</I>>><i> spawn(recorder, recorder_fun, [IoDevice]). +</I>>><i> +</I>>><i> +</I>>><i> When I start the console, and allow the microphone on the browser, I see +</I>>><i> this error on the console: +</I>>><i> +</I>>><i> =ERROR REPORT==== 29-Sep-2014::18:13:03 === +</I>>><i> Ranch listener http had connection process started with +</I>>><i> cowboy_protocol:start_link/4 at <0.178.0> exit with reason: +</I>>><i> *{[{reason,badarith},{mfa,{rawec_handler,websocket_handle,3*}},{stacktrace,[{rawec_handler,websocket_handle,3,[{file,"src/rawec_handler.erl"},{line,35}]},{cowboy_websocket,handler_call,7,[{file,"src/cowboy_websocket.erl"},{line,588}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,435}]}]},{msg,{binary,<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0....(ETC, +</I>>><i> DATA STREAM CONTINUES) +</I>>><i> +</I>>><i> Probably my approach to do this is totally wrong. I there any obvious +</I>>><i> problem here? +</I>>><i> Can someone point me to a right direction?. Maybe I should write directly +</I>>><i> to a file in the *websocket_handle *funcion, but how can I keep a file +</I>>><i> opened during the streaming? +</I>>><i> +</I>>><i> The github repo is here: <A HREF="https://github.com/jmrepetti/rawec">https://github.com/jmrepetti/rawec</A> with the +</I>>><i> whole source code if you want to take a look. +</I>>><i> +</I>>><i> +</I>>><i> Thanks in advance, +</I>>><i> Matias. +</I>>><i> +</I>>><i> _______________________________________________ +</I>>><i> Extend mailing list +</I>>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A> +</I>>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A> +</I>>><i> +</I>>><i> +</I>><i> +</I>><i> +</I>><i> -- +</I>><i> Eduardo +</I>><i> +</I> + + +-- +Matías +-------------- next part -------------- +An HTML attachment was scrubbed... +URL: <<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20140930/ef46837f/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20140930/ef46837f/attachment.html</A>> +</PRE> + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000466.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A></li> + + <LI> <B>Messages sorted by:</B> + <a href="date.html#467">[ date ]</a> + <a href="thread.html#467">[ thread ]</a> + <a href="subject.html#467">[ subject ]</a> + <a href="author.html#467">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> diff --git a/_build/static/archives/extend/2014-September/author.html b/_build/static/archives/extend/2014-September/author.html new file mode 100644 index 00000000..a559a789 --- /dev/null +++ b/_build/static/archives/extend/2014-September/author.html @@ -0,0 +1,97 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <title>The Extend September 2014 Archive by author</title> + <META NAME="robots" CONTENT="noindex,follow"> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <a name="start"></A> + <h1>September 2014 Archives by author</h1> + <ul> + <li> <b>Messages sorted by:</b> + <a href="thread.html#start">[ thread ]</a> + <a href="subject.html#start">[ subject ]</a> + + <a href="date.html#start">[ date ]</a> + + <li><b><a href="https://lists.ninenines.eu/listinfo/extend">More info on this list... + </a></b></li> + </ul> + <p><b>Starting:</b> <i>Mon Sep 15 23:24:20 CEST 2014</i><br> + <b>Ending:</b> <i>Tue Sep 30 12:38:15 CEST 2014</i><br> + <b>Messages:</b> 10<p> + <ul> + +<LI><A HREF="000466.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="466"> </A> +<I>Eduardo Gurgel +</I> + +<LI><A HREF="000461.html">[99s-extend] :binding doc +</A><A NAME="461"> </A> +<I>Loïc Hoguin +</I> + +<LI><A HREF="000462.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="462"> </A> +<I>Loïc Hoguin +</I> + +<LI><A HREF="000464.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="464"> </A> +<I>Loïc Hoguin +</I> + +<LI><A HREF="000465.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="465"> </A> +<I>Juan Matías +</I> + +<LI><A HREF="000467.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="467"> </A> +<I>Juan Matías +</I> + +<LI><A HREF="000458.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="458"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000459.html">[99s-extend] :binding doc +</A><A NAME="459"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000460.html">[99s-extend] :binding doc +</A><A NAME="460"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000463.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="463"> </A> +<I>Paulo F. Oliveira +</I> + + </ul> + <p> + <a name="end"><b>Last message date:</b></a> + <i>Tue Sep 30 12:38:15 CEST 2014</i><br> + <b>Archived on:</b> <i>Tue Sep 30 12:45:20 CEST 2014</i> + <p> + <ul> + <li> <b>Messages sorted by:</b> + <a href="thread.html#start">[ thread ]</a> + <a href="subject.html#start">[ subject ]</a> + + <a href="date.html#start">[ date ]</a> + <li><b><a href="https://lists.ninenines.eu/listinfo/extend">More info on this list... + </a></b></li> + </ul> + <p> + <hr> + <i>This archive was generated by + Pipermail 0.09 (Mailman edition).</i> + </BODY> +</HTML> + diff --git a/_build/static/archives/extend/2014-September/date.html b/_build/static/archives/extend/2014-September/date.html new file mode 100644 index 00000000..85c9135a --- /dev/null +++ b/_build/static/archives/extend/2014-September/date.html @@ -0,0 +1,97 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <title>The Extend September 2014 Archive by date</title> + <META NAME="robots" CONTENT="noindex,follow"> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <a name="start"></A> + <h1>September 2014 Archives by date</h1> + <ul> + <li> <b>Messages sorted by:</b> + <a href="thread.html#start">[ thread ]</a> + <a href="subject.html#start">[ subject ]</a> + <a href="author.html#start">[ author ]</a> + + + <li><b><a href="https://lists.ninenines.eu/listinfo/extend">More info on this list... + </a></b></li> + </ul> + <p><b>Starting:</b> <i>Mon Sep 15 23:24:20 CEST 2014</i><br> + <b>Ending:</b> <i>Tue Sep 30 12:38:15 CEST 2014</i><br> + <b>Messages:</b> 10<p> + <ul> + +<LI><A HREF="000458.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="458"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000459.html">[99s-extend] :binding doc +</A><A NAME="459"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000460.html">[99s-extend] :binding doc +</A><A NAME="460"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000461.html">[99s-extend] :binding doc +</A><A NAME="461"> </A> +<I>Loïc Hoguin +</I> + +<LI><A HREF="000462.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="462"> </A> +<I>Loïc Hoguin +</I> + +<LI><A HREF="000463.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="463"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000464.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="464"> </A> +<I>Loïc Hoguin +</I> + +<LI><A HREF="000465.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="465"> </A> +<I>Juan Matías +</I> + +<LI><A HREF="000466.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="466"> </A> +<I>Eduardo Gurgel +</I> + +<LI><A HREF="000467.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="467"> </A> +<I>Juan Matías +</I> + + </ul> + <p> + <a name="end"><b>Last message date:</b></a> + <i>Tue Sep 30 12:38:15 CEST 2014</i><br> + <b>Archived on:</b> <i>Tue Sep 30 12:45:20 CEST 2014</i> + <p> + <ul> + <li> <b>Messages sorted by:</b> + <a href="thread.html#start">[ thread ]</a> + <a href="subject.html#start">[ subject ]</a> + <a href="author.html#start">[ author ]</a> + + <li><b><a href="https://lists.ninenines.eu/listinfo/extend">More info on this list... + </a></b></li> + </ul> + <p> + <hr> + <i>This archive was generated by + Pipermail 0.09 (Mailman edition).</i> + </BODY> +</HTML> + diff --git a/_build/static/archives/extend/2014-September/index.html b/_build/static/archives/extend/2014-September/index.html new file mode 120000 index 00000000..db4b46f7 --- /dev/null +++ b/_build/static/archives/extend/2014-September/index.html @@ -0,0 +1 @@ +thread.html
\ No newline at end of file diff --git a/_build/static/archives/extend/2014-September/subject.html b/_build/static/archives/extend/2014-September/subject.html new file mode 100644 index 00000000..47e15aa1 --- /dev/null +++ b/_build/static/archives/extend/2014-September/subject.html @@ -0,0 +1,97 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <title>The Extend September 2014 Archive by subject</title> + <META NAME="robots" CONTENT="noindex,follow"> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <a name="start"></A> + <h1>September 2014 Archives by subject</h1> + <ul> + <li> <b>Messages sorted by:</b> + <a href="thread.html#start">[ thread ]</a> + + <a href="author.html#start">[ author ]</a> + <a href="date.html#start">[ date ]</a> + + <li><b><a href="https://lists.ninenines.eu/listinfo/extend">More info on this list... + </a></b></li> + </ul> + <p><b>Starting:</b> <i>Mon Sep 15 23:24:20 CEST 2014</i><br> + <b>Ending:</b> <i>Tue Sep 30 12:38:15 CEST 2014</i><br> + <b>Messages:</b> 10<p> + <ul> + +<LI><A HREF="000459.html">[99s-extend] :binding doc +</A><A NAME="459"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000460.html">[99s-extend] :binding doc +</A><A NAME="460"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000461.html">[99s-extend] :binding doc +</A><A NAME="461"> </A> +<I>Loïc Hoguin +</I> + +<LI><A HREF="000465.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="465"> </A> +<I>Juan Matías +</I> + +<LI><A HREF="000466.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="466"> </A> +<I>Eduardo Gurgel +</I> + +<LI><A HREF="000467.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="467"> </A> +<I>Juan Matías +</I> + +<LI><A HREF="000458.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="458"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000462.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="462"> </A> +<I>Loïc Hoguin +</I> + +<LI><A HREF="000463.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="463"> </A> +<I>Paulo F. Oliveira +</I> + +<LI><A HREF="000464.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="464"> </A> +<I>Loïc Hoguin +</I> + + </ul> + <p> + <a name="end"><b>Last message date:</b></a> + <i>Tue Sep 30 12:38:15 CEST 2014</i><br> + <b>Archived on:</b> <i>Tue Sep 30 12:45:20 CEST 2014</i> + <p> + <ul> + <li> <b>Messages sorted by:</b> + <a href="thread.html#start">[ thread ]</a> + + <a href="author.html#start">[ author ]</a> + <a href="date.html#start">[ date ]</a> + <li><b><a href="https://lists.ninenines.eu/listinfo/extend">More info on this list... + </a></b></li> + </ul> + <p> + <hr> + <i>This archive was generated by + Pipermail 0.09 (Mailman edition).</i> + </BODY> +</HTML> + diff --git a/_build/static/archives/extend/2014-September/thread.html b/_build/static/archives/extend/2014-September/thread.html new file mode 100644 index 00000000..0c9a6ce2 --- /dev/null +++ b/_build/static/archives/extend/2014-September/thread.html @@ -0,0 +1,119 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <title>The Extend September 2014 Archive by thread</title> + <META NAME="robots" CONTENT="noindex,follow"> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <a name="start"></A> + <h1>September 2014 Archives by thread</h1> + <ul> + <li> <b>Messages sorted by:</b> + + <a href="subject.html#start">[ subject ]</a> + <a href="author.html#start">[ author ]</a> + <a href="date.html#start">[ date ]</a> + + <li><b><a href="https://lists.ninenines.eu/listinfo/extend">More info on this list... + </a></b></li> + </ul> + <p><b>Starting:</b> <i>Mon Sep 15 23:24:20 CEST 2014</i><br> + <b>Ending:</b> <i>Tue Sep 30 12:38:15 CEST 2014</i><br> + <b>Messages:</b> 10<p> + <ul> + +<!--0 01410816260.458- --> +<LI><A HREF="000458.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="458"> </A> +<I>Paulo F. Oliveira +</I> + +<UL> +<!--1 01410816260.458-01410819747.462- --> +<LI><A HREF="000462.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="462"> </A> +<I>Loïc Hoguin +</I> + +<UL> +<!--2 01410816260.458-01410819747.462-01410820520.463- --> +<LI><A HREF="000463.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="463"> </A> +<I>Paulo F. Oliveira +</I> + +<UL> +<!--3 01410816260.458-01410819747.462-01410820520.463-01410820940.464- --> +<LI><A HREF="000464.html">[99s-extend] Using cowboy_req:body more than once per request +</A><A NAME="464"> </A> +<I>Loïc Hoguin +</I> + +</UL> +</UL> +</UL> +<!--0 01410816888.459- --> +<LI><A HREF="000459.html">[99s-extend] :binding doc +</A><A NAME="459"> </A> +<I>Paulo F. Oliveira +</I> + +<UL> +<!--1 01410816888.459-01410818139.460- --> +<LI><A HREF="000460.html">[99s-extend] :binding doc +</A><A NAME="460"> </A> +<I>Paulo F. Oliveira +</I> + +<!--1 01410816888.459-01410819344.461- --> +<LI><A HREF="000461.html">[99s-extend] :binding doc +</A><A NAME="461"> </A> +<I>Loïc Hoguin +</I> + +</UL> +<!--0 01412009536.465- --> +<LI><A HREF="000465.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="465"> </A> +<I>Juan Matías +</I> + +<UL> +<!--1 01412009536.465-01412031206.466- --> +<LI><A HREF="000466.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="466"> </A> +<I>Eduardo Gurgel +</I> + +<UL> +<!--2 01412009536.465-01412031206.466-01412073495.467- --> +<LI><A HREF="000467.html">[99s-extend] Newbie, Cowboy + Websocket + Audio Recording +</A><A NAME="467"> </A> +<I>Juan Matías +</I> + +</UL> +</UL> + </ul> + <p> + <a name="end"><b>Last message date:</b></a> + <i>Tue Sep 30 12:38:15 CEST 2014</i><br> + <b>Archived on:</b> <i>Tue Sep 30 12:45:20 CEST 2014</i> + <p> + <ul> + <li> <b>Messages sorted by:</b> + + <a href="subject.html#start">[ subject ]</a> + <a href="author.html#start">[ author ]</a> + <a href="date.html#start">[ date ]</a> + <li><b><a href="https://lists.ninenines.eu/listinfo/extend">More info on this list... + </a></b></li> + </ul> + <p> + <hr> + <i>This archive was generated by + Pipermail 0.09 (Mailman edition).</i> + </BODY> +</HTML> + |