summaryrefslogtreecommitdiffstats
path: root/archives/extend/2015-February/000513.html
blob: d8937c71ec4d5d7a15963d3bedcfdaa7d5b8aaab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!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=%3C62EAECE1-086A-4788-845A-11A1BC6C16AA%40wanadoo.fr%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="000512.html">
   
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[99s-extend] Body length and content-length mismatch</H1>
    <B>Samir Sow</B> 
    <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20Body%20length%20and%20content-length%20mismatch&In-Reply-To=%3C62EAECE1-086A-4788-845A-11A1BC6C16AA%40wanadoo.fr%3E"
       TITLE="[99s-extend] Body length and content-length mismatch">samset at wanadoo.fr
       </A><BR>
    <I>Fri Feb 27 18:33:56 CET 2015</I>
    <P><UL>
        <LI>Previous message: <A HREF="000512.html">[99s-extend] Body length and content-length mismatch
</A></li>
        
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#513">[ date ]</a>
              <a href="thread.html#513">[ thread ]</a>
              <a href="subject.html#513">[ subject ]</a>
              <a href="author.html#513">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Yes.
i&#8217;m using httpc. It does not like  wrapping a binary string inside a [].
I&#8217;ll fix my body.

Thank you.

Sincerely.



&gt;<i> On 27 f&#233;vr. 2015, at 18:11, Lo&#239;c Hoguin &lt;<A HREF="https://lists.ninenines.eu/listinfo/extend">essen at ninenines.eu</A>&gt; wrote:
</I>&gt;<i> 
</I>&gt;<i> It looks like the client is telling you BS.
</I>&gt;<i> 
</I>&gt;<i> On 02/27/2015 06:07 PM, Samir Sow wrote:
</I>&gt;&gt;<i> Hi,
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> I&#8217;m facing an issue with the cowboy_req:body call.
</I>&gt;&gt;<i> 
</I>&gt;&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;&gt;<i> Trying to use cowboy_req:body with the length option does not make any difference.
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> How can i retrieve the data ?
</I>&gt;&gt;<i> Any clue ?
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> Thank you
</I>&gt;&gt;<i> 
</I>&gt;&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;&gt;<i>           {http_req,
</I>&gt;&gt;<i>               {sslsocket,
</I>&gt;&gt;<i>                   {gen_tcp,#Port&lt;0.13250&gt;,tls_connection,&lt;0.298.0&gt;},
</I>&gt;&gt;<i>                   &lt;0.407.0&gt;},
</I>&gt;&gt;<i>               ranch_ssl,keepalive,&lt;0.408.0&gt;,&lt;&lt;&quot;POST&quot;&gt;&gt;,'HTTP/1.1',
</I>&gt;&gt;<i>               {{xxxxxxxxx},16220},
</I>&gt;&gt;<i>               &lt;&lt;&#171;xxxx&quot;&gt;&gt;,undefined,xxxx,&lt;&lt;&#171;xxxxx&quot;&gt;&gt;,undefined,
</I>&gt;&gt;<i>               &lt;&lt;&gt;&gt;,undefined,
</I>&gt;&gt;<i>               [{res_1,&lt;&lt;&#171;xxxx&quot;&gt;&gt;}],
</I>&gt;&gt;<i>               [{&lt;&lt;&quot;content-type&quot;&gt;&gt;,&lt;&lt;&quot;application/json&quot;&gt;&gt;},
</I>&gt;&gt;<i>                {&lt;&lt;&quot;content-length&quot;&gt;&gt;,&lt;&lt;&quot;2&quot;&gt;&gt;},
</I>&gt;&gt;<i>                {&lt;&lt;&quot;te&quot;&gt;&gt;,&lt;&lt;&gt;&gt;},
</I>&gt;&gt;<i>                {&lt;&lt;&quot;host&quot;&gt;&gt;,&lt;&lt;&#171;xxxxx&quot;&gt;&gt;},
</I>&gt;&gt;<i>                {&lt;&lt;&quot;authorization&quot;&gt;&gt;,
</I>&gt;&gt;<i>                 &lt;&lt;&quot;Basic xxxxxxxxxxxxxx&quot;&gt;&gt;},
</I>&gt;&gt;<i>                {&lt;&lt;&quot;connection&quot;&gt;&gt;,&lt;&lt;&quot;keep-alive&quot;&gt;&gt;}],
</I>&gt;&gt;<i>               [{&lt;&lt;&quot;authorization&quot;&gt;&gt;,
</I>&gt;&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;&gt;<i>                {&lt;&lt;&quot;connection&quot;&gt;&gt;,[&lt;&lt;&quot;keep-alive&quot;&gt;&gt;]}],
</I>&gt;&gt;<i>               undefined,[],waiting,
</I>&gt;&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>&gt;<i> 
</I>&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?
</I>&gt;<i> 
</I>&gt;<i> Either way if the client provides a wrong content-type you should reject the connection.
</I>&gt;<i> 
</I>&gt;&gt;<i>               undefined,false,waiting,
</I>&gt;&gt;<i>               [{&lt;&lt;&quot;Access-Control-Allow-Credentials&quot;&gt;&gt;,&lt;&lt;&quot;true&quot;&gt;&gt;},
</I>&gt;&gt;<i>                {&lt;&lt;&quot;Access-Control-Allow-Origin&quot;&gt;&gt;,
</I>&gt;&gt;<i>                 &lt;&lt;&quot;<A HREF="http://xxxxxxxxx">http://xxxxxxxxx</A>&quot;&gt;&gt;}],
</I>&gt;&gt;<i>               &lt;&lt;&gt;&gt;,undefined}}
</I>&gt;&gt;<i> Samir
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> 
</I>&gt;&gt;<i> _______________________________________________
</I>&gt;&gt;<i> Extend mailing list
</I>&gt;&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A>
</I>&gt;&gt;<i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A>
</I>&gt;&gt;<i> 
</I>&gt;<i> 
</I>&gt;<i> -- 
</I>&gt;<i> Lo&#239;c Hoguin
</I>&gt;<i> <A HREF="http://ninenines.eu">http://ninenines.eu</A>
</I>
</PRE>

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

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