summaryrefslogtreecommitdiffstats
path: root/archives/extend/2015-February.txt
blob: ca8da60995022dbc6b6f569df7a6da8737bf14ed (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
From pdtwonotes at gmail.com  Sun Feb 15 23:50:58 2015
From: pdtwonotes at gmail.com (Paul Dickson)
Date: Sun, 15 Feb 2015 17:50:58 -0500
Subject: [99s-extend] callbacks for additional methods
Message-ID: <[email protected]>

I am writing a CalDAV handler, which is a type of WebDAV server.  CalDAV
defines a bunch of
additional methods beyond what a typical web browser would use, such as
REPORT and PROPFIND.

I have written the allowed_methods and known_methods callbacks to report
that all these methods
are acceptable.  My content_types_provided has an entry for
"application/xml", which is how these
extra methods turn up.

When I connect to my server using the calendar function of Evolution,
one of the first things it does
is a REPORT method, which is sort of a query.  This gets as far as
content_types_provided, but after
that it does not call the function I identified in
content_types_provided.

What is the best way to handle the non-standard methods that do not have
defined callbacks?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20150215/9d2f5de1/attachment.html>

From samset at wanadoo.fr  Fri Feb 27 18:07:08 2015
From: samset at wanadoo.fr (Samir Sow)
Date: Fri, 27 Feb 2015 18:07:08 +0100
Subject: [99s-extend] Body length and content-length mismatch
Message-ID: <[email protected]>

Hi,

I?m facing an issue with the cowboy_req:body call.

The header show a length of 2 while the body itself is a binary string which has a size greater than 2 for sure.
Trying to use cowboy_req:body with the length option does not make any difference.

How can i retrieve the data ?
Any clue ?

Thank you

{ok,{<<"basic">>,{<<?xxxxx at xxxxxx">>,<<?xxxxxxx">>}},
          {http_req,
              {sslsocket,
                  {gen_tcp,#Port<0.13250>,tls_connection,<0.298.0>},
                  <0.407.0>},
              ranch_ssl,keepalive,<0.408.0>,<<"POST">>,'HTTP/1.1',
              {{xxxxxxxxx},16220},
              <<?xxxx">>,undefined,xxxx,<<?xxxxx">>,undefined,
              <<>>,undefined,
              [{res_1,<<?xxxx">>}],
              [{<<"content-type">>,<<"application/json">>},
               {<<"content-length">>,<<"2">>},
               {<<"te">>,<<>>},
               {<<"host">>,<<?xxxxx">>},
               {<<"authorization">>,
                <<"Basic xxxxxxxxxxxxxx">>},
               {<<"connection">>,<<"keep-alive">>}],
              [{<<"authorization">>,
                {<<"basic">>,{<<?xxxxxx">>,<<?xxxxxx">>}}},
               {<<"connection">>,[<<"keep-alive">>]}],
              undefined,[],waiting,
              <<"{\"login\":\?xxxx at xxxxxx\",\?xxxx\":\?xxxx\"}{\"login\":\?xxxx at xxxx\",\?xxxx\":\?xxxxx\"}">>,
              undefined,false,waiting,
              [{<<"Access-Control-Allow-Credentials">>,<<"true">>},
               {<<"Access-Control-Allow-Origin">>,
                <<"http://xxxxxxxxx">>}],
              <<>>,undefined}}
Samir



From essen at ninenines.eu  Fri Feb 27 18:11:42 2015
From: essen at ninenines.eu (=?UTF-8?B?TG/Dr2MgSG9ndWlu?=)
Date: Fri, 27 Feb 2015 18:11:42 +0100
Subject: [99s-extend] Body length and content-length mismatch
In-Reply-To: <[email protected]>
References: <[email protected]>
Message-ID: <[email protected]>

It looks like the client is telling you BS.

On 02/27/2015 06:07 PM, Samir Sow wrote:
> Hi,
>
> I?m facing an issue with the cowboy_req:body call.
>
> The header show a length of 2 while the body itself is a binary string which has a size greater than 2 for sure.
> Trying to use cowboy_req:body with the length option does not make any difference.
>
> How can i retrieve the data ?
> Any clue ?
>
> Thank you
>
> {ok,{<<"basic">>,{<<?xxxxx at xxxxxx">>,<<?xxxxxxx">>}},
>            {http_req,
>                {sslsocket,
>                    {gen_tcp,#Port<0.13250>,tls_connection,<0.298.0>},
>                    <0.407.0>},
>                ranch_ssl,keepalive,<0.408.0>,<<"POST">>,'HTTP/1.1',
>                {{xxxxxxxxx},16220},
>                <<?xxxx">>,undefined,xxxx,<<?xxxxx">>,undefined,
>                <<>>,undefined,
>                [{res_1,<<?xxxx">>}],
>                [{<<"content-type">>,<<"application/json">>},
>                 {<<"content-length">>,<<"2">>},
>                 {<<"te">>,<<>>},
>                 {<<"host">>,<<?xxxxx">>},
>                 {<<"authorization">>,
>                  <<"Basic xxxxxxxxxxxxxx">>},
>                 {<<"connection">>,<<"keep-alive">>}],
>                [{<<"authorization">>,
>                  {<<"basic">>,{<<?xxxxxx">>,<<?xxxxxx">>}}},
>                 {<<"connection">>,[<<"keep-alive">>]}],
>                undefined,[],waiting,
>                <<"{\"login\":\?xxxx at xxxxxx\",\?xxxx\":\?xxxx\"}{\"login\":\?xxxx at xxxx\",\?xxxx\":\?xxxxx\"}">>,

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.

>                undefined,false,waiting,
>                [{<<"Access-Control-Allow-Credentials">>,<<"true">>},
>                 {<<"Access-Control-Allow-Origin">>,
>                  <<"http://xxxxxxxxx">>}],
>                <<>>,undefined}}
> Samir
>
>
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

-- 
Lo?c Hoguin
http://ninenines.eu

From samset at wanadoo.fr  Fri Feb 27 18:33:56 2015
From: samset at wanadoo.fr (Samir Sow)
Date: Fri, 27 Feb 2015 18:33:56 +0100
Subject: [99s-extend] Body length and content-length mismatch
In-Reply-To: <[email protected]>
References: <[email protected]>
 <[email protected]>
Message-ID: <[email protected]>

Yes.
i?m using httpc. It does not like  wrapping a binary string inside a [].
I?ll fix my body.

Thank you.

Sincerely.



> On 27 f?vr. 2015, at 18:11, Lo?c Hoguin <essen at ninenines.eu> wrote:
> 
> It looks like the client is telling you BS.
> 
> On 02/27/2015 06:07 PM, Samir Sow wrote:
>> Hi,
>> 
>> I?m facing an issue with the cowboy_req:body call.
>> 
>> The header show a length of 2 while the body itself is a binary string which has a size greater than 2 for sure.
>> Trying to use cowboy_req:body with the length option does not make any difference.
>> 
>> How can i retrieve the data ?
>> Any clue ?
>> 
>> Thank you
>> 
>> {ok,{<<"basic">>,{<<?xxxxx at xxxxxx">>,<<?xxxxxxx">>}},
>>           {http_req,
>>               {sslsocket,
>>                   {gen_tcp,#Port<0.13250>,tls_connection,<0.298.0>},
>>                   <0.407.0>},
>>               ranch_ssl,keepalive,<0.408.0>,<<"POST">>,'HTTP/1.1',
>>               {{xxxxxxxxx},16220},
>>               <<?xxxx">>,undefined,xxxx,<<?xxxxx">>,undefined,
>>               <<>>,undefined,
>>               [{res_1,<<?xxxx">>}],
>>               [{<<"content-type">>,<<"application/json">>},
>>                {<<"content-length">>,<<"2">>},
>>                {<<"te">>,<<>>},
>>                {<<"host">>,<<?xxxxx">>},
>>                {<<"authorization">>,
>>                 <<"Basic xxxxxxxxxxxxxx">>},
>>                {<<"connection">>,<<"keep-alive">>}],
>>               [{<<"authorization">>,
>>                 {<<"basic">>,{<<?xxxxxx">>,<<?xxxxxx">>}}},
>>                {<<"connection">>,[<<"keep-alive">>]}],
>>               undefined,[],waiting,
>>               <<"{\"login\":\?xxxx at xxxxxx\",\?xxxx\":\?xxxx\"}{\"login\":\?xxxx at xxxx\",\?xxxx\":\?xxxxx\"}">>,
> 
> 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.
> 
>>               undefined,false,waiting,
>>               [{<<"Access-Control-Allow-Credentials">>,<<"true">>},
>>                {<<"Access-Control-Allow-Origin">>,
>>                 <<"http://xxxxxxxxx">>}],
>>               <<>>,undefined}}
>> Samir
>> 
>> 
>> _______________________________________________
>> Extend mailing list
>> Extend at lists.ninenines.eu
>> https://lists.ninenines.eu/listinfo/extend
>> 
> 
> -- 
> Lo?c Hoguin
> http://ninenines.eu