summaryrefslogblamecommitdiffstats
path: root/archives/extend/2015-February/000512.html
blob: f40595c21faf6df560d73efa0fb955260b3fc7b4 (plain) (tree)


























































































































                                                                                                                                                                                                                                                                                                                                                         
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
   <TITLE> [99s-extend] Body length and content-length mismatch
   </TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Body%20length%20and%20content-length%20mismatch&In-Reply-To=%3C54F0A54E.2010205%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="000511.html">
   <LINK REL="Next"  HREF="000513.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[99s-extend] Body length and content-length mismatch</H1>
    <B>Lo&#239;c Hoguin</B> 
    <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Body%20length%20and%20content-length%20mismatch&In-Reply-To=%3C54F0A54E.2010205%40ninenines.eu%3E"
       TITLE="[99s-extend] Body length and content-length mismatch">essen at ninenines.eu
       </A><BR>
    <I>Fri Feb 27 18:11:42 CET 2015</I>
    <P><UL>
        <LI>Previous message: <A HREF="000511.html">[99s-extend] Body length and content-length mismatch
</A></li>
        <LI>Next message: <A HREF="000513.html">[99s-extend] Body length and content-length mismatch
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#512">[ date ]</a>
              <a href="thread.html#512">[ thread ]</a>
              <a href="subject.html#512">[ subject ]</a>
              <a href="author.html#512">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>It looks like the client is telling you BS.

On 02/27/2015 06:07 PM, Samir Sow wrote:
&gt;<i> Hi,
</I>&gt;<i>
</I>&gt;<i> I&#8217;m facing an issue with the cowboy_req:body call.
</I>&gt;<i>
</I>&gt;<i> The header show a length of 2 while the body itself is a binary string which has a size greater than 2 for sure.
</I>&gt;<i> Trying to use cowboy_req:body with the length option does not make any difference.
</I>&gt;<i>
</I>&gt;<i> How can i retrieve the data ?
</I>&gt;<i> Any clue ?
</I>&gt;<i>
</I>&gt;<i> Thank you
</I>&gt;<i>
</I>&gt;<i> {ok,{&lt;&lt;&quot;basic&quot;&gt;&gt;,{&lt;&lt;&#171;<A HREF="https://lists.ninenines.eu/listinfo/extend">xxxxx at xxxxxx</A>&quot;&gt;&gt;,&lt;&lt;&#171;xxxxxxx&quot;&gt;&gt;}},
</I>&gt;<i>            {http_req,
</I>&gt;<i>                {sslsocket,
</I>&gt;<i>                    {gen_tcp,#Port&lt;0.13250&gt;,tls_connection,&lt;0.298.0&gt;},
</I>&gt;<i>                    &lt;0.407.0&gt;},
</I>&gt;<i>                ranch_ssl,keepalive,&lt;0.408.0&gt;,&lt;&lt;&quot;POST&quot;&gt;&gt;,'HTTP/1.1',
</I>&gt;<i>                {{xxxxxxxxx},16220},
</I>&gt;<i>                &lt;&lt;&#171;xxxx&quot;&gt;&gt;,undefined,xxxx,&lt;&lt;&#171;xxxxx&quot;&gt;&gt;,undefined,
</I>&gt;<i>                &lt;&lt;&gt;&gt;,undefined,
</I>&gt;<i>                [{res_1,&lt;&lt;&#171;xxxx&quot;&gt;&gt;}],
</I>&gt;<i>                [{&lt;&lt;&quot;content-type&quot;&gt;&gt;,&lt;&lt;&quot;application/json&quot;&gt;&gt;},
</I>&gt;<i>                 {&lt;&lt;&quot;content-length&quot;&gt;&gt;,&lt;&lt;&quot;2&quot;&gt;&gt;},
</I>&gt;<i>                 {&lt;&lt;&quot;te&quot;&gt;&gt;,&lt;&lt;&gt;&gt;},
</I>&gt;<i>                 {&lt;&lt;&quot;host&quot;&gt;&gt;,&lt;&lt;&#171;xxxxx&quot;&gt;&gt;},
</I>&gt;<i>                 {&lt;&lt;&quot;authorization&quot;&gt;&gt;,
</I>&gt;<i>                  &lt;&lt;&quot;Basic xxxxxxxxxxxxxx&quot;&gt;&gt;},
</I>&gt;<i>                 {&lt;&lt;&quot;connection&quot;&gt;&gt;,&lt;&lt;&quot;keep-alive&quot;&gt;&gt;}],
</I>&gt;<i>                [{&lt;&lt;&quot;authorization&quot;&gt;&gt;,
</I>&gt;<i>                  {&lt;&lt;&quot;basic&quot;&gt;&gt;,{&lt;&lt;&#171;xxxxxx&quot;&gt;&gt;,&lt;&lt;&#171;xxxxxx&quot;&gt;&gt;}}},
</I>&gt;<i>                 {&lt;&lt;&quot;connection&quot;&gt;&gt;,[&lt;&lt;&quot;keep-alive&quot;&gt;&gt;]}],
</I>&gt;<i>                undefined,[],waiting,
</I>&gt;<i>                &lt;&lt;&quot;{\&quot;login\&quot;:\&#187;<A HREF="https://lists.ninenines.eu/listinfo/extend">xxxx at xxxxxx</A>\&quot;,\&#187;xxxx\&quot;:\&#187;xxxx\&quot;}{\&quot;login\&quot;:\&#187;<A HREF="https://lists.ninenines.eu/listinfo/extend">xxxx at xxxx</A>\&quot;,\&#187;xxxx\&quot;:\&#187;xxxxx\&quot;}&quot;&gt;&gt;,
</I>
And looking at this (the buffer of already received data, presumably 
your whole body, it looks like you receive 2 things. Perhaps the client 
gives you the count of things instead of the length?

Either way if the client provides a wrong content-type you should reject 
the connection.

&gt;<i>                undefined,false,waiting,
</I>&gt;<i>                [{&lt;&lt;&quot;Access-Control-Allow-Credentials&quot;&gt;&gt;,&lt;&lt;&quot;true&quot;&gt;&gt;},
</I>&gt;<i>                 {&lt;&lt;&quot;Access-Control-Allow-Origin&quot;&gt;&gt;,
</I>&gt;<i>                  &lt;&lt;&quot;<A HREF="http://xxxxxxxxx">http://xxxxxxxxx</A>&quot;&gt;&gt;}],
</I>&gt;<i>                &lt;&lt;&gt;&gt;,undefined}}
</I>&gt;<i> Samir
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> _______________________________________________
</I>&gt;<i> Extend mailing list
</I>&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A>
</I>&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A>
</I>&gt;<i>
</I>
-- 
Lo&#239;c Hoguin
<A HREF="http://ninenines.eu">http://ninenines.eu</A>
</PRE>


<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000511.html">[99s-extend] Body length and content-length mismatch
</A></li>
	<LI>Next message: <A HREF="000513.html">[99s-extend] Body length and content-length mismatch
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#512">[ date ]</a>
              <a href="thread.html#512">[ thread ]</a>
              <a href="subject.html#512">[ subject ]</a>
              <a href="author.html#512">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>