Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 4th, 2010  |  syntax: None  |  size: 3.95 KB  |  views: 87  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. TWINK SPECIFICATION v.1.0
  2. -------------------------
  3.  
  4. by John Hoffman, 2004.
  5.  
  6. Twink is a P2P-amplified web page service system, designed to assist overloaded
  7. ("Slashdotted") web servers.  It requires a browser plug-in or proxy on the
  8. client side, and a few easy-to-automate arrangements on the server side.
  9. It provides a large amount of control over the caching, allowing static
  10. portions of pages containing active content to be buffered without disruption.
  11.  
  12.  
  13. SERVER SIDE:
  14. ------------
  15.  
  16. * "twink.txt"
  17.  
  18. The Twink protocol is controlled by a text file in the same directory as the
  19. web page being fetched.  For instance, a Twink-enabled browser that was being
  20. used to surf to "http://somewhere.com/dir/index.html" would first attempt to
  21. read "http://somewhere.com/dir/twink.txt".  If this failed, the browser would
  22. then read the index page normally.
  23.  
  24. The format of the text file is similar to that of robots.txt:  Any line
  25. beginning with # is considered a comment.  The format of a line is:
  26. <field> ":" <value>.  Currently, there are only three fields used (and
  27. required) for a twink.txt file: "hash", "tracker", and "archive".
  28.  
  29. "hash" is the SHA1 hash in hexadecimal format for a .tar.bz2 file containing
  30. a mirror of the directory the twink.txt file resides in, including
  31. subdirectories.  The next step is for the browser to obtain a copy of this
  32. file and extract it into its cache area.  Further pages fetched from within
  33. the same directory should also be read from this cache.
  34.  
  35. "tracker" is the URL for a script that assists the browser in connecting to
  36. other peers; see below for more details.
  37.  
  38. "archive" is a URL from which the browser may download a copy of the .tar.bz2
  39. mirror file.  This may simply be a copy of the archive available via http, or
  40. it may point to a script designed to moderate access to the archive and so
  41. prevent the server from becoming overloaded.  If the http response to this
  42. request is 503, the body of the return may consist of an ASCII integer value
  43. specifying how long the browser should wait before retrying the download.
  44. (If the body of the return differs from this, then it should be considered
  45. to be a standard 503 return.)  In the meantime, the browser may continue to
  46. attempt to obtain the data via the P2P network.
  47.  
  48. Example:
  49.  
  50. #---- sample twink.txt file
  51. hash: 0123456789ABCDEF0123456789ABCDEF01234567
  52. tracker: http://somewhere.com/tracker.php
  53. archive: http://somewhere.com/archive.php?source=dir
  54. #---- end of sample
  55.  
  56.  
  57. * the tracker
  58.  
  59. The Twink-enabled browser should contact the tracker script with the
  60. following format:
  61.  
  62. <script url>?hash=<hexadecimal hash>&port=<listening port>
  63. Where the hexadecimal hash is the same one provided in twink.txt, and the
  64. listening port is the port where the Twink-enabled browser is open for
  65. incoming peer connections.
  66.  
  67. Example:
  68.  
  69. http://somewhere.com/tracker.php?hash=0123456789ABCDEF0123456789ABCDEF01234567&port=6221
  70.  
  71. Normally, the tracker should return a status 200 and a bencoded(1) dict
  72. object with the following possible keys:  "ip", and "ip6".  If the tracker
  73. returns a status 101 (switching protocols) or 404 (not found), the browser
  74. should then attempt to fetch the page via standard http.  The browser
  75. should directly display any other response.
  76.  
  77. Both the "ip" and "ip6" keys contain strings which themselves contain
  78. binary-encoded blocks of data specifying peer addresses and ports.  For
  79. "ip", each peer entry is 6 bytes, 4 bytes containing the IP and 2 bytes
  80. containing the port in big-endian format.  For "ip6" each peer entry is
  81. 18 bytes, with 16 containing an IPv6 address and 2 containing the port as
  82. above.  The client should support gzipped responses, though this is only
  83. likely to help for IPv6 data.  The tracker should return the last 20
  84. peers which accessed it in the last 60 seconds for that particular
  85. archive.
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. <!--#include virtual="data.html" -->
  99.  
  100.  
  101. (1) http://fx.saintjoe.edu/pub/CPAN/authors/id/O/OR/ORCLEV/Convert-Bencode-1.03.readme
clone this paste RAW Paste Data