From 7c6492599d64e3125af81e1c6442c1c1c43ad187 Mon Sep 17 00:00:00 2001 From: Martin Peach Date: Thu, 13 Jan 2011 18:54:34 +0000 Subject: Two externals to process HTTP/1.1 requests and responses in conjunction with net exernals like [tcpclient] or [slipenc]/[slipdec]. So far only GET requests work. svn path=/trunk/externals/mrpeach/; revision=14735 --- net/httpreceive-help.pd | 94 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 net/httpreceive-help.pd (limited to 'net/httpreceive-help.pd') diff --git a/net/httpreceive-help.pd b/net/httpreceive-help.pd new file mode 100644 index 0000000..1ea8800 --- /dev/null +++ b/net/httpreceive-help.pd @@ -0,0 +1,94 @@ +#N canvas 389 46 712 733 10; +#X obj 119 76 httpreq; +#X obj 73 15 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X msg 91 31 GET http://132.205.142.12/index.php; +#X obj 136 269 unpack 0 0 0 0; +#X floatatom 136 292 3 0 0 0 - - -; +#X floatatom 163 292 3 0 0 0 - - -; +#X floatatom 190 292 3 0 0 0 - - -; +#X floatatom 217 292 3 0 0 0 - - -; +#X text 81 310 from; +#X obj 119 217 tcpclient; +#X obj 153 243 tgl 15 0 empty empty connected 18 7 0 8 -24198 -13381 +-1 0 1; +#X text 190 216 tcpclient opens a tcp socket to send and receive bytes +on; +#X floatatom 270 302 9 0 0 0 - - -; +#X floatatom 313 280 9 0 0 0 - - -; +#X text 382 279 Size of the send buffer; +#X obj 270 234 route sent buf blocked; +#X text 340 301 Number of bytes sent; +#X obj 356 258 print sender_blocked!; +#X msg 85 166 connect 132.205.142.12 80; +#X obj 119 410 httpreceive; +#X floatatom 182 443 5 0 0 0 - - -; +#X symbolatom 150 602 10 0 0 0 - - -; +#X obj 150 580 prepend set; +#X symbolatom 216 560 50 0 0 0 - - -; +#X obj 216 538 prepend set; +#X obj 150 486 route reason Date Content-Length Content-Type; +#X symbolatom 350 528 50 0 0 0 - - -; +#X obj 350 506 prepend set; +#X floatatom 283 518 5 0 0 0 - - -; +#X msg 111 51 GET http://132.205.142.12/nothing; +#X msg 44 125 dump \$1; +#X obj 44 99 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1 +; +#X obj 37 288 tgl 15 0 empty empty empty 17 7 0 10 -4034 -257985 -1 +1 1; +#X msg 37 311 verbosity \$1; +#X obj 457 503 print more_status; +#X obj 76 352 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X text 175 115 So far only GET requests are supported; +#X text 515 686 Author: Martin Peach; +#X text 515 703 Date: 2011/01/13; +#X text 224 441 The right outlet is the status code.; +#X text 166 653 The left outlet is the message body as a list of bytes +; +#X text 154 465 The middle outlet is the status header as name/value +pairs; +#X obj 119 653 spigot; +#X obj 119 683 print message_body; +#X obj 152 631 tgl 15 0 empty empty printing_long_messages_can_hang_Pd +17 7 0 10 -4034 -257985 -1 0 1; +#X text 175 77 [httpreq] sends an HTTP/1.1 request as a list of bytes +(actually float atoms) \, suitable for [tcpclient]; +#X text 195 404 [htpreceive] expects an HTTP/1.1 response as one or +more lists of bytes.; +#X text 187 517 message length:; +#X connect 0 0 9 0; +#X connect 1 0 0 0; +#X connect 2 0 0 0; +#X connect 3 0 4 0; +#X connect 3 1 5 0; +#X connect 3 2 6 0; +#X connect 3 3 7 0; +#X connect 9 0 19 0; +#X connect 9 1 3 0; +#X connect 9 2 10 0; +#X connect 9 3 15 0; +#X connect 15 0 12 0; +#X connect 15 1 13 0; +#X connect 15 2 17 0; +#X connect 18 0 9 0; +#X connect 19 0 42 0; +#X connect 19 1 25 0; +#X connect 19 2 20 0; +#X connect 22 0 21 0; +#X connect 24 0 23 0; +#X connect 25 0 22 0; +#X connect 25 1 24 0; +#X connect 25 2 28 0; +#X connect 25 3 27 0; +#X connect 25 4 34 0; +#X connect 27 0 26 0; +#X connect 29 0 0 0; +#X connect 30 0 9 0; +#X connect 31 0 30 0; +#X connect 32 0 33 0; +#X connect 33 0 19 0; +#X connect 35 0 19 0; +#X connect 42 0 43 0; +#X connect 44 0 42 1; -- cgit v1.2.1