asciidoctor-rfc 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,112 @@
1
+
2
+
3
+
4
+
5
+ Network Working Group C. Bormann
6
+ Internet-Draft Universitaet Bremen TZI
7
+ Intended status: Informational November 3, 2017
8
+ Expires: May 7, 2018
9
+
10
+
11
+ Many fine lunches and dinners
12
+ draft-mfld-00
13
+
14
+ Abstract
15
+
16
+ insert abstract here
17
+
18
+ Status of This Memo
19
+
20
+ This Internet-Draft is submitted in full conformance with the
21
+ provisions of BCP 78 and BCP 79.
22
+
23
+ Internet-Drafts are working documents of the Internet Engineering
24
+ Task Force (IETF). Note that other groups may also distribute
25
+ working documents as Internet-Drafts. The list of current Internet-
26
+ Drafts is at https://datatracker.ietf.org/drafts/current/.
27
+
28
+ Internet-Drafts are draft documents valid for a maximum of six months
29
+ and may be updated, replaced, or obsoleted by other documents at any
30
+ time. It is inappropriate to use Internet-Drafts as reference
31
+ material or to cite them other than as "work in progress."
32
+
33
+ This Internet-Draft will expire on May 7, 2018.
34
+
35
+ Copyright Notice
36
+
37
+ Copyright (c) 2017 IETF Trust and the persons identified as the
38
+ document authors. All rights reserved.
39
+
40
+ This document is subject to BCP 78 and the IETF Trust's Legal
41
+ Provisions Relating to IETF Documents
42
+ (https://trustee.ietf.org/license-info) in effect on the date of
43
+ publication of this document. Please review these documents
44
+ carefully, as they describe your rights and restrictions with respect
45
+ to this document. Code Components extracted from this document must
46
+ include Simplified BSD License text as described in Section 4.e of
47
+ the Trust Legal Provisions and are provided without warranty as
48
+ described in the Simplified BSD License.
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+ Bormann Expires May 7, 2018 [Page 1]
57
+
58
+ Internet-Draft mfld November 2017
59
+
60
+
61
+ Table of Contents
62
+
63
+ 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
64
+ 2. Informative References . . . . . . . . . . . . . . . . . . . 2
65
+ Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 2
66
+
67
+ 1. Introduction
68
+
69
+ This MAY [RFC2119] be useful.
70
+
71
+ 2. Informative References
72
+
73
+ [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
74
+ Requirement Levels", BCP 14, RFC 2119,
75
+ DOI 10.17487/RFC2119, March 1997,
76
+ <https://www.rfc-editor.org/info/rfc2119>.
77
+
78
+ Author's Address
79
+
80
+ Carsten Bormann
81
+ Universitaet Bremen TZI
82
+ Postfach 330440
83
+ Bremen D-28359
84
+ Germany
85
+
86
+ Phone: +49-421-218-63921
87
+ Email: cabo@tzi.org
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
+ Bormann Expires May 7, 2018 [Page 2]
@@ -0,0 +1,784 @@
1
+
2
+
3
+
4
+
5
+ XMPP Working Group K. Hartke
6
+ Internet-Draft C. Bormann
7
+ Intended status: Informational Universitaet Bremen TZI
8
+ Expires: January 6, 2010 July 5, 2009
9
+
10
+
11
+ STUN/TURN using PHP in Despair
12
+ draft-hartke-xmpp-stupid-00
13
+
14
+ Abstract
15
+
16
+ NAT (Network Address Translator) Traversal may require TURN
17
+ (Traversal Using Relays around NAT) functionality in certain cases
18
+ that are not unlikely to occur. There is little incentive to deploy
19
+ TURN servers, except by those who need them -- who may not be in a
20
+ position to deploy a new protocol on an Internet-connected node, in
21
+ particular not one with deployment requirements as high as those of
22
+ TURN.
23
+
24
+ "STUN/TURN using PHP in Despair" is a highly deployable protocol for
25
+ obtaining TURN-like functionality, while also providing the most
26
+ important function of STUN.
27
+
28
+ Status of This Memo
29
+
30
+ This Internet-Draft is submitted in full conformance with the
31
+ provisions of BCP 78 and BCP 79.
32
+
33
+ Internet-Drafts are working documents of the Internet Engineering
34
+ Task Force (IETF). Note that other groups may also distribute
35
+ working documents as Internet-Drafts. The list of current Internet-
36
+ Drafts is at http://datatracker.ietf.org/drafts/current/.
37
+
38
+ Internet-Drafts are draft documents valid for a maximum of six months
39
+ and may be updated, replaced, or obsoleted by other documents at any
40
+ time. It is inappropriate to use Internet-Drafts as reference
41
+ material or to cite them other than as "work in progress."
42
+
43
+ This Internet-Draft will expire on January 6, 2010.
44
+
45
+ Copyright Notice
46
+
47
+ Copyright (c) 2009 IETF Trust and the persons identified as the
48
+ document authors. All rights reserved.
49
+
50
+ This document is subject to BCP 78 and the IETF Trust's Legal
51
+ Provisions Relating to IETF Documents
52
+ (http://trustee.ietf.org/license-info) in effect on the date of
53
+
54
+
55
+
56
+ Hartke & Bormann Expires January 6, 2010 [Page 1]
57
+
58
+ Internet-Draft STuPiD July 2009
59
+
60
+
61
+ publication of this document. Please review these documents
62
+ carefully, as they describe your rights and restrictions with respect
63
+ to this document. Code Components extracted from this document must
64
+ include Simplified BSD License text as described in Section 4.e of
65
+ the Trust Legal Provisions and are provided without warranty as
66
+ described in the Simplified BSD License.
67
+
68
+ Table of Contents
69
+
70
+ 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
71
+ 1.1. The Need for Standardization . . . . . . . . . . . . . . 3
72
+ 2. Basic Protocol Operation . . . . . . . . . . . . . . . . . . 3
73
+ 3. Protocol Definition . . . . . . . . . . . . . . . . . . . . . 5
74
+ 3.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 5
75
+ 3.2. Discovering External IP Address and Port . . . . . . . . 5
76
+ 3.3. Storing Data . . . . . . . . . . . . . . . . . . . . . . 5
77
+ 3.4. Notification . . . . . . . . . . . . . . . . . . . . . . 6
78
+ 3.5. Retrieving Data . . . . . . . . . . . . . . . . . . . . . 6
79
+ 4. Implementation Notes . . . . . . . . . . . . . . . . . . . . 6
80
+ 5. Security Considerations . . . . . . . . . . . . . . . . . . . 6
81
+ 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 7
82
+ 6.1. Normative References . . . . . . . . . . . . . . . . . . 7
83
+ 6.2. Informative References . . . . . . . . . . . . . . . . . 7
84
+ Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 8
85
+ Appendix B. Sample Implementation . . . . . . . . . . . . . . . 10
86
+ Appendix C. Using XMPP as Out-Of-Band Channel . . . . . . . . . 12
87
+ Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 13
88
+
89
+ 1. Introduction
90
+
91
+ NAT (Network Address Translator) Traversal may require TURN
92
+ (Traversal Using Relays around NAT) [I-D.ietf-behave-turn]
93
+ functionality in certain cases that are not unlikely to occur. There
94
+ is little incentive to deploy TURN servers, except by those who need
95
+ them -- who may not be in a position to deploy a new protocol on an
96
+ Internet-connected node, in particular not one with deployment
97
+ requirements as high as those of TURN.
98
+
99
+ "STUN/TURN using PHP in Despair" is a highly deployable protocol for
100
+ obtaining TURN-like functionality, while also providing the most
101
+ important function of STUN [RFC5389].
102
+
103
+ The high degree of deployability is achieved by making STuPiD a Web
104
+ service, implementable in any Web application deployment scheme. As
105
+ PHP appears to be the solution of choice for avoiding deployment
106
+ problems in the Web world, a PHP-based sample implementation of
107
+ STuPiD is presented in Figure 5 in Appendix B. (This single-page
108
+
109
+
110
+
111
+
112
+ Hartke & Bormann Expires January 6, 2010 [Page 2]
113
+
114
+ Internet-Draft STuPiD July 2009
115
+
116
+
117
+ script has been tested with a free-of-charge web hoster, so it should
118
+ be deployable by literally everyone.)
119
+
120
+ 1.1. The Need for Standardization
121
+
122
+ If STuPiD is so easy to deploy, why standardize on it? First of all,
123
+ STuPiD server implementations will be done by other people than the
124
+ clients making use of the service. Clearly communicating between
125
+ these communities is a good idea, in particular if there are security
126
+ considerations.
127
+
128
+ Having one standard form of STuPiD service instead of one specific to
129
+ each kind of client also creates an incentive for optimized
130
+ implementations.
131
+
132
+ Finally, where STuPiD becomes part of a client standard (such as a
133
+ potential extension to XMPP's in-band byte-stream protocol as hinted
134
+ in Appendix C), it is a good thing if STuPiD is already defined.
135
+
136
+ Hence, this document focuses on the definition of the STuPiD service
137
+ itself, tries to make this as general as possible without increasing
138
+ complexity or cost and leaves the details of any client standards to
139
+ future documents.
140
+
141
+ 2. Basic Protocol Operation
142
+
143
+ The STuPiD protocol will typically be used with application instances
144
+ that first attempt to obtain connectivity using mechanisms similar to
145
+ those described in the STUN specification [RFC5389]. However, with
146
+ STuPiD, STUN is not really needed for TCP, as was demonstrated in
147
+ previous STUN-like implementations [STUNT]. Instead, STuPiD (like
148
+ [STUNT]) provides a simple Web service that echoes the remote address
149
+ and port of an incoming HTTP request; in most cases, this is enough
150
+ to get the job done.
151
+
152
+ In case no connection can be established with this simple STUN(T)-
153
+ like mechanism, a TURN-like relay is needed as a final fall-back.
154
+ The STuPiD protocol supports this, but solely provides a way for the
155
+ data to be relayed. STuPiD relies on an out-of-band channel to
156
+ notify the peer whenever new data is available (synchronization
157
+ signal). See Appendix C for one likely example of such an out-of-
158
+ band channel. (Note that the out-of-band channel may have a much
159
+ lower throughput than the STuPiD relay channel -- this is exactly the
160
+ case in the example provided in Appendix C, where the out-of-band
161
+ channel is typically throughput-limited to on the order of a few
162
+ kilobits per second.)
163
+
164
+
165
+
166
+
167
+
168
+ Hartke & Bormann Expires January 6, 2010 [Page 3]
169
+
170
+ Internet-Draft STuPiD July 2009
171
+
172
+
173
+ By designing the STuPiD web service in such a way that it can be
174
+ implemented by a simple PHP script such as that presented in
175
+ Appendix B, it is easy to deploy by those who need the STuPiD
176
+ services. The combination of the low-throughput out-of-band channel
177
+ for synchronization and the STuPiD web service for bulk data relaying
178
+ is somewhat silly but gets the job done.
179
+
180
+ The STuPiD data relay is implemented as follows (see Figure 1):
181
+
182
+ 1. Peer A, the source of the data to be relayed, stores a chunk of
183
+ data at the STuPiD server using an opaque identifier, the "chunk
184
+ identifier". How that chunk identifier is chosen is local to
185
+ Peer A; it could be composed of a random session id and a
186
+ sequence number.
187
+
188
+ 2. Peer A notifies the receiver of the data, Peer B, that a new data
189
+ chunk is available, specifying the URI needed for retrieval.
190
+ This notification is provided through an out-out-band channel.
191
+ (As an optimization for multiple consecutive transfers, A might
192
+ inform B once of a constant prefix of that URI and only send a
193
+ varying part such as a sequence number in each notification --
194
+ this is something to be decided in the client-client notification
195
+ protocol.)
196
+
197
+ 3. Peer B retrieves the data from the STuPiD server using the URI
198
+ provided by Peer A.
199
+
200
+ Note that the data transfer mechanism is one-way, i.e. to send data
201
+ in the other direction as well, Peer B needs to perform the same
202
+ steps using a STuPiD server at the same or a different location.
203
+
204
+
205
+ STuPiD ```````````````````````````````,
206
+ Script <----------------------------. ,
207
+ | ,
208
+ ^ , | ,
209
+ | , | ,
210
+ (1) | , | , (3)
211
+ POST | , | , GET
212
+ | , | ,
213
+ | v | v
214
+
215
+ Peer A -----------------------> Peer B
216
+ (2)
217
+ out-of-band
218
+ Notification
219
+
220
+ Figure 1: STuPiD Protocol Operation
221
+
222
+
223
+
224
+ Hartke & Bormann Expires January 6, 2010 [Page 4]
225
+
226
+ Internet-Draft STuPiD July 2009
227
+
228
+
229
+ 3. Protocol Definition
230
+
231
+ 3.1. Terminology
232
+
233
+ In this document, the key words "MUST", "MUST NOT", "REQUIRED",
234
+ "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",
235
+ and "OPTIONAL" are to be interpreted as described in BCP 14, RFC 2119
236
+ [RFC2119] and indicate requirement levels for compliant STuPiD
237
+ implementations.
238
+
239
+ 3.2. Discovering External IP Address and Port
240
+
241
+ A client may discover its external IP address and the port required
242
+ for port prediction by performing a HTTP GET request to a STuPiD
243
+ server. The STuPiD server MUST reply with the remote address and
244
+ remote port in the following format:
245
+
246
+ host ":" port
247
+
248
+ where 'host' and 'port' are defined as in [RFC3986].
249
+
250
+ 3.3. Storing Data
251
+
252
+ Data chunks are stored using the POST request of HTTP. The STuPiD
253
+ server MUST support one URI parameter which is passed as query-
254
+ string:
255
+
256
+ 'chid': A unique ID identifying the data chunk to be stored. The ID
257
+ SHOULD be chosen from the characters of the base64url set [RFC4648].
258
+
259
+ The payload of the POST request MUST be the data to be stored. The
260
+ 'Content-Type' SHOULD be 'application/octet-stream', although a
261
+ STuPiD server implementation SHOULD simply ignore the 'Content-Type'
262
+ as a client implementation may be restricted and may not able to
263
+ specify a specific 'Content-Type'. (E.g., in certain cases, the peer
264
+ may be limited to sending the data as multipart-form-encoded --
265
+ still, the data is stored as a byte stream.)
266
+
267
+ STuPiD servers may reject data chunks that are larger than some
268
+ predefined limit. This maximum size in bytes of each data chunk is
269
+ RECOMMENDED to be 65536 or more.
270
+
271
+ As HTTP already provides data transparency, the data chunk SHOULD NOT
272
+ be encoded using Base64 or any other data transparency mechanism; in
273
+ any case, the STuPiD server will not attempt to decode the chunk.
274
+
275
+ The sender MUST wait for the HTTP response before going on to notify
276
+ the receiver.
277
+
278
+
279
+
280
+ Hartke & Bormann Expires January 6, 2010 [Page 5]
281
+
282
+ Internet-Draft STuPiD July 2009
283
+
284
+
285
+ 3.4. Notification
286
+
287
+ The sender notifies the receiver of the data chunk by passing via an
288
+ out-of-band channel (which is not part of the STuPiD protocol):
289
+
290
+ The full URL from which the data chunk can be retrieved, i.e. the
291
+ same URL that was used to store the data chunk, including the chunk
292
+ ID parameter.
293
+
294
+ The exact notification mechanism over the out-of-band channel and the
295
+ definition of a session is dependent on the out-of-band channel. See
296
+ Appendix C for one example of such an out-of-band channel.
297
+
298
+ 3.5. Retrieving Data
299
+
300
+ The notified peer retrieves the data chunk using a GET request with
301
+ the URL supplied by the sender. The STuPiD server MUST set the
302
+ 'Content-Type' of the returned body to 'application/octet-stream'.
303
+
304
+ 4. Implementation Notes
305
+
306
+ A STuPiD server implementation SHOULD delete stored data some time
307
+ after it was stored. It is RECOMMENDED not to delete the data before
308
+ five minutes have elapsed after it was stored. Different client
309
+ protocols will have different reactions to data that have been
310
+ deleted prematurely and cannot be retrieved by the notified peer;
311
+ this may be as trivial as packet loss or it may cause a reliable
312
+ byte-stream to fail (Appendix B). (TODO: It may be useful to provide
313
+ some hints in the storing POST request.)
314
+
315
+ STuPiD clients should aggregate data in order to minimize the number
316
+ of requests to the STuPiD server per second. The specific
317
+ aggregation method chosen depends on the data rate required (and the
318
+ maximum chunk size), the latency requirements, and the application
319
+ semantics.
320
+
321
+ Clearly, it is up to the implementation to decide how the data chunks
322
+ are actually stored. A sufficiently silly STuPiD server
323
+ implementation might for instance use a MySQL database.
324
+
325
+ 5. Security Considerations
326
+
327
+ The security objectives of STuPiD are to be as secure as if NAT
328
+ traversal had succeeded, i.e., an on-path attacker can overhear and
329
+ fake messages, but an off-path attacker cannot. If a higher level of
330
+ security is desired, it should be provided on top of the data relayed
331
+ by STuPiD, e.g. by using XTLS [I-D.meyer-xmpp-e2e-encryption].
332
+
333
+
334
+
335
+
336
+ Hartke & Bormann Expires January 6, 2010 [Page 6]
337
+
338
+ Internet-Draft STuPiD July 2009
339
+
340
+
341
+ Much of the security of STuPiD is based on the assumption that an
342
+ off-path attacker cannot guess the chunk identifiers. A suitable
343
+ source of randomness [RFC4086] should be used to generate at least a
344
+ sufficiently large part of the chunk identifiers (e.g., the chunk
345
+ identifier could be a hard to guess prefix followed by a serial
346
+ number).
347
+
348
+ To protect the STuPiD server against denial of service and possibly
349
+ some forms of theft of service, it is RECOMMENDED that the POST side
350
+ of the STuPiD server be protected by some form of authentication such
351
+ as HTTP authentication. There is little need to protect the GET
352
+ side.
353
+
354
+ 6. References
355
+
356
+ 6.1. Normative References
357
+
358
+ [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
359
+ Requirement Levels", BCP 14, RFC 2119,
360
+ DOI 10.17487/RFC2119, March 1997,
361
+ <https://www.rfc-editor.org/info/rfc2119>.
362
+
363
+ [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
364
+ Resource Identifier (URI): Generic Syntax", STD 66,
365
+ RFC 3986, DOI 10.17487/RFC3986, January 2005,
366
+ <https://www.rfc-editor.org/info/rfc3986>.
367
+
368
+ [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker,
369
+ "Randomness Requirements for Security", BCP 106, RFC 4086,
370
+ DOI 10.17487/RFC4086, June 2005,
371
+ <https://www.rfc-editor.org/info/rfc4086>.
372
+
373
+ [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
374
+ Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006,
375
+ <https://www.rfc-editor.org/info/rfc4648>.
376
+
377
+ 6.2. Informative References
378
+
379
+ [I-D.ietf-behave-turn]
380
+ Rosenberg, J., Mahy, R., and P. Matthews, "Traversal Using
381
+ Relays around NAT (TURN): Relay Extensions to Session
382
+ Traversal Utilities for NAT (STUN)", draft-ietf-behave-
383
+ turn-16 (work in progress), July 2009.
384
+
385
+ [I-D.ietf-xmpp-3920bis]
386
+ Saint-Andre, P., "Extensible Messaging and Presence
387
+ Protocol (XMPP): Core", draft-ietf-xmpp-3920bis-22 (work
388
+ in progress), December 2010.
389
+
390
+
391
+
392
+ Hartke & Bormann Expires January 6, 2010 [Page 7]
393
+
394
+ Internet-Draft STuPiD July 2009
395
+
396
+
397
+ [I-D.meyer-xmpp-e2e-encryption]
398
+ Meyer, D. and P. Saint-Andre, "XTLS: End-to-End Encryption
399
+ for the Extensible Messaging and Presence Protocol (XMPP)
400
+ Using Transport Layer Security (TLS)", draft-meyer-xmpp-
401
+ e2e-encryption-02 (work in progress), June 2009.
402
+
403
+ [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing,
404
+ "Session Traversal Utilities for NAT (STUN)", RFC 5389,
405
+ DOI 10.17487/RFC5389, October 2008,
406
+ <https://www.rfc-editor.org/info/rfc5389>.
407
+
408
+ [STUNT] Hanson, R., "STUNT & out-of-band channels", September
409
+ 2007, <http://deusty.blogspot.com/2007/09/
410
+ stunt-out-of-band-channels.html>.
411
+
412
+ Appendix A. Examples
413
+
414
+ This appendix provides some examples of the STuPiD protocol
415
+ operation.
416
+
417
+ Request:
418
+
419
+ GET /stupid.php HTTP/1.0
420
+ User-Agent: Example/1.11.4
421
+ Accept: */*
422
+ Host: example.org
423
+ Connection: Keep-Alive
424
+
425
+ Response:
426
+
427
+ HTTP/1.1 200 OK
428
+ Date: Sun, 05 Jul 2009 00:30:37 GMT
429
+ Server: Apache/2.2
430
+ Cache-Control: no-cache, must-revalidate
431
+ Expires: Sat, 26 Jul 1997 05:00:00 GMT
432
+ Vary: Accept-Encoding
433
+ Content-Length: 17
434
+ Keep-Alive: timeout=1, max=400
435
+ Connection: Keep-Alive
436
+ Content-Type: application/octet-stream
437
+
438
+ 192.0.2.239:36654
439
+
440
+ Figure 2: Discovering External IP Address and Port
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+ Hartke & Bormann Expires January 6, 2010 [Page 8]
449
+
450
+ Internet-Draft STuPiD July 2009
451
+
452
+
453
+ Request:
454
+
455
+ POST /stupid.php?chid=i781hf64-0 HTTP/1.0
456
+ User-Agent: Example/1.11.4
457
+ Accept: */*
458
+ Host: example.org
459
+ Connection: Keep-Alive
460
+ Content-Type: application/octet-stream
461
+ Content-Length: 11
462
+
463
+ Hello World
464
+
465
+ Response:
466
+
467
+ HTTP/1.1 200 OK
468
+ Date: Sun, 05 Jul 2009 00:20:34 GMT
469
+ Server: Apache/2.2
470
+ Cache-Control: no-cache, must-revalidate
471
+ Expires: Sat, 26 Jul 1997 05:00:00 GMT
472
+ Vary: Accept-Encoding
473
+ Content-Length: 0
474
+ Keep-Alive: timeout=1, max=400
475
+ Connection: Keep-Alive
476
+ Content-Type: application/octet-stream
477
+
478
+ Figure 3: Storing Data
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+
501
+
502
+
503
+
504
+ Hartke & Bormann Expires January 6, 2010 [Page 9]
505
+
506
+ Internet-Draft STuPiD July 2009
507
+
508
+
509
+ Request:
510
+
511
+ GET /stupid.php?chid=i781hf64-0 HTTP/1.0
512
+ User-Agent: Example/1.11.4
513
+ Accept: */*
514
+ Host: example.org
515
+ Connection: Keep-Alive
516
+
517
+ Response:
518
+
519
+ HTTP/1.1 200 OK
520
+ Date: Sun, 05 Jul 2009 00:21:29 GMT
521
+ Server: Apache/2.2
522
+ Cache-Control: no-cache, must-revalidate
523
+ Expires: Sat, 26 Jul 1997 05:00:00 GMT
524
+ Vary: Accept-Encoding
525
+ Content-Length: 11
526
+ Keep-Alive: timeout=1, max=400
527
+ Connection: Keep-Alive
528
+ Content-Type: application/octet-stream
529
+
530
+ Hello World
531
+
532
+ Figure 4: Retrieving Data
533
+
534
+ Appendix B. Sample Implementation
535
+
536
+
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+
559
+
560
+ Hartke & Bormann Expires January 6, 2010 [Page 10]
561
+
562
+ Internet-Draft STuPiD July 2009
563
+
564
+
565
+ <?php
566
+ header("Cache-Control: no-cache, must-revalidate");
567
+ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
568
+ header("Content-Type: application/octet-stream");
569
+
570
+ mysql_connect(localhost, "username", "password");
571
+ mysql_select_db("stupid");
572
+
573
+ $chid = mysql_real_escape_string($_GET["chid"]);
574
+
575
+ if ($_SERVER["REQUEST_METHOD"] == "GET") {
576
+ if (empty($chid)) {
577
+ echo $_SERVER["REMOTE_ADDR"] . ":" . $_SERVER["REMOTE_PORT"];
578
+ } elseif ($result = mysql_query("SELECT `data` FROM `Data` " .
579
+ "WHERE `chid` = '$chid'")) {
580
+ if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
581
+ echo base64_decode($row["data"]);
582
+ } else {
583
+ header("HTTP/1.0 404 Not Found");
584
+ }
585
+ mysql_free_result($result);
586
+ } else {
587
+ header("HTTP/1.0 404 Not Found");
588
+ }
589
+ } elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
590
+ if (empty($chid)) {
591
+ header("HTTP/1.0 404 Not Found");
592
+ } else {
593
+ mysql_query("DELETE FROM `Data` " .
594
+ "WHERE `timestamp` < DATE_SUB(NOW(), INTERVAL 5 MINUTE)");
595
+ $data = base64_encode(file_get_contents("php://input"));
596
+ if (!mysql_query("INSERT INTO `Data` (`chid`, `data`) " .
597
+ "VALUES ('$chid', '$data')")) {
598
+ header("HTTP/1.0 403 Bad Request");
599
+ }
600
+ }
601
+ } else {
602
+ header("HTTP/1.0 405 Method Not Allowed");
603
+ header("Allow: GET, HEAD, POST");
604
+ }
605
+ mysql_close();
606
+ ?>
607
+
608
+ Figure 5: STuPiD Sample Implementation
609
+
610
+
611
+
612
+
613
+
614
+
615
+
616
+ Hartke & Bormann Expires January 6, 2010 [Page 11]
617
+
618
+ Internet-Draft STuPiD July 2009
619
+
620
+
621
+ Appendix C. Using XMPP as Out-Of-Band Channel
622
+
623
+ XMPP [I-D.ietf-xmpp-3920bis] is a good choice for an out-of-band
624
+ channel.
625
+
626
+ The notification protocol is closely modeled after XMPP's In-Band
627
+ Bytestreams (IBB, see http://xmpp.org/extensions/xep-0047.html).
628
+ Just replace the namespace and insert the STuPiD Retrieval URI
629
+ instead of the actual Base64 encoded data, see Figure 8. (Note that
630
+ the current proposal redundantly sends a sid and a seq as well as the
631
+ chid composed of these two; it may be possible to optimize this,
632
+ possibly sending the constant prefix of the URI once at bytestream
633
+ creation time.)
634
+
635
+ Notifications MUST be processed in the order they are received. If
636
+ an out-of-sequence notification is received for a particular session
637
+ (determined by checking the 'seq' attribute), then this indicates
638
+ that a notification has been lost. The recipient MUST NOT process
639
+ such an out-of-sequence notification, nor any that follow it within
640
+ the same session; instead, the recipient MUST consider the session
641
+ invalid. (Adapted from http://xmpp.org/extensions/xep-
642
+ 0047.html#send)
643
+
644
+ Of course, other methods can be used for setup and teardown, such as
645
+ Jingle (see http://xmpp.org/extensions/xep-0261.html).
646
+
647
+ <iq from='romeo@montague.net/orchard'
648
+ id='jn3h8g65'
649
+ to='juliet@capulet.com/balcony'
650
+ type='set'>
651
+ <open xmlns='urn:xmpp:tmp:stupid'
652
+ block-size='65536'
653
+ sid='i781hf64'
654
+ stanza='iq'/>
655
+ </iq>
656
+
657
+ Figure 6: Creating a Bytestream: Initiator requests session
658
+
659
+ <iq from='juliet@capulet.com/balcony'
660
+ id='jn3h8g65'
661
+ to='romeo@montague.net/orchard'
662
+ type='result'/>
663
+
664
+ Figure 7: Creating a Bytestream: Responder accepts session
665
+
666
+
667
+
668
+
669
+
670
+
671
+
672
+ Hartke & Bormann Expires January 6, 2010 [Page 12]
673
+
674
+ Internet-Draft STuPiD July 2009
675
+
676
+
677
+ <iq from='romeo@montague.net/orchard'
678
+ id='kr91n475'
679
+ to='juliet@capulet.com/balcony'
680
+ type='set'>
681
+ <data xmlns='urn:xmpp:tmp:stupid'
682
+ seq='0'
683
+ sid='i781hf64'
684
+ url='http://example.org/stupid.php?chid=i781hf64-0'/>
685
+ </iq>
686
+
687
+ Figure 8: Sending Notifications: Notification in an IQ stanza
688
+
689
+ <iq from='juliet@capulet.com/balcony'
690
+ id='kr91n475'
691
+ to='romeo@montague.net/orchard'
692
+ type='result'/>
693
+
694
+ Figure 9: Sending Notifications: Acknowledging notification using IQ
695
+
696
+ <iq from='romeo@montague.net/orchard'
697
+ id='us71g45j'
698
+ to='juliet@capulet.com/balcony'
699
+ type='set'>
700
+ <close xmlns='urn:xmpp:tmp:stupid'
701
+ sid='i781hf64'/>
702
+ </iq>
703
+
704
+ Figure 10: Closing the Bytestream: Request
705
+
706
+ <iq from='juliet@capulet.com/balcony'
707
+ id='us71g45j'
708
+ to='romeo@montague.net/orchard'
709
+ type='result'/>
710
+
711
+ Figure 11: Closing the Bytestream: Success response
712
+
713
+ Authors' Addresses
714
+
715
+ Klaus Hartke
716
+ Universitaet Bremen TZI
717
+
718
+ Email: hartke@tzi.org
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+ Hartke & Bormann Expires January 6, 2010 [Page 13]
729
+
730
+ Internet-Draft STuPiD July 2009
731
+
732
+
733
+ Carsten Bormann
734
+ Universitaet Bremen TZI
735
+ Postfach 330440
736
+ Bremen D-28359
737
+ Germany
738
+
739
+ Phone: +49-421-218-63921
740
+ Fax: +49-421-218-7000
741
+ Email: cabo@tzi.org
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
784
+ Hartke & Bormann Expires January 6, 2010 [Page 14]