twiggy-0.1025+dfsg.orig/0000755000175000017500000000000012631023453014262 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/LICENSE0000644000175000017500000004367712452063163015313 0ustar gregoagregoaThis software is copyright (c) 2015 by Tatsuhiko Miyagawa. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2015 by Tatsuhiko Miyagawa. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2015 by Tatsuhiko Miyagawa. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End twiggy-0.1025+dfsg.orig/MANIFEST0000644000175000017500000000157512631023453015423 0ustar gregoagregoa# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.029. Changes LICENSE MANIFEST META.json META.yml Makefile.PL cpanfile dist.ini eg/chat-websocket/chat.psgi eg/chat-websocket/static/DUI.js eg/chat-websocket/static/Stream.js eg/chat-websocket/static/jquery-1.3.2.min.js eg/chat-websocket/static/jquery.cookie.js eg/chat-websocket/static/jquery.md5.js eg/chat-websocket/static/pretty.js eg/chat-websocket/templates/index.mt eg/chat-websocket/templates/room.mt eg/chat-websocket/templates/test.js lib/AnyEvent/Server/PSGI.pm lib/Plack/Handler/Twiggy.pm lib/Twiggy.pm lib/Twiggy/Server.pm lib/Twiggy/Server/SS.pm script/twiggy t/00_compile.t t/anyevent.t t/anyevent_closed_connection.t t/anyevent_closed_streaming.t t/anyevent_extensions.t t/anyevent_manyconnections.t t/anyevent_server_starter.t t/anyevent_slow_post.t t/deflater.t t/disconnect.t t/release-pod-syntax.t twiggy-0.1025+dfsg.orig/Changes0000644000175000017500000000623112452063163015562 0ustar gregoagregoaRevision history for Perl extension Twiggy 0.1025 2015-01-04 07:00:16 JST - Fix a bug where Twiggy's run loop exits after a streaming request is cut off (hoelzro) #41 0.1024 2013-10-12 11:35:35 PDT - Fix a bug where exit_guard is not correctly decremented when writing header failed (maedama) #37 0.1023 2013-06-15 01:51:22 PDT - Move the bin directory (moznion) #35 0.1022 2013-06-12 12:36:16 PDT - convert to use Milla - Fix dependency for LWP 0.1021 Fri Oct 19 15:09:17 PDT 2012 - Repackage with the latest Module::Install 0.1020 Mon Feb 20 16:31:44 PST 2012 - Improve SEREVR_PORT when binding multiple ports - Documentation fixes (Pedro Melo) - Suppres 400 if client disconnected (athomason) - Don't restrict parsing the request body to PUT and POST requests (Moritz Onken) - Fixed broken POST data processing (und3f, hidekiy) 0.1010 Mon Jan 17 17:04:14 PST 2011 - Returning CondVar as a PSGI response is deprecated. Will be removed in the next release 0.1009 Fri Dec 3 11:52:20 PST 2010 - Fixed leaking fd (t0m) 0.1008 Fri Oct 1 11:54:01 PDT 2010 - Fixes shebang (chiba) - Fixed typo 0.1007 Fri Sep 10 13:13:18 PDT 2010 - Passing port => 0|undef to the Plack::Handler::Twiggy (and Twiggy::Server) means it's passing them to AnyEvent::Socket to find un available random port. 0.1006 Sun Aug 8 23:35:52 PDT 2010 - Fix an edge case when on_drain gets empty string the request is never completed (clkao) - no automatic 'use lib' in twiggy command line 0.1005 Sun Mar 28 14:37:03 PDT 2010 - Implemented twiggy -v 0.1004 Thu Feb 18 15:03:33 PST 2010 - Fixed the exit_guards so embedding Twiggy works (melo) 0.1003 Thu Feb 18 13:33:20 PST 2010 - Improved memory usage (hidekiy) - Reverted XS dependency on HTTP::Parser::XS to be optional (tokuhirom) - Fixed documentation 0.1002 Mon Feb 15 19:54:08 PST 2010 - Skip the test if Server::Starter is not installed 0.1001 Mon Feb 15 19:51:34 PST 2010 - Destroy listen guards when it shuts down (lestrrat) - Support Server::Starter (lestrrat) - Fixed dependencies 0.1000 Mon Feb 15 17:56:33 PST 2010 - Renamed the distribution to Twiggy - Fixed a busyloop bug (hidekiy) - Fixed write_real_fh for linux (hidekiy) - Reverted the psgi.input to buffer the POST body - Dropped ContentLength middleware - Support listening on multiple sockets and UNIX sockets - Implemented psgix.io and psgix.input.buffered - Removed undocumented poll_cb on writer 0.03 Wed Nov 11 21:33:16 PST 2009 - Merged nothingmuch's fork to make the socket handling much faster (twice as fast!) - Fixed poll_cb and writer shutdown - Implemented graceful exit on SIGQUIT (nothingmuch) 0.02 Thu Oct 29 12:38:15 PDT 2009 - Support psgi.streaming and condvar response for delayed response (nothingmuch) - Improved error handling, memory usage and performance by not using AnyEvent::Handle (nothingmuch) 0.01 Mon Oct 12 23:31:52 2009 - original version twiggy-0.1025+dfsg.orig/cpanfile0000644000175000017500000000034412452063163015772 0ustar gregoagregoarequires 'AnyEvent'; requires 'HTTP::Status'; requires 'Plack', '0.99'; requires 'Try::Tiny'; requires 'perl', '5.008001'; on test => sub { requires 'Test::More'; requires 'Test::Requires'; requires 'Test::TCP'; }; twiggy-0.1025+dfsg.orig/eg/0000755000175000017500000000000012631023453014655 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/eg/chat-websocket/0000755000175000017500000000000012452063163017563 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/eg/chat-websocket/templates/0000755000175000017500000000000012452063163021561 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/eg/chat-websocket/templates/index.mt0000644000175000017500000000301612452063163023232 0ustar gregoagregoa Twiggy/Plack WebSocket Chat demo

Enter room name:

room name to enter:
twiggy-0.1025+dfsg.orig/eg/chat-websocket/templates/room.mt0000644000175000017500000000737012452063163023106 0ustar gregoagregoa? my ($host, $room) = @_ Twiggy/Plack WebSocket Chat demo

Chat room:

Your email (for Gravatar):
Something to say:
twiggy-0.1025+dfsg.orig/eg/chat-websocket/templates/test.js0000644000175000017500000000407312452063163023102 0ustar gregoagregoa$(function(){ if ("WebSocket" in window) { ws = new WebSocket("ws://:/service"); } else { $("#content").text("This browser doesn't support WebSocket."); return; } if (ws) { ws.onmessage = function (ev) { try { var d = eval("("+ev.data+")"); var src = d.avator || ("http://www.gravatar.com/avatar/" + $.md5(d.ident || 'foo')); var name = d.name || d.ident || 'Anonymous'; var avatar = $('').attr('src', src).attr('alt', name); if (d.ident) { var link = d.ident.match(/https?:/) ? d.ident : 'mailto:' + d.ident; avatar = $('').attr('href', link).attr('target', '_blank').append(avatar); } avatar = $('').addClass('avatar').append(avatar); var message = $('').addClass('chat-message'); if (d.text) message.text(d.text); if (d.html) message.html(d.html); message.find('a').oembed(null, { embedMethod:"append", maxWidth:500 }); var name = d.name || (d.ident ? d.ident.split('@')[0] : null); if (name) message.prepend($('').addClass('name').text(name+': ')); var date = new Date(d.time * 1000); var meta = $('').addClass('meta').append( '(' + '' + date.toDateString() + '' + ' from ' + d.address + ')' ); $('.pretty-time', meta).prettyDate(); $('#messages').prepend($('').addClass('message').append(avatar).append(message).append(meta)); } catch(e) { if (console) console.log(e) } } } if ($.cookie(cookieName)) $('#ident').attr('value', $.cookie(cookieName)); window.setInterval(function(){ $(".pretty-time").prettyDate() }, 1000 * 30); }); twiggy-0.1025+dfsg.orig/eg/chat-websocket/chat.psgi0000755000175000017500000000611412452063163021373 0ustar gregoagregoa#!/usr/bin/env perl use strict; use warnings; use FindBin; use Pod::Usage; use AnyEvent::Socket; use AnyEvent::Handle; use Text::MicroTemplate::File; use Path::Class qw/file dir/; use JSON; use Plack::Request; use Plack::Builder; my $mtf = Text::MicroTemplate::File->new( include_path => ["templates"], ); my(@clients, %room); my $app = sub { my $env = shift; my $req = Plack::Request->new($env); my $res = $req->new_response(200); if ($req->path eq '/') { $res->content_type('text/html; charset=utf-8'); $res->content($mtf->render_file('index.mt')); } elsif ($req->path =~ m!^/chat!) { my $room = ($req->path =~ m!^/chat/(.+)!)[0]; my $host = $req->header('Host'); $res->content_type('text/html;charset=utf-8'); $res->content($mtf->render_file('room.mt', $host, $room)); } elsif ($req->path =~ m!^/ws!) { my $room = ($req->path =~ m!^/ws/(.+)!)[0]; unless ( $env->{HTTP_CONNECTION} eq 'Upgrade' and $env->{HTTP_UPGRADE} eq 'WebSocket') { $res->code(400); return $res->finalize; } return sub { my $respond = shift; # XXX: we could use $respond to send handshake response # headers, but 101 status message should be 'Web Socket # Protocol Handshake' rather than 'Switching Protocols' # and we should send HTTP/1.1 response which Twiggy # doesn't implement yet. my $hs = join "\015\012", "HTTP/1.1 101 Web Socket Protocol Handshake", "Upgrade: WebSocket", "Connection: Upgrade", "WebSocket-Origin: $env->{HTTP_ORIGIN}", "WebSocket-Location: ws://$env->{HTTP_HOST}$env->{SCRIPT_NAME}$env->{PATH_INFO}", '', ''; my $fh = $env->{'psgix.io'} or return $respond->([ 501, [ "Content-Type", "text/plain" ], [ "This server does not support psgix.io extension" ] ]); my $h = AnyEvent::Handle->new( fh => $fh ); $h->on_error(sub { warn 'err: ', $_[2]; delete $room{ $room }[fileno($fh)] if $room; undef $h; }); $h->push_write($hs); # connection ready $room{ $room }[ fileno($fh) ] = $h; $h->on_read(sub { shift->push_read( line => "\xff", sub { my ($h, $json) = @_; $json =~ s/^\0//; my $data = JSON::decode_json($json); $data->{address} = $req->address; $data->{time} = time; my $msg = JSON::encode_json($data); # broadcast for my $c (grep { defined } @{ $room{$room} || [] }) { $c->push_write("\x00" . $msg . "\xff"); } }); }); }; } else { $res->code(404); } $res->finalize; }; builder { enable "Static", path => sub { s!^/static/!! }, root => 'static'; $app; }; twiggy-0.1025+dfsg.orig/eg/chat-websocket/static/0000755000175000017500000000000012631023453021047 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/eg/chat-websocket/static/jquery.cookie.js0000644000175000017500000001022712452063163024201 0ustar gregoagregoa/** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); * @desc Create a cookie with all available options. * @example $.cookie('the_cookie', 'the_value'); * @desc Create a session cookie. * @example $.cookie('the_cookie', null); * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain * used when the cookie was set. * * @param String name The name of the cookie. * @param String value The value of the cookie. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. * If set to null or omitted, the cookie will be a session cookie and will not be retained * when the the browser exits. * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will * require a secure protocol (like HTTPS). * @type undefined * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ /** * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String name The name of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE } // CAUTION: Needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; twiggy-0.1025+dfsg.orig/eg/chat-websocket/static/Stream.js0000644000175000017500000002321112452063163022642 0ustar gregoagregoa/** * DUI.Stream: A JavaScript MXHR client * * Copyright (c) 2009, Digg, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the Digg, Inc. nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @module DUI.Stream * @author Micah Snyder * @author Jordan Alperin * @description A JavaScript MXHR client * @version 0.0.3 * @link http://github.com/digg/dui * */ (function($) { DUI.create('Stream', { pong: null, lastLength: 0, streams: [], listeners: {}, init: function() { }, load: function(url) { //These versions of XHR are known to work with MXHR try { this.req = new ActiveXObject('MSXML2.XMLHTTP.6.0'); } catch(nope) { try { this.req = new ActiveXObject('MSXML3.XMLHTTP'); } catch(nuhuh) { try { this.req = new XMLHttpRequest(); } catch(noway) { throw new Error('Could not find supported version of XMLHttpRequest.'); } } } //These versions don't support readyState == 3 header requests //try { this.req = new ActiveXObject('Microsoft.XMLHTTP'); } catch(err) {} //try { this.req = new ActiveXObject('MSXML2.XMLHTTP.3.0'); } catch(err) {} this.req.open('GET', url, true); var _this = this; this.req.onreadystatechange = function() { _this.readyStateNanny.apply(_this); } this.req.send(null); }, readyStateNanny: function() { if(this.req.readyState == 3 && this.pong == null) { var contentTypeHeader = this.req.getResponseHeader("Content-Type"); if(contentTypeHeader.indexOf("multipart/mixed") == -1) { this.req.onreadystatechange = function() { throw new Error('Send it as multipart/mixed, genius.'); this.req.onreadystatechange = function() {}; }.bind(this); } else { this.boundary = '--' + contentTypeHeader.split('"')[1]; //Start pinging this.pong = window.setInterval(this.ping.bind(this), 15); } } if(this.req.readyState == 4) { //var contentTypeHeader = this.req.getResponseHeader("Content-Type"); //Stop the insanity! clearInterval(this.pong); //One last ping to clean up this.ping(); if(typeof this.listeners.complete != 'undefined') { var _this = this; $.each(this.listeners.complete, function() { this.apply(_this); }); } } }, ping: function() { var length = this.req.responseText.length; var packet = this.req.responseText.substring(this.lastLength, length); this.processPacket(packet); this.lastLength = length; }, processPacket: function(packet) { if(packet.length < 1) return; //I don't know if we can count on this, but it's fast as hell var startFlag = packet.indexOf(this.boundary); var endFlag = -1; //Is there a startFlag? if(startFlag > -1) { if(typeof this.currentStream != 'undefined') { //If there's an open stream, that's an endFlag, not a startFlag endFlag = startFlag; startFlag = -1; } else { //No open stream? Ok, valid startFlag. Let's try find an endFlag then. endFlag = packet.indexOf(this.boundary, startFlag + this.boundary.length); } } //No stream is open if(typeof this.currentStream == 'undefined') { //Open a stream this.currentStream = ''; //Is there a start flag? if(startFlag > -1) { //Yes //Is there an end flag? if(endFlag > -1) { //Yes //Use the end flag to grab the entire payload in one swoop var payload = packet.substring(startFlag, endFlag); this.currentStream += payload; //Remove the payload from this chunk packet = packet.replace(payload, ''); this.closeCurrentStream(); //Start over on the remainder of this packet this.processPacket(packet); } else { //No //Grab from the start of the start flag to the end of the chunk this.currentStream += packet.substr(startFlag); //Leave this.currentStream set and wait for another packet } } else { //WTF? No open stream and no start flag means someone fucked up the output //...OR maybe they're sending garbage in front of their first payload. Weird. //I guess just ignore it for now? } //Else we have an open stream } else { //Is there an end flag? if(endFlag > -1) { //Yes //Use the end flag to grab the rest of the payload var chunk = packet.substring(0, endFlag); this.currentStream += chunk; //Remove the rest of the payload from this chunk packet = packet.replace(chunk, ''); this.closeCurrentStream(); //Start over on the remainder of this packet this.processPacket(packet); } else { //No //Put this whole packet into this.currentStream this.currentStream += packet; //Wait for another packet... } } }, closeCurrentStream: function() { //Write stream. Not sure if we need this //this.streams.push(this.currentStream); //Get mimetype //First, ditch the boundary this.currentStream = this.currentStream.replace(this.boundary + "\n", ''); /* The mimetype is the first line after the boundary. Note that RFC 2046 says that there's either a mimetype here or a blank line to default to text/plain, so if the payload starts on the line after the boundary, we'll intentionally ditch that line because it doesn't conform to the spec. QQ more noob, L2play, etc. */ var mimeAndPayload = this.currentStream.split("\n"); var mime = mimeAndPayload.shift().split('Content-Type:', 2)[1].split(";", 1)[0].replace(' ', ''); //Better to have this null than undefined mime = mime ? mime : null; //Get payload var payload = mimeAndPayload.join("\n"); //Try to fire the listeners for this mimetype var _this = this; if(typeof this.listeners[mime] != 'undefined') { $.each(this.listeners[mime], function() { this.apply(_this, [payload]); }); } //Set this.currentStream = null delete this.currentStream; }, listen: function(mime, callback) { if(typeof this.listeners[mime] == 'undefined') { this.listeners[mime] = []; } if(typeof callback != 'undefined' && callback.constructor == Function) { this.listeners[mime].push(callback); } } }); })(jQuery); //Yep, I still use this. So what? You wanna fight about it? Function.prototype.bind = function() { var __method = this, object = arguments[0], args = []; for(i = 1; i < arguments.length; i++) args.push(arguments[i]); return function() { return __method.apply(object, args); } } /* GLOSSARY packet: the amount of data sent in one ping interval payload: an entire piece of content, contained between multipart boundaries stream: the data sent between opening and closing an XHR. depending on how you implement MHXR, that could be a while. */ twiggy-0.1025+dfsg.orig/eg/chat-websocket/static/DUI.js0000644000175000017500000003210712452063163022034 0ustar gregoagregoa/** * DUI: The Digg User Interface Library * * Copyright (c) 2008-2009, Digg, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - Neither the name of the Digg, Inc. nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @module DUI * @author Micah Snyder * @description The Digg User Interface Library * @version 0.0.5 * @link http://code.google.com/p/digg * */ /* Add Array.prototype.indexOf -- Guess which major browser doesn't support it natively yet? */ [].indexOf || (Array.prototype.indexOf = function(v, n){ n = (n == null) ? 0 : n; var m = this.length; for(var i = n; i < m; i++) { if(this[i] == v) return i; } return -1; }); (function($) { /* Create our top-level namespace */ DUI = {}; /** * @class Class Class creation and management for use with jQuery. Class is a singleton that handles static and dynamic classes, as well as namespaces */ DUI.Class = { /** * @var {Array} _dontEnum Internal array of keys to omit when looking through a class' properties. Once the real DontEnum bit is writable we won't have to deal with this. */ _dontEnum: ['_ident', '_dontEnum', 'create', 'namespace', 'ns', 'supers', 'sup', 'init', 'each'], /** * @function create Make a class! Do work son, do work * @param {optional Object} methods Any number of objects can be passed in as arguments to be added to the class upon creation * @param {optional Boolean} static If the last argument is Boolean, it will be treated as the static flag. Defaults to false (dynamic) */ create: function() { //Set _this to DUI.Class var _this = this; //Figure out if we're creating a static or dynamic class var s = (arguments.length > 0 && //if we have arguments... arguments[arguments.length - 1].constructor == Boolean) ? //...and the last one is Boolean... arguments[arguments.length - 1] : //...then it's the static flag... false; //...otherwise default to a dynamic class //Static: Object, dynamic: Function var c = s ? {} : function() { this.init.apply(this, arguments); } //All of our classes have these in common var methods = { _ident: { library: "DUI.Class", version: "0.0.5", dynamic: true }, //_dontEnum should exist in our classes as well _dontEnum: this._dontEnum, //A basic namespace container to pass objects through ns: [], //A container to hold one level of overwritten methods supers: {}, //A constructor init: function() {}, //Our namespace function namespace:function(ns) { //Don't add nothing if (!ns) return null; //Set _this to the current class, not the DUI.Class lib itself var _this = this; //Handle ['ns1', 'ns2'... 'nsN'] format if(ns.constructor == Array) { //Call namespace normally for each array item... $.each(ns, function() { _this.namespace.apply(_this, [this]); }); //...then get out of this call to namespace return; //Handle {'ns': contents} format } else if(ns.constructor == Object) { //Loop through the object passed to namespace for(var key in ns) { //Only operate on Objects and Functions if([Object, Function].indexOf(ns[key].constructor) > -1) { //In case this.ns has been deleted if(!this.ns) this.ns = []; //Copy the namespace into an array holder this.ns[key] = ns[key]; //Apply namespace, this will be caught by the ['ns1', 'ns2'... 'nsN'] format above this.namespace.apply(this, [key]); } } //We're done with namespace for now return; } //Note: [{'ns': contents}, {'ns2': contents2}... {'nsN': contentsN}] is inherently handled by the above two cases var levels = ns.split("."); /* Dynamic classes are Functions, so we'll extend their prototype. Static classes are Objects, so we'll extend them directly */ var nsobj = this.prototype ? this.prototype : this; $.each(levels, function() { /* When adding a namespace check to see, in order: * 1) Does the ns exist in our ns passthrough object? * 2) Does the ns already exist in our class * 3) Does the ns exist as a global var? * NOTE: Support for this was added so that you can namespace classes * into other classes, i.e. MyContainer.namespace('MyUtilClass'). this * behaviour is dangerously greedy though, so it may be removed. * 4) If none of the above, make a new static class */ nsobj[this] = _this.ns[this] || nsobj[this] || window[this] || DUI.Class.create(true); /* If our parent and child are both dynamic classes, copy the child out of Parent.prototype and into Parent. * It seems weird at first, but this allows you to instantiate a dynamic sub-class without instantiating * its parent, e.g. var baz = new Foo.Bar(); */ if(_this.prototype && DUI.isClass(nsobj[this]) && nsobj[this].prototype) { _this[this] = nsobj[this]; } //Remove our temp passthrough if it exists delete _this.ns[this]; //Move one level deeper for the next iteration nsobj = nsobj[this]; }); //TODO: Do we really need to return this? It's not that useful anymore return nsobj; }, /* Create exists inside classes too. neat huh? * Usage differs slightly: MyClass.create('MySubClass', { myMethod: function() }); */ create: function() { //Turn arguments into a regular Array var args = Array.prototype.slice.call(arguments); //Pull the name of the new class out var name = args.shift(); //Create a new class with the rest of the arguments var temp = DUI.Class.create.apply(DUI.Class, args); //Load our new class into the {name: class} format to pass it into namespace() var ns = {}; ns[name] = temp; //Put the new class into the current one this.namespace(ns); }, //Iterate over a class' members, omitting built-ins each: function(cb) { if(!$.isFunction(cb)) { throw new Error('DUI.Class.each must be called with a function as its first argument.'); } //Set _this to the current class, not the DUI.Class lib itself var _this = this; $.each(this, function(key) { if(_this._dontEnum.indexOf(key) != -1) return; cb.apply(this, [key, this]); }); }, //Call the super of a method sup: function() { try { var caller = this.sup.caller.name; this.supers[caller].apply(this, arguments); } catch(noSuper) { return false; } } } //Static classes don't need a constructor s ? delete methods.init : null; //...nor should they be identified as dynamic classes s ? methods._ident.dynamic = false : null; /* Put default methods into the class before anything else, * so that they'll be overwritten by the user-specified ones */ $.extend(c, methods); /* Second copy of methods for dynamic classes: They get our * common utils in their class definition AND their prototype */ if(!s) $.extend(c.prototype, methods); //Static: extend the Object, Dynamic: extend the prototype var extendee = s ? c : c.prototype; //Loop through arguments. If they're the right type, tack them on $.each(arguments, function() { //Either we're passing in an object full of methods, or the prototype of an existing class if(this.constructor == Object || typeof this.init != undefined) { /* Here we're going per-property instead of doing $.extend(extendee, this) so that * we overwrite each property instead of the whole namespace. Also: we omit the 'namespace' * helper method that DUI.Class tacks on, as there's no point in storing it as a super */ for(i in this) { /* If a property is a function (other than our built-in helpers) and it already exists * in the class, save it as a super. note that this only saves the last occurrence */ if($.isFunction(extendee[i]) && _this._dontEnum.indexOf(i) == -1) { //since Function.name is almost never set for us, do it manually this[i].name = extendee[i].name = i; //throw the existing function into this.supers before it's overwritten extendee.supers[i] = extendee[i]; } //Special case! If 'dontEnum' is passed in as an array, add its contents to DUI.Class._dontEnum if(i == 'dontEnum' && this[i].constructor == Array) { extendee._dontEnum = $.merge(extendee._dontEnum, this[i]); } //extend the current property into our class extendee[i] = this[i]; } } }); //Shiny new class, ready to go return c; } }; /* Turn DUI into a static class whose contents are DUI. Now you can use DUI's tools on DUI itself, i.e. DUI.create('Foo'); I'm pretty sure this won't melt the known universe, but caveat emptor. */ DUI = DUI.Class.create(DUI, true); })(jQuery); //Simple check so see if the object passed in is a DUI Class DUI.isClass = function(check, type) { type = type || false; try { if(check._ident.library == 'DUI.Class') { if((type == 'dynamic' && !check._ident.dynamic) || (type == 'static' && check._ident.dynamic)) { return false; } return true; } } catch(noIdentUhOh) { return false; } return false; } twiggy-0.1025+dfsg.orig/eg/chat-websocket/static/jquery.md5.js0000644000175000017500000002211012452063163023407 0ustar gregoagregoa /** * jQuery MD5 hash algorithm function * * * Calculate the md5 hash of a String * String $.md5 ( String str ) * * * Calculates the MD5 hash of str using the » RSA Data Security, Inc. MD5 Message-Digest Algorithm, and returns that hash. * MD5 (Message-Digest algorithm 5) is a widely-used cryptographic hash function with a 128-bit hash value. MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of data. The generated hash is also non-reversable. Data cannot be retrieved from the message digest, the digest uniquely identifies the data. * MD5 was developed by Professor Ronald L. Rivest in 1994. Its 128 bit (16 byte) message digest makes it a faster implementation than SHA-1. * This script is used to process a variable length message into a fixed-length output of 128 bits using the MD5 algorithm. It is fully compatible with UTF-8 encoding. It is very useful when u want to transfer encrypted passwords over the internet. If you plan using UTF-8 encoding in your project don't forget to set the page encoding to UTF-8 (Content-Type meta tag). * This function orginally get from the WebToolkit and rewrite for using as the jQuery plugin. * * Example * Code * * $.md5("I'm Persian."); * * Result * * "b8c901d0f02223f9761016cfff9d68df" * * * @alias Muhammad Hussein Fattahizadeh < muhammad [AT] semnanweb [DOT] com > * @link http://www.semnanweb.com/jquery-plugin/md5.html * @see http://www.webtoolkit.info/ * @license http://www.gnu.org/licenses/gpl.html [GNU General Public License] * @param {jQuery} {md5:function(string)) * @return string */ (function($){ var rotateLeft = function(lValue, iShiftBits) { return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)); } var addUnsigned = function(lX, lY) { var lX4, lY4, lX8, lY8, lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (lX & 0x40000000); lY4 = (lY & 0x40000000); lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF); if (lX4 & lY4) return (lResult ^ 0x80000000 ^ lX8 ^ lY8); if (lX4 | lY4) { if (lResult & 0x40000000) return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); else return (lResult ^ 0x40000000 ^ lX8 ^ lY8); } else { return (lResult ^ lX8 ^ lY8); } } var F = function(x, y, z) { return (x & y) | ((~ x) & z); } var G = function(x, y, z) { return (x & z) | (y & (~ z)); } var H = function(x, y, z) { return (x ^ y ^ z); } var I = function(x, y, z) { return (y ^ (x | (~ z))); } var FF = function(a, b, c, d, x, s, ac) { a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac)); return addUnsigned(rotateLeft(a, s), b); }; var GG = function(a, b, c, d, x, s, ac) { a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac)); return addUnsigned(rotateLeft(a, s), b); }; var HH = function(a, b, c, d, x, s, ac) { a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac)); return addUnsigned(rotateLeft(a, s), b); }; var II = function(a, b, c, d, x, s, ac) { a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac)); return addUnsigned(rotateLeft(a, s), b); }; var convertToWordArray = function(string) { var lWordCount; var lMessageLength = string.length; var lNumberOfWordsTempOne = lMessageLength + 8; var lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64; var lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16; var lWordArray = Array(lNumberOfWords - 1); var lBytePosition = 0; var lByteCount = 0; while (lByteCount < lMessageLength) { lWordCount = (lByteCount - (lByteCount % 4)) / 4; lBytePosition = (lByteCount % 4) * 8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition)); lByteCount++; } lWordCount = (lByteCount - (lByteCount % 4)) / 4; lBytePosition = (lByteCount % 4) * 8; lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition); lWordArray[lNumberOfWords - 2] = lMessageLength << 3; lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; return lWordArray; }; var wordToHex = function(lValue) { var WordToHexValue = "", WordToHexValueTemp = "", lByte, lCount; for (lCount = 0; lCount <= 3; lCount++) { lByte = (lValue >>> (lCount * 8)) & 255; WordToHexValueTemp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValueTemp.substr(WordToHexValueTemp.length - 2, 2); } return WordToHexValue; }; var uTF8Encode = function(string) { string = string.replace(/\x0d\x0a/g, "\x0a"); var output = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { output += String.fromCharCode(c); } else if ((c > 127) && (c < 2048)) { output += String.fromCharCode((c >> 6) | 192); output += String.fromCharCode((c & 63) | 128); } else { output += String.fromCharCode((c >> 12) | 224); output += String.fromCharCode(((c >> 6) & 63) | 128); output += String.fromCharCode((c & 63) | 128); } } return output; }; $.extend({ md5: function(string) { var x = Array(); var k, AA, BB, CC, DD, a, b, c, d; var S11=7, S12=12, S13=17, S14=22; var S21=5, S22=9 , S23=14, S24=20; var S31=4, S32=11, S33=16, S34=23; var S41=6, S42=10, S43=15, S44=21; string = uTF8Encode(string); x = convertToWordArray(string); a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; for (k = 0; k < x.length; k += 16) { AA = a; BB = b; CC = c; DD = d; a = FF(a, b, c, d, x[k+0], S11, 0xD76AA478); d = FF(d, a, b, c, x[k+1], S12, 0xE8C7B756); c = FF(c, d, a, b, x[k+2], S13, 0x242070DB); b = FF(b, c, d, a, x[k+3], S14, 0xC1BDCEEE); a = FF(a, b, c, d, x[k+4], S11, 0xF57C0FAF); d = FF(d, a, b, c, x[k+5], S12, 0x4787C62A); c = FF(c, d, a, b, x[k+6], S13, 0xA8304613); b = FF(b, c, d, a, x[k+7], S14, 0xFD469501); a = FF(a, b, c, d, x[k+8], S11, 0x698098D8); d = FF(d, a, b, c, x[k+9], S12, 0x8B44F7AF); c = FF(c, d, a, b, x[k+10], S13, 0xFFFF5BB1); b = FF(b, c, d, a, x[k+11], S14, 0x895CD7BE); a = FF(a, b, c, d, x[k+12], S11, 0x6B901122); d = FF(d, a, b, c, x[k+13], S12, 0xFD987193); c = FF(c, d, a, b, x[k+14], S13, 0xA679438E); b = FF(b, c, d, a, x[k+15], S14, 0x49B40821); a = GG(a, b, c, d, x[k+1], S21, 0xF61E2562); d = GG(d, a, b, c, x[k+6], S22, 0xC040B340); c = GG(c, d, a, b, x[k+11], S23, 0x265E5A51); b = GG(b, c, d, a, x[k+0], S24, 0xE9B6C7AA); a = GG(a, b, c, d, x[k+5], S21, 0xD62F105D); d = GG(d, a, b, c, x[k+10], S22, 0x2441453); c = GG(c, d, a, b, x[k+15], S23, 0xD8A1E681); b = GG(b, c, d, a, x[k+4], S24, 0xE7D3FBC8); a = GG(a, b, c, d, x[k+9], S21, 0x21E1CDE6); d = GG(d, a, b, c, x[k+14], S22, 0xC33707D6); c = GG(c, d, a, b, x[k+3], S23, 0xF4D50D87); b = GG(b, c, d, a, x[k+8], S24, 0x455A14ED); a = GG(a, b, c, d, x[k+13], S21, 0xA9E3E905); d = GG(d, a, b, c, x[k+2], S22, 0xFCEFA3F8); c = GG(c, d, a, b, x[k+7], S23, 0x676F02D9); b = GG(b, c, d, a, x[k+12], S24, 0x8D2A4C8A); a = HH(a, b, c, d, x[k+5], S31, 0xFFFA3942); d = HH(d, a, b, c, x[k+8], S32, 0x8771F681); c = HH(c, d, a, b, x[k+11], S33, 0x6D9D6122); b = HH(b, c, d, a, x[k+14], S34, 0xFDE5380C); a = HH(a, b, c, d, x[k+1], S31, 0xA4BEEA44); d = HH(d, a, b, c, x[k+4], S32, 0x4BDECFA9); c = HH(c, d, a, b, x[k+7], S33, 0xF6BB4B60); b = HH(b, c, d, a, x[k+10], S34, 0xBEBFBC70); a = HH(a, b, c, d, x[k+13], S31, 0x289B7EC6); d = HH(d, a, b, c, x[k+0], S32, 0xEAA127FA); c = HH(c, d, a, b, x[k+3], S33, 0xD4EF3085); b = HH(b, c, d, a, x[k+6], S34, 0x4881D05); a = HH(a, b, c, d, x[k+9], S31, 0xD9D4D039); d = HH(d, a, b, c, x[k+12], S32, 0xE6DB99E5); c = HH(c, d, a, b, x[k+15], S33, 0x1FA27CF8); b = HH(b, c, d, a, x[k+2], S34, 0xC4AC5665); a = II(a, b, c, d, x[k+0], S41, 0xF4292244); d = II(d, a, b, c, x[k+7], S42, 0x432AFF97); c = II(c, d, a, b, x[k+14], S43, 0xAB9423A7); b = II(b, c, d, a, x[k+5], S44, 0xFC93A039); a = II(a, b, c, d, x[k+12], S41, 0x655B59C3); d = II(d, a, b, c, x[k+3], S42, 0x8F0CCC92); c = II(c, d, a, b, x[k+10], S43, 0xFFEFF47D); b = II(b, c, d, a, x[k+1], S44, 0x85845DD1); a = II(a, b, c, d, x[k+8], S41, 0x6FA87E4F); d = II(d, a, b, c, x[k+15], S42, 0xFE2CE6E0); c = II(c, d, a, b, x[k+6], S43, 0xA3014314); b = II(b, c, d, a, x[k+13], S44, 0x4E0811A1); a = II(a, b, c, d, x[k+4], S41, 0xF7537E82); d = II(d, a, b, c, x[k+11], S42, 0xBD3AF235); c = II(c, d, a, b, x[k+2], S43, 0x2AD7D2BB); b = II(b, c, d, a, x[k+9], S44, 0xEB86D391); a = addUnsigned(a, AA); b = addUnsigned(b, BB); c = addUnsigned(c, CC); d = addUnsigned(d, DD); } var tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d); return tempValue.toLowerCase(); } }); })(jQuery); twiggy-0.1025+dfsg.orig/eg/chat-websocket/static/jquery-1.3.2.min.js0000644000175000017500000015764712452063163024174 0ustar gregoagregoa/* * jQuery JavaScript Library v1.3.2 * http://jquery.com/ * * Copyright (c) 2009 John Resig * Dual licensed under the MIT and GPL licenses. * http://docs.jquery.com/License * * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) * Revision: 6246 */ (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); /* * Sizzle CSS Selector Engine - v0.9.3 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="
";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); twiggy-0.1025+dfsg.orig/eg/chat-websocket/static/pretty.js0000644000175000017500000000222512452063163022740 0ustar gregoagregoa/* * JavaScript Pretty Date * Copyright (c) 2008 John Resig (jquery.com) * Licensed under the MIT license. */ // Takes an ISO time and returns a string representing how // long ago the date represents. function prettyDate(time){ var date = new Date(time); // (time || "").replace(/-/g,"/").replace(/[TZ]/g," ")), diff = (((new Date()).getTime() - date.getTime()) / 1000), day_diff = Math.floor(diff / 86400); if ( isNaN(day_diff) || day_diff < 0 || day_diff >= 31 ) return; return day_diff == 0 && ( diff < 60 && "just now" || diff < 120 && "1 minute ago" || diff < 3600 && Math.floor( diff / 60 ) + " minutes ago" || diff < 7200 && "1 hour ago" || diff < 86400 && Math.floor( diff / 3600 ) + " hours ago") || day_diff == 1 && "Yesterday" || day_diff < 7 && day_diff + " days ago" || day_diff < 31 && Math.ceil( day_diff / 7 ) + " weeks ago"; } // If jQuery is included in the page, adds a jQuery plugin to handle it as well if ( typeof jQuery != "undefined" ) jQuery.fn.prettyDate = function(){ return this.each(function(){ var date = prettyDate(this.title); if ( date ) jQuery(this).text( date ); }); }; twiggy-0.1025+dfsg.orig/t/0000755000175000017500000000000012452063163014530 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/t/anyevent_closed_connection.t0000644000175000017500000000342012452063163022315 0ustar gregoagregoause strict; use warnings; use Test::More qw(no_diag); use Test::TCP; use IO::Socket::INET; use Plack::Loader; use AnyEvent::Handle; my $app = sub { my $env = shift; return sub { my ($responder, $sock) = @_; my $disconnected = AE::cv; # Write response after client disconnection my $handle = AnyEvent::Handle->new( fh => $sock, on_read => sub {}, on_eof => sub { $disconnected->send; }, on_error => sub {}, ); $disconnected->cb(sub { undef $disconnected; undef $handle; shift->recv; $responder->([ 200, [ 'Content-Type' => 'text/plain', 'X_FOO' => "a" x 1_000_000 ], # Write large header to force EPIPE [ 'hello' ] ]); }); } }; my $server = Test::TCP->new( code => sub { my $port = shift; my $server = Plack::Loader->load("Twiggy", port => $port, host => "127.0.0.1"); $server->run($app); exit; # Suppress Test::TCP "child process does not block" warning }, auto_start => 1, ); request($server->port); kill 'QUIT' => $server->pid; my $hanged = 0; local $SIG{ALRM} = sub { $hanged = 1; kill 'TERM' => $server->pid; }; alarm(5); waitpid($server->pid, 0); alarm(0); is $hanged, 0, "server should shut down"; done_testing(); sub request { my $port = shift; my $sock = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => '127.0.0.1', PeerPort => $port, ) or die "Cannot open client socket: $!"; $sock->autoflush; my $req = <<_END_; GET / HTTP/1.0 Host: localhost:$port User-Agent: hogehoge _END_ $req =~ s/\n/\r\n/g; $sock->print($req); $sock->close; } twiggy-0.1025+dfsg.orig/t/release-pod-syntax.t0000644000175000017500000000045612452063163020446 0ustar gregoagregoa#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; use Test::Pod 1.41; all_pod_files_ok(); twiggy-0.1025+dfsg.orig/t/anyevent_manyconnections.t0000644000175000017500000000253512452063163022042 0ustar gregoagregoause strict; use warnings; use Test::More; BEGIN { plan skip_all => 'Slow test skipped unless $ENV{TEST_SLOW} is set' unless $ENV{TEST_SLOW}; } use Plack::Test::Suite; use AnyEvent; use HTTP::Request; use HTTP::Request::Common; my $LOOPS = 1024; # Default max fds on linux. sub gentest { my $name = shift; return ($name, sub { my $cb = shift; for (1..$LOOPS) { alarm 2; local $SIG{ALRM} = sub { fail("Timed out"); exit; }; my $res = $cb->(GET "http://127.0.0.1/"); is $res->code, 200, "$name $_ of $LOOPS"; alarm 0; } }); } local @Plack::Test::Suite::TEST = ( [ gentest('BadResponse'), sub { return [ 200, [ 'Content-Type' => 'text/plain', ], 'Hello' ]; }, ], [ gentest('GoodResponse'), sub { return [ 200, [ 'Content-Type' => 'text/plain', ], ['Hello'] ]; }, ], ); # prevent Lint middleware from being used Plack::Test::Suite->run_server_tests(sub { my($port, $app) = @_; my $server = Plack::Loader->load("Twiggy", port => $port, host => "127.0.0.1"); $server->run($app); }); done_testing(); twiggy-0.1025+dfsg.orig/t/00_compile.t0000644000175000017500000000010212452063163016635 0ustar gregoagregoause strict; use Test::More tests => 1; BEGIN { use_ok 'Twiggy' } twiggy-0.1025+dfsg.orig/t/disconnect.t0000644000175000017500000000301212452063163017042 0ustar gregoagregoause strict; use warnings; use Test::More qw(no_diag); use Test::TCP; use IO::Socket::INET; use Plack::Loader; use Plack::Request; use HTTP::Response; my $app = sub { my $env = shift; my $req = Plack::Request->new($env); my $params = $req->parameters; return [ 200, [ 'Content-Type' => 'text/plain', ], [ $params->{q} ], ]; }; # test that client disconnection doesn't trigger 400 response test_tcp( client => sub { my $port = shift; # empty request my $sock = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => '127.0.0.1', PeerPort => $port, ) or die "Cannot open client socket: $!"; $sock->shutdown(1); my $data = join('', <$sock>); $sock->close; is($data, '', 'got empty response to empty request') or note explain $data; # incomplete headers $sock = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => '127.0.0.1', PeerPort => $port, ) or die "Cannot open client socket: $!"; print $sock "GET / HTTP/1.0"; # no CRLF $sock->shutdown(1); $data = join('', <$sock>); $sock->close; is($data, '', 'got empty response to incomplete header request') or note explain $data; }, server => sub { my $port = shift; my $server = Plack::Loader->load('Twiggy', port => $port, host => '127.0.0.1'); $server->run($app); }, ); done_testing(); twiggy-0.1025+dfsg.orig/t/anyevent_slow_post.t0000644000175000017500000000314712452063163020664 0ustar gregoagregoause strict; use warnings; use Test::More qw(no_diag); use Test::TCP; use IO::Socket::INET; use Plack::Loader; use Plack::Request; use HTTP::Response; my $app = sub { my $env = shift; my $req = Plack::Request->new($env); my $params = $req->parameters; return [ 200, [ 'Content-Type' => 'text/plain', ], [ $params->{q} ], ]; }; test_tcp( client => sub { my $port = shift; my @bytes_list = (100, 10_000, 1_000_000); foreach my $bytes (@bytes_list) { post_request($port, $bytes, 0); } foreach my $bytes (@bytes_list) { post_request($port, $bytes, 0.1); } }, server => sub { my $port = shift; my $server = Plack::Loader->load('Twiggy', port => $port, host => '127.0.0.1'); $server->run($app); }, ); done_testing(); sub post_request { my ($port, $bytes, $wait) = @_; my $sock = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => '127.0.0.1', PeerPort => $port, ) or die "Cannot open client socket: $!"; $sock->autoflush; my $post_body = 'q=' . 'x' x $bytes; my $req = <<_END_; POST / HTTP/1.0 Host: localhost:$port User-Agent: hogehoge Content-Type: application/x-www-form-urlencoded Content-Length: @{[ length $post_body ]} _END_ $req =~ s/\n/\r\n/g; $sock->print($req); select(undef, undef, undef, $wait) if $wait; $sock->print($post_body); my $res = HTTP::Response->parse(join('', <$sock>)); $sock->close; is $res->code, 200, "bytes=$bytes, wait=$wait"; is $res->content, 'x' x $bytes; } twiggy-0.1025+dfsg.orig/t/anyevent.t0000644000175000017500000000031612452063163016546 0ustar gregoagregoause strict; use warnings; use FindBin; use Test::More; use Test::Requires qw(AnyEvent HTTP::Parser::XS); use Plack; use Plack::Test::Suite; Plack::Test::Suite->run_server_tests('Twiggy'); done_testing(); twiggy-0.1025+dfsg.orig/t/anyevent_extensions.t0000644000175000017500000000333412452063163021030 0ustar gregoagregoause strict; use warnings; use Test::More; use Plack::Test::Suite; use AnyEvent; use HTTP::Request; use HTTP::Request::Common; local @Plack::Test::Suite::TEST = ( [ 'coderef res', sub { my $cb = shift; my $res = $cb->(GET "http://127.0.0.1/?name=miyagawa"); is $res->code, 200; is $res->header('content_type'), 'text/plain'; is $res->content, 'Hello, name=miyagawa'; }, sub { my $env = shift; return sub { my ( $write, $sock ) = @_; $write->([ 200, [ 'Content-Type' => 'text/plain', ], [ 'Hello, ' . $env->{QUERY_STRING} ], ]); } }, ], [ 'coderef streaming', sub { my $cb = shift; my $res = $cb->(GET "http://127.0.0.1/?name=miyagawa"); is $res->code, 200; is $res->header('content_type'), 'text/plain'; is $res->content, 'Hello, name=miyagawa'; }, sub { my $env = shift; return sub { my ( $write, $sock ) = @_; my $writer = $write->([ 200, [ 'Content-Type' => 'text/plain', ], ]); $writer->write("Hello, "); $writer->write($env->{QUERY_STRING}); $writer->close(); } }, ], ); # prevent Lint middleware from being used Plack::Test::Suite->run_server_tests(sub { my($port, $app) = @_; my $server = Plack::Loader->load("Twiggy", port => $port, host => "127.0.0.1"); $server->run($app); }); done_testing(); twiggy-0.1025+dfsg.orig/t/deflater.t0000644000175000017500000000235712452063163016512 0ustar gregoagregoause strict; use warnings; use Test::More qw(no_diag); use Test::Requires qw( Plack::Middleware::Deflater LWP::UserAgent IO::Uncompress::Gunzip ); use Test::TCP; use Plack::Loader; use Plack::Request; use HTTP::Response; use IO::Uncompress::Gunzip qw(gunzip $GunzipError); use Plack::App::File; use HTTP::Request::Common; my $app = Plack::App::File->new( root => 't')->to_app; $app = Plack::Middleware::Deflater->wrap($app); open my $f, '>', "t/deflater_test.txt" or die $!; print $f '1234567890' x 1000; close $f; END { unlink('t/deflater_test.txt') } test_tcp( client => sub { my $port = shift; my $ua = LWP::UserAgent->new; $ua->timeout(2); my $req = GET ("http://localhost:$port/deflater_test.txt"); $req->header('Accept-Encoding', 'gzip'); my $res = $ua->request($req); if ($res->is_success) { gunzip \$res->content => \(my $output) or die "gunzip failed: $GunzipError\n"; is(length($output), 10000); } else { ok(0); } }, server => sub { my $port = shift; my $server = Plack::Loader->load('Twiggy', port => $port, host => '127.0.0.1'); $server->run($app); }, ); done_testing(); twiggy-0.1025+dfsg.orig/t/anyevent_closed_streaming.t0000644000175000017500000000372112452063163022153 0ustar gregoagregoause strict; use warnings; use Test::Requires qw(AnyEvent::HTTP); use AnyEvent::HTTP; use Test::More; use Test::TCP; use Plack::Loader; use POSIX (); use Time::HiRes qw(usleep); sub do_streaming_request { my ( $url, $callback ) = @_; local $Test::Builder::Level = $Test::Builder::Level + 1; my $cond = AnyEvent->condvar; http_get $url, timeout => 3, want_body_handle => 1, sub { my ( $h, $headers ) = @_; is $headers->{'Status'}, 200, 'streaming response should succeed'; $h->on_read(sub { $h->push_read(line => sub { my ( undef, $line ) = @_; my $stop = $callback->($line, $cond); if($stop) { $h->destroy; $cond->send; } }); }); $h->on_error(sub { my ( undef, undef, $error ) = @_; fail "Unexpected error: $error"; $h->destroy; $cond->send; }); $h->on_eof(sub { $h->destroy; $cond->send; }); }; $cond->recv; } my $app = sub { my ( $env ) = @_; return sub { my ( $respond ) = @_; my $writer = $respond->( [200, ['Content-Type', 'text/plain'] ] ); foreach my $number ( 1 .. 10 ) { $writer->write($number . "\n"); usleep 100_000; } }; }; my $server = Test::TCP->new( code => sub { my ( $port ) = @_; my $server = Plack::Loader->load('Twiggy', port => $port, host => '127.0.0.1'); $server->run($app); exit; }, ); do_streaming_request('http://127.0.0.1:' . $server->port, sub { my ( $line, $cond ) = @_; if($line == 5) { return 1; } return; }); sleep 1; # give the process a bit to clean up, if it died my $kid = waitpid $server->pid, POSIX::WNOHANG; ok $kid != $server->pid, 'Server should stay alive after a single client breaks it connection'; done_testing(); twiggy-0.1025+dfsg.orig/t/anyevent_server_starter.t0000644000175000017500000000140012452063163021673 0ustar gregoagregoause strict; use Test::More; use Test::Requires qw(Server::Starter LWP::UserAgent); use Test::TCP; use LWP::UserAgent; use Server::Starter qw(start_server); test_tcp( server => sub { my $port = shift; start_server( exec => [ $^X, '-Mblib', '-MPlack::Loader', '-e', q|Plack::Loader->load('Twiggy', host => '127.0.0.1')->run(sub { [ '200', ['Content-Type' => 'text/plain'], [ 'Hello, Twiggy!' ] ] })| ], port => [ $port ] ); exit 1; }, client => sub { my $port = shift; my $ua = LWP::UserAgent->new(); my $res = $ua->get("http://127.0.0.1:$port/"); ok $res->is_success, "request ok"; is $res->content, "Hello, Twiggy!"; } ); done_testing; twiggy-0.1025+dfsg.orig/lib/0000755000175000017500000000000012631023453015030 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/lib/Plack/0000755000175000017500000000000012631023453016062 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/lib/Plack/Handler/0000755000175000017500000000000012452063163017442 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/lib/Plack/Handler/Twiggy.pm0000644000175000017500000000117112452063163021252 0ustar gregoagregoapackage Plack::Handler::Twiggy; use strict; sub new { my $class = shift; bless {@_}, $class; } sub run { my ($self, $app) = @_; my $class = $ENV{SERVER_STARTER_PORT} ? 'Twiggy::Server::SS' : 'Twiggy::Server'; eval "require $class"; die if $@; $class->new(%{$self})->run($app); } 1; __END__ =head1 NAME Plack::Handler::Twiggy - Adapter for Twiggy =head1 SYNOPSIS plackup -s Twiggy --port 9090 # with start_server start_server --port=9090 plackup -s Twiggy =head1 DESCRIPTION This is an adapter to run PSGI apps on Twiggy via L. =head1 SEE ALSO L =cut twiggy-0.1025+dfsg.orig/lib/Twiggy/0000755000175000017500000000000012631023453016302 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/lib/Twiggy/Server/0000755000175000017500000000000012631023453017550 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/lib/Twiggy/Server/SS.pm0000644000175000017500000000501012452063163020432 0ustar gregoagregoapackage Twiggy::Server::SS; use strict; use warnings; use base qw(Twiggy::Server); use AnyEvent; use AnyEvent::Util qw(fh_nonblocking guard); use AnyEvent::Socket qw(format_address); use Server::Starter qw(server_ports); sub start_listen { my ($self, $app) = @_; if (Twiggy::Server::DEBUG() && $self->{listen}) { warn "'listen' option is currently ignored when used in conjunction with Server::Starter (start_server script)"; } my $host = $self->{host} || ''; my @listen; my $ports = server_ports(); while (my ($hostport, $fd) = each %$ports ) { push @listen, $hostport; $self->_create_ss_tcp_server($hostport, $fd, $app); } # overwrite, just in case somebody wants to refer to it afterwards $self->{listen} = \@listen; } sub _create_ss_tcp_server { my ($self, $hostport, $fd, $app) = @_; my $is_tcp = 1; # currently no unix socket support my ($host, $port); if ($hostport =~ /(.*):(\d+)/) { $host = $1; $port = $2; } else { $host ||= '0.0.0.0'; $port = $hostport; } # /WE/ don't care what the address family, type of socket we got, just # create a new handle, and perform a fdopen on it. So that part of # AE::Socket::tcp_server is stripped out my %state; $state{fh} = IO::Socket::INET->new( Proto => 'tcp', Listen => 128, ); $state{fh}->fdopen( $fd, 'w' ) or Carp::croak "failed to bind to listening socket: $!"; fh_nonblocking $state{fh}, 1; my($listen_host, $listen_port); my $len; my $prepare = $self->_accept_prepare_handler(\$listen_host, \$listen_port); if ($prepare) { my ($service, $host) = AnyEvent::Socket::unpack_sockaddr getsockname $state{fh}; $len = $prepare && $prepare->( $state{fh}, format_address $host, $service ); } $len ||= 128; listen $state{fh}, $len or Carp::croak "listen: $!"; my $accept = $self->_accept_handler($app, $is_tcp, \$listen_host, \$listen_port); $state{aw} = AE::io $state{fh}, 0, sub { # this closure keeps $state alive while ($state{fh} && (my $peer = accept my $fh, $state{fh})) { fh_nonblocking $fh, 1; # POSIX requires inheritance, the outside world does not my ($service, $host) = AnyEvent::Socket::unpack_sockaddr($peer); $accept->($fh, format_address $host, $service); } }; defined wantarray ? guard { %state = () } # clear fh and watcher, which breaks the circular dependency : () } 1; twiggy-0.1025+dfsg.orig/lib/Twiggy/Server.pm0000644000175000017500000004333112452063163020115 0ustar gregoagregoapackage Twiggy::Server; use strict; use warnings; use Scalar::Util qw(blessed weaken); use Try::Tiny; use Carp; use Socket qw(IPPROTO_TCP TCP_NODELAY); use Errno qw(EAGAIN EINTR); use IO::Handle; use AnyEvent; use AnyEvent::Handle; use AnyEvent::Socket; use AnyEvent::Util qw(WSAEWOULDBLOCK); use HTTP::Status; use Plack::HTTPParser qw(parse_http_request); use Plack::Util; use constant DEBUG => $ENV{TWIGGY_DEBUG}; use constant HAS_AIO => !$ENV{PLACK_NO_SENDFILE} && try { require AnyEvent::AIO; require IO::AIO; 1; }; open my $null_io, '<', \''; sub new { my($class, @args) = @_; return bless { no_delay => 1, timeout => 300, read_chunk_size => 4096, @args, }, $class; } sub start_listen { my ($self, $app) = @_; my @listen = @{$self->{listen} || [ ($self->{host} || '') . ":" . ($self->{port} || 0) ]}; for my $listen (@listen) { push @{$self->{listen_guards}}, $self->_create_tcp_server($listen, $app); } } sub register_service { my($self, $app) = @_; $self->start_listen($app); $self->{exit_guard} = AE::cv { # Make sure that we are not listening on a socket anymore, while # other events are being flushed delete $self->{listen_guards}; }; $self->{exit_guard}->begin; } sub _create_tcp_server { my ( $self, $listen, $app ) = @_; my($host, $port, $is_tcp); if ($listen =~ /:\d+$/) { ($host, $port) = split /:/, $listen; $host = undef if $host eq ''; $port = undef if $port == 0; $is_tcp = 1; } else { $host = "unix/"; $port = $listen; } my($listen_host, $listen_port); return tcp_server $host, $port, $self->_accept_handler($app, $is_tcp, \$listen_host, \$listen_port), $self->_accept_prepare_handler(\$listen_host, \$listen_port); } sub _accept_prepare_handler { my($self, $listen_host_r, $listen_port_r) = @_; return sub { my ( $fh, $host, $port ) = @_; DEBUG && warn "Listening on $host:$port\n"; $$listen_host_r = $host; $$listen_port_r = $port; $self->{server_ready}->({ host => $host, port => $port, server_software => 'Twiggy', }) if $self->{server_ready}; return $self->{backlog} || 0; }; } sub _accept_handler { my ( $self, $app, $is_tcp, $listen_host_r, $listen_port_r ) = @_; return sub { my ( $sock, $peer_host, $peer_port ) = @_; DEBUG && warn "$sock Accepted connection from $peer_host:$peer_port\n"; return unless $sock; $self->{exit_guard}->begin; if ( $is_tcp && $self->{no_delay} ) { setsockopt($sock, IPPROTO_TCP, TCP_NODELAY, 1) or die "setsockopt(TCP_NODELAY) failed:$!"; } my $headers = ""; my $try_parse = sub { if ( $self->_try_read_headers($sock, $headers) ) { my $env = { SERVER_NAME => $$listen_host_r, SERVER_PORT => $$listen_port_r, SCRIPT_NAME => '', REMOTE_ADDR => $peer_host, 'psgi.version' => [ 1, 0 ], 'psgi.errors' => *STDERR, 'psgi.url_scheme' => 'http', 'psgi.nonblocking' => Plack::Util::TRUE, 'psgi.streaming' => Plack::Util::TRUE, 'psgi.run_once' => Plack::Util::FALSE, 'psgi.multithread' => Plack::Util::FALSE, 'psgi.multiprocess' => Plack::Util::FALSE, 'psgi.input' => undef, # will be set by _run_app() 'psgix.io' => $sock, 'psgix.input.buffered' => Plack::Util::TRUE, }; my $reqlen = parse_http_request($headers, $env); DEBUG && warn "$sock Parsed HTTP headers: request length=$reqlen\n"; if ( $reqlen < 0 ) { die "bad request"; } else { return $env; } } return; }; local $@; unless ( eval { if ( my $env = $try_parse->() ) { # the request data is already available, no need to parse more $self->_run_app($app, $env, $sock); } else { # there's not yet enough data to parse the request, # set up a watcher $self->_create_req_parsing_watcher( $sock, $try_parse, $app ); }; 1; }) { my $disconnected = ($@ =~ /^client disconnected/); $self->_bad_request($sock, $disconnected); } }; } # returns a closure that tries to parse # this is not a method because it needs a buffer per socket sub _try_read_headers { my ( $self, $sock, undef ) = @_; # FIXME add a timer to manage read timeouts local $/ = "\012"; read_more: for my $headers ( $_[2] ) { if ( defined(my $line = <$sock>) ) { $headers .= $line; if ( $line eq "\015\012" or $line eq "\012" ) { # got an empty line, we're done reading the headers return 1; } else { # try to read more lines using buffered IO redo read_more; } } elsif ($! and $! != EAGAIN && $! != EINTR && $! != WSAEWOULDBLOCK ) { die $!; } elsif (!$!) { die "client disconnected"; } } DEBUG && warn "$sock did not read to end of req, wait for more data to arrive\n"; return; } sub _create_req_parsing_watcher { my ( $self, $sock, $try_parse, $app ) = @_; my $headers_io_watcher; my $timeout_timer = AE::timer $self->{timeout}, 0, sub { DEBUG && warn "$sock Timeout\n"; undef $headers_io_watcher; undef $try_parse; undef $sock; } if $self->{timeout}; $headers_io_watcher = AE::io $sock, 0, sub { try { if ( my $env = $try_parse->() ) { undef $headers_io_watcher; undef $timeout_timer; $self->_run_app($app, $env, $sock); } } catch { undef $headers_io_watcher; undef $timeout_timer; my $disconnected = /^client disconnected/; $self->_bad_request($sock, $disconnected); } }; } sub _bad_request { my ( $self, $sock, $disconnected ) = @_; return unless defined $sock and defined fileno $sock; my $response = [ 400, [ 'Content-Type' => 'text/plain' ], [ ], ]; # if client is already gone, don't try to write to it $response = [] if $disconnected; $self->_write_psgi_response($sock, $response); return; } sub _read_chunk { my ($self, $sock, $remaining, $cb) = @_; my $data = ''; my $read_chunk_size = $self->{read_chunk_size}; my $try_read = sub { READ_MORE: { my $read_size = $remaining > $read_chunk_size ? $read_chunk_size : $remaining; my $rlen = read($sock, $data, $read_size, length($data)); if (defined $rlen and $rlen > 0) { $remaining -= $rlen; if ($remaining <= 0) { $cb->($data); return 1; } else { redo READ_MORE; } } elsif (defined $rlen) { $cb->($data); return 1; } elsif ($! and $! != EAGAIN && $! != EINTR && $! != WSAEWOULDBLOCK) { die $!; } elsif (!$!) { die "client disconnected"; } } return; }; unless ($try_read->()) { my $rw; $rw = AE::io($sock, 0, sub { try { if ($try_read->()) { undef $rw; } } catch { undef $rw; $self->_bad_request($sock); }; }); } } sub _run_app { my($self, $app, $env, $sock) = @_; unless ($env->{'psgi.input'}) { if ($env->{CONTENT_LENGTH}) { $self->_read_chunk($sock, $env->{CONTENT_LENGTH}, sub { my ($data) = @_; open my $input, '<', \$data; $env->{'psgi.input'} = $input; $self->_run_app($app, $env, $sock); }); return; } else { $env->{'psgi.input'} = $null_io; } } my $res = Plack::Util::run_app $app, $env; if ( ref $res eq 'ARRAY' ) { $self->_write_psgi_response($sock, $res); } elsif ( blessed($res) and $res->isa("AnyEvent::CondVar") ) { Carp::carp("Returning AnyEvent condvar is deprecated and will be removed in the next release of Twiggy. Use the streaming callback interface intstead."); $res->cb(sub { $self->_write_psgi_response($sock, shift->recv) }); } elsif ( ref $res eq 'CODE' ) { my $created_writer; $res->( sub { my $res = shift; if ( @$res < 2 ) { croak "Insufficient arguments"; } elsif ( @$res == 2 ) { my ( $status, $headers ) = @$res; $self->_flush($sock); my $writer = Twiggy::Writer->new($sock, $self->{exit_guard}); $created_writer = 1; my $buf = $self->_format_headers($status, $headers); $writer->write($$buf); return $writer; } else { my ( $status, $headers, $body, $post ) = @$res; my $cv = $self->_write_psgi_response($sock, [ $status, $headers, $body ]); $cv->cb(sub { $post->() }) if $post; } }, $sock, ); if($created_writer) { $self->{exit_guard}->end; # normally _write_psgi_response calls this, but it doesn't get called when we use a writer! } } else { croak("Unknown response type: $res"); } } sub _write_psgi_response { my ( $self, $sock, $res ) = @_; if ( ref $res eq 'ARRAY' ) { if ( scalar @$res == 0 ) { # no response $self->{exit_guard}->end; return; } my ( $status, $headers, $body ) = @$res; my $cv = AE::cv; $self->_write_headers( $sock, $status, $headers )->cb(sub { local $@; if ( eval { $_[0]->recv; 1 } ) { $self->_write_body($sock, $body)->cb(sub { shutdown $sock, 1; close $sock; $self->{exit_guard}->end; local $@; eval { $cv->send($_[0]->recv); 1 } or $cv->croak($@); }); } else { $self->{exit_guard}->end; eval { $cv->send($_[0]->recv); 1 } or $cv->croak($@); } }); return $cv; } else { no warnings 'uninitialized'; warn "Unknown response type: $res"; return $self->_write_psgi_response($sock, [ 204, [], [] ]); } } sub _write_headers { my ( $self, $sock, $status, $headers ) = @_; $self->_write_buf( $sock, $self->_format_headers($status, $headers) ); } sub _format_headers { my ( $self, $status, $headers ) = @_; my $hdr = sprintf "HTTP/1.0 %d %s\015\012", $status, HTTP::Status::status_message($status); my $i = 0; my @delim = ("\015\012", ": "); foreach my $str ( @$headers ) { $hdr .= $str . $delim[++$i % 2]; } $hdr .= "\015\012"; return \$hdr; } # this flushes just the output buffer, not the input buffer (unlike # $handle->flush) sub _flush { my ( $self, $sock ) = @_; local $| = 1; print $sock ''; } # helper routine, similar to push write, but respects buffering, and refcounts # itself sub _write_buf { my($self, $socket, $data) = @_; no warnings 'uninitialized'; # try writing immediately if ( (my $written = syswrite($socket, $$data)) < length($$data) ) { my $done = defined(wantarray) && AE::cv; # either the write failed or was incomplete if ( !defined($written) and $! != EAGAIN && $! != EINTR && $! != WSAEWOULDBLOCK) { # a real write error occured, like EPIPE $done->croak($!) if $done; return $done; } # the write was either incomplete or a non fatal error occured, so we # need to set up an IO watcher to wait until we can properly write my $length = length($$data); my $write_watcher; $write_watcher = AE::io $socket, 1, sub { write_more: { my $out = syswrite($socket, $$data, $length - $written, $written); if ( defined($out) ) { $written += $out; if ( $written == $length ) { undef $write_watcher; $done->send(1) if $done; } else { redo write_more; } } elsif ($! != EAGAIN && $! != EINTR && $! != WSAEWOULDBLOCK) { $done->croak($!) if $done; undef $write_watcher; } } }; return $done; } elsif ( defined wantarray ) { my $done = AE::cv; $done->send(1); return $done; } } sub _write_body { my ( $self, $sock, $body ) = @_; if ( ref $body eq 'ARRAY' ) { my $buf = join "", @$body; return $self->_write_buf($sock, \$buf); } elsif ( Plack::Util::is_real_fh($body) ) { # real handles use nonblocking IO # either AIO or using watchers, with sendfile or with copying IO return $self->_write_real_fh($sock, $body); } elsif ( blessed($body) and $body->can("string_ref") ) { # optimize IO::String to not use its incredibly slow getline if ( my $pos = $body->tell ) { my $str = substr ${ $body->string_ref }, $pos; return $self->_write_buf($sock, \$str); } else { return $self->_write_buf($sock, $body->string_ref); } } else { return $self->_write_fh($sock, $body); } } # like Plack::Util::foreach, but nonblocking on the output # handle sub _write_fh { my ( $self, $sock, $body ) = @_; my $handle = AnyEvent::Handle->new( fh => $sock ); my $ret = AE::cv; $handle->on_error(sub { my $err = $_[2]; $handle->destroy; $ret->send($err); }); no warnings 'recursion'; $handle->on_drain( $self->_drain($body, $ret) ); return $ret; } sub _drain { my ($self, $body, $ret) = @_; return sub { my $handle = shift; local $/ = \ $self->{read_chunk_size}; if ( defined( my $buf = $body->getline ) ) { if (length($buf)) { $handle->push_write($buf); } else { # if on_drain is called and we don't do any # push_write, anyevent::handle thinks we are done. # this fails for the deflater mw, since one 4096 chunk # of getline might not generate a deflated packet yet, # which gets us an empty string here. return $self->_drain($body, $ret)->($handle); } } elsif ( $! ) { $ret->croak($!); $handle->destroy; } else { $body->close; $handle->on_drain(sub { shutdown $handle->fh, 1; $handle->destroy; $ret->send(1); }); } } } # when the body handle is a real filehandle we use this routine, which is more # careful not to block when reading the response too # FIXME support only reading $length bytes from $body, instead of until EOF # FIXME use len = 0 param to sendfile # FIXME use Sys::Sendfile in nonblocking mode if AIO is not available # FIXME test sendfile on non file backed handles sub _write_real_fh { my ( $self, $sock, $body ) = @_; if ( HAS_AIO and -s $body ) { my $cv = AE::cv; my $offset = 0; my $length = -s $body; $sock->blocking(1); my $sendfile; $sendfile = sub { IO::AIO::aio_sendfile( $sock, $body, $offset, $length - $offset, sub { my $ret = shift; $offset += $ret if $ret > 0; if ($offset >= $length || ($ret == -1 && ! ($! == EAGAIN || $! == EINTR))) { if ( $ret == -1 ) { $cv->croak($!); } else { $cv->send(1); } undef $sendfile; undef $sock; } else { $sendfile->(); } }); }; $sendfile->(); return $cv; } else { return $self->_write_fh($sock, $body); } } sub run { my $self = shift; $self->register_service(@_); my $w; $w = AE::signal QUIT => sub { $self->{exit_guard}->end; undef $w }; $self->{exit_guard}->recv; } package Twiggy::Writer; use AnyEvent::Handle; sub new { my ( $class, $socket, $exit ) = @_; $exit->begin if $exit; bless { handle => AnyEvent::Handle->new( fh => $socket ), exit_guard => $exit }, $class; } sub write { $_[0]{handle}->push_write($_[1]) } sub close { my $self = shift; my $exit_guard = delete $self->{exit_guard}; $exit_guard->end if $exit_guard; my $handle = delete $self->{handle}; if ($handle) { $handle->on_drain; $handle->on_error; $handle->on_drain(sub { shutdown $_[0]->fh, 1; $_[0]->destroy; undef $handle; }); } } sub DESTROY { $_[0]->close } package Twiggy::Server; 1; __END__ twiggy-0.1025+dfsg.orig/lib/AnyEvent/0000755000175000017500000000000012631023453016561 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/lib/AnyEvent/Server/0000755000175000017500000000000012452063163020032 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/lib/AnyEvent/Server/PSGI.pm0000644000175000017500000000010112452063163021122 0ustar gregoagregoapackage AnyEvent::Server::PSGI; use parent 'Twiggy::Server'; 1; twiggy-0.1025+dfsg.orig/lib/Twiggy.pm0000644000175000017500000000537712452063163016657 0ustar gregoagregoapackage Twiggy; use strict; use warnings; use 5.008_001; our $VERSION = '0.1025'; 1; __END__ =head1 NAME Twiggy - AnyEvent HTTP server for PSGI (like Thin) =head1 SYNOPSIS twiggy --listen :8080 See C for more details. use Twiggy::Server; my $server = Twiggy::Server->new( host => $host, port => $port, ); $server->register_service($app); AE::cv->recv; =head1 DESCRIPTION Twiggy is a lightweight and fast HTTP server with unique features such as: =over 4 =item PSGI Can run any PSGI applications. Fully supports I and I interfaces. =item AnyEvent This server uses AnyEvent and runs in a non-blocking event loop, so it's best to run event-driven web applications that runs I/O bound jobs or delayed responses such as long-poll, WebSocket or streaming content (server push). This software used to be called Plack::Server::AnyEvent but was renamed to Twiggy. See L for details. =item Fast header parser Uses XS/C based HTTP header parser for the best performance. (optional, install the L module to enable it; see also L for more information). =item Lightweight and Fast The memory required to run twiggy is 6MB and it can serve more than 4500 req/s with a single process on Perl 5.10 with MacBook Pro 13" late 2009. =item Superdaemon aware Supports L for hot deploy and graceful restarts. To use it, instead of the usual: plackup --server Twiggy --port 8111 app.psgi install L and use: start_server --port 8111 plackup --server Twiggy app.psgi =back =head1 ENVIRONMENT The following environment variables are supported. =over 4 =item TWIGGY_DEBUG Set to true to enable debug messages from Twiggy. =back =head1 NAMING =head2 Twiggy? Because it is like L, Ruby's Rack web server using EventMachine. You know, Twiggy is thin :) =head2 Why the cute name instead of more descriptive namespace? Are you on drugs? I'm sick of naming Perl software like HTTP::Server::PSGI::How::Its::Written::With::What::Module and people call it HSPHIWWWM on IRC. It's hard to say on speeches and newbies would ask questions what they stand for every day. That's crazy. This module actually includes the longer alias and an empty subclass L for those who like to type more ::'s. It would actually help you find this software by searching for I on CPAN, which i believe is a good thing. Yes, maybe I'm on drugs. We'll see. =head1 LICENSE This module is licensed under the same terms as Perl itself. =head1 AUTHOR Tatsuhiko Miyagawa Tokuhiro Matsuno Yuval Kogman Hideki Yamamura Daisuke Maki =head1 SEE ALSO L L L =cut twiggy-0.1025+dfsg.orig/Makefile.PL0000644000175000017500000000245612452063163016246 0ustar gregoagregoa # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.029. use strict; use warnings; use 5.008001; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "AnyEvent HTTP server for PSGI (like Thin)", "AUTHOR" => "Tatsuhiko Miyagawa", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Twiggy", "EXE_FILES" => [ "script/twiggy" ], "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.008001", "NAME" => "Twiggy", "PREREQ_PM" => { "AnyEvent" => 0, "HTTP::Status" => 0, "Plack" => "0.99", "Try::Tiny" => 0 }, "TEST_REQUIRES" => { "Test::More" => 0, "Test::Requires" => 0, "Test::TCP" => 0 }, "VERSION" => "0.1025", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "AnyEvent" => 0, "ExtUtils::MakeMaker" => 0, "HTTP::Status" => 0, "Plack" => "0.99", "Test::More" => 0, "Test::Requires" => 0, "Test::TCP" => 0, "Try::Tiny" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); twiggy-0.1025+dfsg.orig/META.yml0000644000175000017500000000262312452063163015541 0ustar gregoagregoa--- abstract: 'AnyEvent HTTP server for PSGI (like Thin)' author: - 'Tatsuhiko Miyagawa' build_requires: Test::More: '0' Test::Requires: '0' Test::TCP: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 5.029, Dist::Milla version v1.0.9, CPAN::Meta::Converter version 2.143240' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Twiggy no_index: directory: - t - xt - inc - share - eg - examples requires: AnyEvent: '0' HTTP::Status: '0' Plack: '0.99' Try::Tiny: '0' perl: '5.008001' resources: bugtracker: https://github.com/miyagawa/Twiggy/issues homepage: https://github.com/miyagawa/Twiggy repository: https://github.com/miyagawa/Twiggy.git version: '0.1025' x_contributors: - 'Adam Thomason ' - 'Chia-liang Kao ' - 'Kazuho Oku ' - 'Moritz Onken ' - 'Pedro Melo ' - 'Rob Hoelz ' - 'Sergey Zasenko ' - 'Tatsuhiko Miyagawa ' - 'Tomas Doran (t0m) ' - 'Yuval Kogman ' - 'hidekiy ' - 'lestrrat ' - 'maedama ' - 'moznion ' twiggy-0.1025+dfsg.orig/META.json0000644000175000017500000000434612452063163015715 0ustar gregoagregoa{ "abstract" : "AnyEvent HTTP server for PSGI (like Thin)", "author" : [ "Tatsuhiko Miyagawa" ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.029, Dist::Milla version v1.0.9, CPAN::Meta::Converter version 2.143240", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Twiggy", "no_index" : { "directory" : [ "t", "xt", "inc", "share", "eg", "examples" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Dist::Milla" : "v1.0.9", "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "AnyEvent" : "0", "HTTP::Status" : "0", "Plack" : "0.99", "Try::Tiny" : "0", "perl" : "5.008001" } }, "test" : { "requires" : { "Test::More" : "0", "Test::Requires" : "0", "Test::TCP" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/miyagawa/Twiggy/issues" }, "homepage" : "https://github.com/miyagawa/Twiggy", "repository" : { "type" : "git", "url" : "https://github.com/miyagawa/Twiggy.git", "web" : "https://github.com/miyagawa/Twiggy" } }, "version" : "0.1025", "x_contributors" : [ "Adam Thomason ", "Chia-liang Kao ", "Kazuho Oku ", "Moritz Onken ", "Pedro Melo ", "Rob Hoelz ", "Sergey Zasenko ", "Tatsuhiko Miyagawa ", "Tomas Doran (t0m) ", "Yuval Kogman ", "hidekiy ", "lestrrat ", "maedama ", "moznion " ] } twiggy-0.1025+dfsg.orig/script/0000755000175000017500000000000012631023453015566 5ustar gregoagregoatwiggy-0.1025+dfsg.orig/script/twiggy0000755000175000017500000000064412452063163017035 0ustar gregoagregoa#!perl use strict; use Plack::Runner; sub version { require Twiggy; print "Twiggy $Twiggy::VERSION\n"; } my $runner = Plack::Runner->new(server => 'Twiggy', env => 'deployment', version_cb => \&version); $runner->parse_options(@ARGV); $runner->run; __END__ =head1 NAME twiggy - Twiggy launcher =head1 SYNOPSIS twiggy --listen :9090 Run C for more options. =head1 SEE ALSO L =cut twiggy-0.1025+dfsg.orig/dist.ini0000644000175000017500000000003712452063163015731 0ustar gregoagregoa[@Milla] installer = MakeMaker