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
|
<!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ï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:
><i> Hi,
</I>><i>
</I>><i> I’m facing an issue with the cowboy_req:body call.
</I>><i>
</I>><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>><i> Trying to use cowboy_req:body with the length option does not make any difference.
</I>><i>
</I>><i> How can i retrieve the data ?
</I>><i> Any clue ?
</I>><i>
</I>><i> Thank you
</I>><i>
</I>><i> {ok,{<<"basic">>,{<<«<A HREF="https://lists.ninenines.eu/listinfo/extend">xxxxx at xxxxxx</A>">>,<<«xxxxxxx">>}},
</I>><i> {http_req,
</I>><i> {sslsocket,
</I>><i> {gen_tcp,#Port<0.13250>,tls_connection,<0.298.0>},
</I>><i> <0.407.0>},
</I>><i> ranch_ssl,keepalive,<0.408.0>,<<"POST">>,'HTTP/1.1',
</I>><i> {{xxxxxxxxx},16220},
</I>><i> <<«xxxx">>,undefined,xxxx,<<«xxxxx">>,undefined,
</I>><i> <<>>,undefined,
</I>><i> [{res_1,<<«xxxx">>}],
</I>><i> [{<<"content-type">>,<<"application/json">>},
</I>><i> {<<"content-length">>,<<"2">>},
</I>><i> {<<"te">>,<<>>},
</I>><i> {<<"host">>,<<«xxxxx">>},
</I>><i> {<<"authorization">>,
</I>><i> <<"Basic xxxxxxxxxxxxxx">>},
</I>><i> {<<"connection">>,<<"keep-alive">>}],
</I>><i> [{<<"authorization">>,
</I>><i> {<<"basic">>,{<<«xxxxxx">>,<<«xxxxxx">>}}},
</I>><i> {<<"connection">>,[<<"keep-alive">>]}],
</I>><i> undefined,[],waiting,
</I>><i> <<"{\"login\":\»<A HREF="https://lists.ninenines.eu/listinfo/extend">xxxx at xxxxxx</A>\",\»xxxx\":\»xxxx\"}{\"login\":\»<A HREF="https://lists.ninenines.eu/listinfo/extend">xxxx at xxxx</A>\",\»xxxx\":\»xxxxx\"}">>,
</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.
><i> undefined,false,waiting,
</I>><i> [{<<"Access-Control-Allow-Credentials">>,<<"true">>},
</I>><i> {<<"Access-Control-Allow-Origin">>,
</I>><i> <<"<A HREF="http://xxxxxxxxx">http://xxxxxxxxx</A>">>}],
</I>><i> <<>>,undefined}}
</I>><i> Samir
</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="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>
|