{"_id":"fishback","_rev":"25-df0cba6d57829d1ccc3463ef0a9e7eac","name":"fishback","description":"Simple RFC2616-compliant caching proxy server","dist-tags":{"latest":"0.3.1"},"versions":{"0.1.0":{"name":"fishback","description":"Simple RFC2616-compliant caching proxy server","version":"0.1.0","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":"git://github.com/ithinkihaveacat/node-fishback.git","author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"main":"./lib/fishback","bin":{"fishback":"./run.js"},"directories":{"lib":"./lib"},"engines":{"node":"0.3.7"},"_id":"fishback@0.1.0","_engineSupported":true,"_npmVersion":"0.2.17","_nodeVersion":"v0.3.7","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"2577dba853e238763834d546407cfbf0ee56c5bc","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.1.0.tgz","integrity":"sha512-uNGOTQBM1Mqrt25yV9e6NzaT7tULP7NLSOCaC0adszXUMlYuqaeeOJlNGR/tOqC5RmYhyQtrFAsrLU+04Q/ujA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGh33Vl3RXpTMDJ6p0Nbe1588qG4djrAuPWxgXWe6QKcAiEA+R/kNSchunqnXKySHfQXIAHAhfjyzkHZzYn3vbJ+U3k="}]}},"0.1.1":{"name":"fishback","description":"Simple RFC2616-compliant caching proxy server","version":"0.1.1","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":"git://github.com/ithinkihaveacat/node-fishback.git","author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"main":"./lib/fishback","bin":{"fishback":"./run.js"},"directories":{"lib":"./lib"},"engines":{"node":"0.3.7"},"_id":"fishback@0.1.1","_engineSupported":true,"_npmVersion":"0.2.17","_nodeVersion":"v0.3.7","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"701792f146bf361a182619c502c8f443e1ded15c","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.1.1.tgz","integrity":"sha512-pZxMtsvQZXSQ5FLKhDrEOeS2RzvLbJaSDpiG65ziUlf5SJ318biT1yDz8VmMfY+Opb3fjPvZcQeLsAxcmYHmYw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGmNsYa6/xYM9CImrkABmlVJofKKk+JEzZFUHF4LlAu3AiB0L24WuSOJIdVNDPB1R4ZoPKK80UN+JxxxOLnIChaClg=="}]}},"0.1.2":{"name":"fishback","description":"Simple RFC2616-compliant caching proxy server","version":"0.1.2","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":"git://github.com/ithinkihaveacat/node-fishback.git","author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"main":"./lib/fishback","bin":{"fishback":"./run.js"},"directories":{"lib":"./lib"},"engines":{"node":"0.3.7"},"_id":"fishback@0.1.2","_engineSupported":false,"_npmVersion":"0.2.17","_nodeVersion":"v0.3.8","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"37595b36154d9e8a8e66a44e2af7a94e1b1154fd","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.1.2.tgz","integrity":"sha512-Fkad2N4ioIX1GmZGf0uS52+b3A3bXSOG7gaZo56KOvN8JtJMKZMwbKd+E0W96QL4JHYwh5DLwZpqLVQxNenjTA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFC7pVc+PPJq7hGlDWECjUVTgwv+9iWs1HWcD4m2ToTRAiAkQ8Zo14Lc2YndAUBDmikmHlSinD6RZZjrF8DpDL9/ew=="}]}},"0.1.3":{"name":"fishback","description":"Simple RFC2616-compliant caching proxy server","version":"0.1.3","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":"git://github.com/ithinkihaveacat/node-fishback.git","author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"main":"./lib/fishback","bin":{"fishback":"./run.js"},"directories":{"lib":"./lib"},"engines":{"node":"0.3.7"},"_id":"fishback@0.1.3","_engineSupported":false,"_npmVersion":"0.2.17","_nodeVersion":"v0.3.8","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"059e55c9782e3ee9fe9d020913684a81ad1affe7","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.1.3.tgz","integrity":"sha512-nef+C41kvNG0AKsV9r0f1nHl31ra9jh0RNKfkg7HBSsAfT1MzIJ0/fYa27O6n/L0Ssa4xAPzNk5rd1H+yJjoDw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEUPSDxeAIQpfkmlRrcQrgYNFs1d5WA8ITxeYEbUbE89AiEAp7kXjv7PZgiJv7GpmmgHHv1gdGRvgVBKz9lpdJt8oXg="}]}},"0.1.4":{"name":"fishback","description":"Simple RFC2616-compliant caching proxy server","version":"0.1.4","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":"git://github.com/ithinkihaveacat/node-fishback.git","author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"main":"./lib/fishback","bin":{"fishback":"./run.js"},"directories":{"lib":"./lib"},"engines":{"node":">=0.3.7"},"_id":"fishback@0.1.4","_engineSupported":true,"_npmVersion":"0.2.17","_nodeVersion":"v0.3.8","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"5a467249fdb96eecccf307f6bc1a1ad2e4ec2e4d","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.1.4.tgz","integrity":"sha512-pFKmxFlsU4kJH7n/ZLoGBnk4N47v4QWliqWOntE7JNRJCDhOhm3QjAZHWEZnOmOQLvecAmxw1hB1bCOY7iWbKA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCgoH0RWS55ciEhUYeZqhK1fXQHcQR/9hR3agmRpHzSigIgd7ql5WkvdkNwv4IDC61s2jMiqXQaGFpoxvMxzN/9YBY="}]}},"0.1.5":{"name":"fishback","description":"Simple RFC2616-compliant caching proxy server","version":"0.1.5","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":{"type":"git","url":"git://github.com/ithinkihaveacat/node-fishback.git"},"author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"main":"./lib/fishback","bin":{"fishback":"./run.js"},"directories":{"lib":"./lib"},"engines":{"node":">=0.3.7"},"_id":"fishback@0.1.5","_engineSupported":true,"_npmVersion":"0.3.3","_nodeVersion":"v0.4.0","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"efa4cac778c0cae4cdbdd59c39b7f4d666126f1c","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.1.5.tgz","integrity":"sha512-/86q2GwHVqJmq8oaqFn9QxKw46KLZPvJ3GIUIGP8Bvts5xeToN93iO+EeEg3uBTFZL77QWpKgg8rzjyiS1v/AQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC41wkumF0DdXyhDaNIwMsHwEQWzTjh1hq92ZHwIx8wPwIgU4hzfrk6vm8eRnPepGntZ7CHMTXn14l9+Hgf357Nf7Q="}]}},"0.2.0":{"name":"fishback","description":"Simple RFC2616-compliant caching proxy server","version":"0.2.0","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":{"type":"git","url":"git://github.com/ithinkihaveacat/node-fishback.git"},"author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"main":"./lib/fishback","bin":{"fishback":"./run.js"},"directories":{"lib":"./lib"},"engines":{"node":">=0.3.7"},"_id":"fishback@0.2.0","_engineSupported":true,"_npmVersion":"0.3.9","_nodeVersion":"v0.4.1","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"87bd0aae33f6ab71430fa6805563e8a6eef63fea","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.2.0.tgz","integrity":"sha512-nY9UdGGTmL7NBZm3QM+ZcAsljxpEOtQfaIOD1zneZdgd9Tl0DendsrdGZJFYp4pN2WcHb91KVEgvSJuMIKG55A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDuUKG7V2mHbn3F9G2jPDWtyvcV+nVohh4Cno7u/qZCyAiEA06aWEEDawXuzRpqTXThc5NjFyyBNoP3k8BXqzciHeI4="}]}},"0.2.1":{"name":"fishback","description":"Simple RFC2616-compliant caching proxy server","version":"0.2.1","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":{"type":"git","url":"git://github.com/ithinkihaveacat/node-fishback.git"},"author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"main":"./lib/fishback","bin":{"fishback":"./run.js"},"directories":{"lib":"./lib"},"engines":{"node":">=0.4.1"},"_id":"fishback@0.2.1","_engineSupported":true,"_npmVersion":"0.3.9","_nodeVersion":"v0.4.1","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"697614f9c78a930af4a4f9106972fb83f404b9a6","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.2.1.tgz","integrity":"sha512-Ofj94ir6b/i/W5g4oE+H5PrbsP7NljoaeK4JdwssraSyQs9+S0/t5KHCYLpxYYXX4jqHF95I8+7woPfaz7RMoA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIADo5TbjQ9G2LrrYe9p0iDzbvTaNcfJpw8LCx7W7gMmQAiAh1PAQlHEyElOHv9DdJqClEnuWBiJ1tvU/Y3JlRWurlA=="}]}},"0.2.2":{"name":"fishback","description":"Simple RFC2616-compliant caching proxy server","version":"0.2.2","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":{"type":"git","url":"git://github.com/ithinkihaveacat/node-fishback.git"},"author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"main":"./lib/fishback","bin":{"fishback-reverse":"./fishback-reverse.js","fishback-standalone":"./fishback-standalone.js"},"directories":{"lib":"./lib"},"engines":{"node":">=0.4.1"},"_id":"fishback@0.2.2","_engineSupported":true,"_npmVersion":"0.3.12","_nodeVersion":"v0.4.2","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"e3a33cedc6aeb0281e0641607a23b3213badfcf2","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.2.2.tgz","integrity":"sha512-Jz/KFF0hWtaXBsecFhcNBR20Xtvrr5v9s2+L/CtvaUkI5bXMKbZv9Z5plTQlMcaRMPfrLtTmt6D7GGFHkKbRNg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBjtp1Q57Rfbf5ZRAPdX3EiVfM8XqUlxq2U58d+yF6dwAiEA357l92t3YJIN7q+1FPPNOT981QhmlFRNejcxXABp/Lo="}]}},"0.3.0":{"name":"fishback","author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"description":"Simple RFC2616-compliant caching proxy server","version":"0.3.0","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":{"type":"git","url":"git://github.com/ithinkihaveacat/node-fishback.git"},"bugs":"https://github.com/ithinkihaveacat/node-fishback/issues","main":"./lib/fishback","dependencies":{"memjs":"*","mongodb":">=1.2.13"},"engines":{"node":">=0.8"},"scripts":{"test":"cd test && make"},"readme":"[![Build Status](https://travis-ci.org/ithinkihaveacat/node-fishback.png)](https://travis-ci.org/ithinkihaveacat/node-fishback)\n\n## Overview\n\nFishback is a simple NodeJS-powered caching HTTP proxy.\n\nAs well as supporting different caching backends, the design lends itself to\nfiltering and processing the headers of both requests and responses.  (For\nexample, changing `Cache-Control` headers.)  It is not well-suited to\ntransforming request or response *bodies*, though it can be integrated into\nsystems that do provide this feature.\n\nFishback tries hard to be RFC2616 compliant (and many of the slightly unusual\nfeatures like `only-if-cached` and `max-stale` are supported), but there's\nprobably some things it doesn't do completely correctly.  (Though any variation\nfrom RFC2616 should be considered a bug.)\n\n## Example\n\n````js\nvar fishback = require(\"../lib/fishback\");\nvar http = require(\"http\");\n\nvar proxy = fishback.createProxy(new fishback.Client(\"localhost\", 9000));\nproxy.on(\"newRequest\", function (req) {\n    console.log(req.method + \" \" + req.url);\n});\nproxy.on(\"newResponse\", function (res) {\n    res.setHeader(\"cache-control\", \"public, max-age=3600\");\n});\n\nhttp.createServer(proxy.request.bind(proxy)).listen(8000);\n\nconsole.log(\"Listening on port 8000, and proxying to localhost:9000\");\n````\n\nFor more, see the [examples](examples) directory.\n\n## API\n\nFishback is heavily event based, and in relies heavily on the four event\nemitters `http.ServerRequest`, `http.ServerResponse`, `http.ClientRequest` and\n`http.ClientResponse`.\n\nIn contrast to most NodeJS \"middleware\" systems (including\n[Connect](http://www.senchalabs.org/connect/)), Fishback itself does not contain\na web server.  Instead, Fishback provides a handler for `http.Server's`\n['request' event](http://nodejs.org/api/http.html#http_event_request).\n\n### fishback.createProxy(client)\n\n* `fishback.Handler` `client` - probably a `fishback.Client`\n\nConvenience function for creating a simple proxy from a client.\n\n### fishback.createCachingProxy(cache, client)\n\n* `fishback.Handler` `cache` - probably one of the cache backends\n* `fishback.Handler` `client` - probably a `fishback.Client`\n\nConvenience function for creating a proxy from a cache and client.\n\n### Class: fishback.Handler(...)\n\n\"Abstract\" base class for all handlers.  All the classes below (the HTTP client\nthat does real requests, the various cache backends, and the Fishback class that\nties them together) are derived from this class.\n\n#### Event: 'newRequest'\n\n`function (serverRequest) { }`\n\n  * [`http.ServerRequest`](http://nodejs.org/api/http.html#http_class_http_serverrequest) `serverRequest`\n\nEmitted when a new request has been received.  (At the point the event is\nemitted, only headers are available, though you can of course arrange to listen\nto other events.)\n\n#### Event: 'newResponse'\n\n`function (serverResponse) { }`\n\n  * [`http.ServerResponse`](http://nodejs.org/api/http.html#http_class_http_serverresponse) `serverResponse`\n\nEmitted when a new response is being sent.  (At the point the event is emitted,\nonly headers are available.  Because of limitations in the\n[http.ServerResponse](http://nodejs.org/api/http.html#http_class_http_serverresponse)\nAPI (`write()` does not fire any events), it is not possible to observe any\n\"write\" events.)\n\n#### cache.request(serverRequest, serverResponse)\n\n  * [`http.ServerRequest`](http://nodejs.org/api/http.html#http_class_http_serverrequest) `serverRequest`\n  * [`http.ServerResponse`](http://nodejs.org/api/http.html#http_class_http_serverresponse) `serverResponse`\n\nProcesses a request/response pair.\n\nIf unable to handle the request (e.g. resource is not cached), `serverRequest`\nwill emit the `reject` event.\n\nIf request is accepted (i.e. the handler is writing to `serverResponse`),\n`serverResponse` will emit the `endHead` event when headers have been set on the\nresponse.\n\n(If overriding this method, note that the handler must ensure that if a request\nis rejected, any handlers that may subsequently be invoked are actually able to\nfulfill the request!  The most important implication of this constraint is that\nif the request method is not `GET`, it must be rejected immediately\n(synchronously).  If the method is `GET`, the request can be rejected\nasynchronously since subsequent handlers do not need any information from `data`\nevents they would otherwise have missed).)\n\n#### cache.response(clientResponse)\n\n  * [`http.ClientResponse`](http://nodejs.org/api/http.html#http_http_clientresponse) `clientResponse`\n\nProcess a *client* response.\n\nThis is really only useful for caching handlers--it allows them to populate\ntheir caches from responses to any real HTTP requests that are issued.\n\n(For example, `fishback.createCachingProxy()` arranges things so that if the\ncache handler fires a `reject` event, a \"real\" HTTP request to be issued; the\nresponse from this request is then passed to the cache.)\n\n### Class: fishback.Fishback(list)\n\nDerived from `fishback.Handler`.\n\n  * `list` an array of `fishback.Handler` objects\n\nThe last object in list is assumed to be a real HTTP client that will never\n`reject` a request.  The other objects can reject requests.\n\n### Class: fishback.Client(backend_hostname, backend_port, http)\n\nDerived from `fishback.Handler`.\n\n  * `backend_hostname` - e.g. 'localhost'\n  * `backend_port` - e.g. 80\n  * `http` - object with a `request()` method, such as `require('http')`\n\nDoes a real HTTP request.\n\n### Class: fishback.Memory()\n\nDerived from `fishback.Handler`.\n\nCaching backend.\n\n### Class: fishback.MongoDb()\n\nDerived from `fishback.Handler`.\n\n## Bugs\n\n  * None of the backends are any good.  I'd like to use memcached, but the\n    client I was using has bugs.\n  * There's no HTTPS support.\n  * If the proxy server is able to read from the origin faster than the client\n    can receive data, content needs to be buffered, either by node or the\n    kernel.  (This can be fixed by backing off when `write()` returns false, and\n    resuming only when the [\"drain\"\n    event](http://nodejs.org/api/stream.html#stream_event_drain) is\n    triggered.  This is only likely to be a problem if you're streaming very\n    large files through node.)\n  * ETags (and `must-revalidate`) are not supported.  (You don't get incorrect\n    results; you just need retrieve the entire resource from the origin each\n    time.)\n\n## See Also\n\nIf you're only after a proxy (rather than a caching proxy),\n[node-http-proxy](https://github.com/nodejitsu/node-http-proxy) may be more\nsuitable.\n\n## Author\n\nMichael Stillwell \n<mjs@beebo.org>\n","readmeFilename":"README.md","_id":"fishback@0.3.0","dist":{"shasum":"f70a91649c24acf438a8ed901b0eb089f6c3c440","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.3.0.tgz","integrity":"sha512-KyZfUCFB4XPkPaMXsG2wXsDQugGuyUTqrToiZXhjR7JdTuMuzL6Ps0Lmh7IClUsnNL1si62todeNdOOCdKsmNA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDetePKxZlWkvFpqtOL40EvWasNcd7ZUoRkr4qF5EpEUAiBDS0inycbbgMr2HkBxvD87uuyf1nt6F1+WUvhDjSAYMw=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"mjs","email":"mjs@beebo.org"},"maintainers":[{"name":"mjs","email":"mjs@beebo.org"}]},"0.3.1":{"name":"fishback","author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"description":"Simple RFC2616-compliant caching proxy server","version":"0.3.1","homepage":"https://github.com/ithinkihaveacat/node-fishback","repository":{"type":"git","url":"git://github.com/ithinkihaveacat/node-fishback.git"},"bugs":"https://github.com/ithinkihaveacat/node-fishback/issues","main":"./lib/fishback","dependencies":{"memjs":">=0.6.0"},"engines":{"node":">=0.8 <0.10"},"scripts":{"test":"cd test && make"},"readme":"[![Build Status](https://travis-ci.org/ithinkihaveacat/node-fishback.png)](https://travis-ci.org/ithinkihaveacat/node-fishback)\n\n## Overview\n\nFishback is a simple NodeJS-powered caching HTTP proxy.\n\nAs well as supporting different caching backends, the design lends itself to\nfiltering and processing the headers of both requests and responses.  (For\nexample, changing `Cache-Control` headers.)  It is not well-suited to\ntransforming request or response *bodies*, though it can be integrated into\nsystems that do provide this feature.\n\nFishback tries hard to be RFC2616 compliant (and many of the slightly unusual\nfeatures like `only-if-cached` and `max-stale` are supported), but there's\nprobably some things it doesn't do completely correctly.  (Though any variation\nfrom RFC2616 should be considered a bug.)\n\n## Example\n\n````js\nvar fishback = require(\"../lib/fishback\");\nvar http = require(\"http\");\n\nvar proxy = fishback.createProxy(new fishback.Client(\"localhost\", 9000));\nproxy.on(\"newRequest\", function (req) {\n    console.log(req.method + \" \" + req.url);\n});\nproxy.on(\"newResponse\", function (res) {\n    res.setHeader(\"cache-control\", \"public, max-age=3600\");\n});\n\nhttp.createServer(proxy.request.bind(proxy)).listen(8000);\n\nconsole.log(\"Listening on port 8000, and proxying to localhost:9000\");\n````\n\nFor more, see the [examples](examples) directory.\n\n## Installation\n\n````sh\n$ npm install fishback\n````\n\n## API\n\nFishback is heavily event based, and it relies heavily on the four event\nemitters `http.ServerRequest`, `http.ServerResponse`, `http.ClientRequest` and\n`http.ClientResponse`.\n\nIn contrast to most NodeJS \"middleware\" systems (including\n[Connect](http://www.senchalabs.org/connect/)), Fishback itself does not contain\na web server.  Instead, Fishback provides a handler for `http.Server's`\n['request' event](http://nodejs.org/api/http.html#http_event_request).\n\n### fishback.createProxy(client)\n\n* `fishback.Handler` `client` - probably a `fishback.Client`\n\nConvenience function for creating a simple proxy from a client.\n\n### fishback.createCachingProxy(cache, client)\n\n* `fishback.Handler` `cache` - probably one of the cache backends\n* `fishback.Handler` `client` - probably a `fishback.Client`\n\nConvenience function for creating a proxy from a cache and client.\n\n### Class: fishback.Handler(...)\n\n\"Abstract\" base class for all handlers.  All the classes below (the HTTP client\nthat does real requests, the various cache backends, and the Fishback class that\nties them together) are derived from this class.\n\n#### Event: 'newRequest'\n\n`function (serverRequest) { }`\n\n  * `http.ServerRequest` `serverRequest`\n\nEmitted when a new request has been received.  (At the point the event is\nemitted, only headers are available, though you can of course arrange to listen\nto other events.)\n\n#### Event: 'newResponse'\n\n`function (serverResponse) { }`\n\n  * `http.ServerResponse` `serverResponse`\n\nEmitted when a new response is being sent.  (At the point the event is emitted,\nonly headers are available.  Because of limitations in the\n[http.ServerResponse](http://nodejs.org/api/http.html#http_class_http_serverresponse)\nAPI (`write()` does not fire any events), it is not possible to observe any\n\"write\" events.)\n\n#### cache.request(serverRequest, serverResponse)\n\n  * `http.ServerRequest` `serverRequest`\n  * `http.ServerResponse` `serverResponse`\n\nProcesses a request/response pair.\n\nIf unable to handle the request (e.g. resource is not cached), `serverRequest`\nwill emit the `reject` event.\n\nIf request is accepted (i.e. the handler is writing to `serverResponse`),\n`serverResponse` will emit the `endHead` event when headers have been set on the\nresponse.\n\n(If overriding this method, note that the handler must ensure that if a request\nis rejected, any handlers that may subsequently be invoked are actually able to\nfulfill the request!  The most important implication of this constraint is that\nif the request method is not `GET`, it must be rejected immediately\n(synchronously).  If the method is `GET`, the request can be rejected\nasynchronously since subsequent handlers do not need any information from `data`\nevents they would otherwise have missed).)\n\n#### cache.response(clientResponse)\n\n  * `http.ClientResponse` `clientResponse`\n\nProcess a *client* response.\n\nThis is really only useful for caching handlers--it allows them to populate\ntheir caches from responses to any real HTTP requests that are issued.\n\n(For example, `fishback.createCachingProxy()` arranges things so that if the\ncache handler fires a `reject` event, a \"real\" HTTP request to be issued; the\nresponse from this request is then passed to the cache.)\n\n### Class: fishback.Fishback(list)\n\nDerived from `fishback.Handler`.\n\n  * `list` an array of `fishback.Handler` objects\n\nThe last object in list is assumed to be a real HTTP client that will never\n`reject` a request.  The other objects can reject requests.\n\n### Class: fishback.Client(backend_hostname, backend_port, http)\n\nDerived from `fishback.Handler`.\n\n  * `backend_hostname` - e.g. 'localhost'\n  * `backend_port` - e.g. 80\n  * `http` - object with a `request()` method, such as `require('http')`\n\nDoes a real HTTP request.\n\n### Class: fishback.Memory()\n\nDerived from `fishback.Handler`.\n\nCaching backend.\n\n### Class: fishback.MongoDb()\n\nDerived from `fishback.Handler`.\n\n## Bugs\n\n  * There's no HTTPS support.\n  * If the proxy server is able to read from the origin faster than the client\n    can receive data, content needs to be buffered, either by node or the\n    kernel.  (This can be fixed by backing off when `write()` returns false, and\n    resuming only when the [\"drain\"\n    event](http://nodejs.org/api/stream.html#stream_event_drain) is\n    triggered.  This is only likely to be a problem if you're streaming very\n    large files through node.)\n  * ETags (and `must-revalidate`) are not supported.  (You don't get incorrect\n    results; you just need retrieve the entire resource from the origin each\n    time.)\n\n## See Also\n\nIf you're only after a proxy (rather than a caching proxy),\n[node-http-proxy](https://github.com/nodejitsu/node-http-proxy) may be more\nsuitable.\n\n## Author\n\nMichael Stillwell \n<mjs@beebo.org>\n","readmeFilename":"README.md","_id":"fishback@0.3.1","dist":{"shasum":"fab4ede203e12945e2f0d1893d589bf78384d216","tarball":"https://registry.npmjs.org/fishback/-/fishback-0.3.1.tgz","integrity":"sha512-rKI81lPsl/t5Scb6v/x8pTbo6UquWWB0/1+nztYSLZnIe5UcOg48/UZcBO50LjMm6CBEb1a3nTPZ5OzyV4e0Aw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChbhgTWKTq5GaK/k7Qj18Wi5xDfg+TrqK6RZDIeHUywgIhAPA8wJ3+tdFLOVcvG1nWMLtg6Yqihk1BEae2MiZ78/d1"}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"mjs","email":"mjs@beebo.org"},"maintainers":[{"name":"mjs","email":"mjs@beebo.org"}]}},"maintainers":[{"name":"mjs","email":"mjs@beebo.org"}],"time":{"modified":"2022-06-18T01:41:51.677Z","created":"2011-02-01T22:01:33.276Z","0.1.0":"2011-02-01T22:01:33.642Z","0.1.1":"2011-02-01T23:00:40.072Z","0.1.2":"2011-02-06T19:39:06.581Z","0.1.3":"2011-02-06T19:44:58.888Z","0.1.4":"2011-02-06T19:52:51.857Z","0.1.5":"2011-02-20T12:58:33.806Z","0.2.0":"2011-02-27T23:10:22.905Z","0.2.1":"2011-03-02T22:50:43.019Z","0.2.2":"2011-03-06T11:55:53.525Z","0.3.0":"2013-03-10T22:07:22.815Z","0.3.1":"2013-05-31T21:51:43.264Z"},"author":{"name":"Michael Stillwell","email":"mjs@beebo.org","url":"http://beebo.org/"},"repository":{"type":"git","url":"git://github.com/ithinkihaveacat/node-fishback.git"}}