{ "info": { "author": "Jeff Dairiki", "author_email": "dairiki@dairiki.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Paste", "Framework :: Pyramid", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware" ], "description": "==========================================================\nWSGI Middleware to Support X-Accel-Redirect |build status|\n==========================================================\n\nDescription\n===========\n\nNginx_ has a mechanism whereby, by returning an `X-Accel-Redirect`_ header,\na web app may convince nginx to serve a static file directly.\n`PEP 333`_ defines a mechanism whereby an app server (or middleware)\ncan offer to serve files directly by providing ``wsgi.file_wrapper``\nin the ``environ``.\nThis package provides a piece of WSGI middleware to take advantage of those\ntwo mechanisms.\n\nDespite the name of the package, currently this middleware only works\nwith nginx\u2019s ``X-Accel-Redirect`` mechanism. (It would probably be\nstraightforward to generalize it so that it works ``X-Sendfile``, but\nat the moment, I have no need for that.)\n\n.. _Nginx: http://nginx.org/en/\n.. _X-Accel-Redirect: http://wiki.nginx.org/X-accel\n.. _PEP 333: http://www.python.org/dev/peps/pep-0333/\n.. _wsgi.file_wrapper:\n http://www.python.org/dev/peps/pep-0333/#optional-platform-specific-file-handling\n\n\nDownload & Source\n=================\n\nThe source repository is on github__.\nYou may submit bug reports and pull requests there.\n\n__ https://github.com/dairiki/xsendfile_middleware/\n\nIt is also available via PyPI__.\n\n__ https://pypi.python.org/pypi/xsendfile_middleware/\n\n\nUsage\n=====\n\nThe middleware is ``xsendfile_middleware.xsendfile_middleware``.\nYou can call it directly, e.g.::\n\n from xsendfile_middleware import xsendfile_middleware\n\n def main(**settings):\n \"\"\" Construct and return a filtered app.\n \"\"\"\n def my_app(environ, start_response):\n # ...\n return app_iter\n\n # wrap middleware around app\n return xsendfile_middleware(my_app)\n\nThere is also a suitable entry point provided so that you can instantiate\nthe middleware from a PasteDeploy_ ``.ini`` file, e.g.::\n\n [app:myapp]\n use = egg:MyEgg\n\n [pipeline:main]\n pipeline = egg:xsendfile_middleware myapp\n\n.. _PasteDeploy: http://pythonpaste.org/deploy/\n\nConfiguration\n=============\n\nX_REDIRECT_MAP\n--------------\n\nOnce you have the middleware in place, the only configuration needed\n(or possible) is to set an ``X_REDIRECT_MAP`` key in the WSGI environ.\nHow you do that depends on how you\u2019ve got things set up. If you are\nrunning your app under uwsgi_, for example, then you can use something\nlike the following in your ``nginx`` config::\n\n location /app {\n uwsgi_pass 127.0.0.1:6543;\n include uwsgi_params;\n\n uwsgi_param X_REDIRECT_MAP /path/to/files/=/_redir_/;\n }\n\n location /_redir_/ {\n internal;\n alias /path/to/files/;\n }\n\nIn this configuration, if your app returns an app_iter which is\nan instance of the file wrapper provided by the middleware, and\nthat wrapper wraps file at, *e.g.*,\n``/path/to/files/dir/file.data``,\nthe middleware will set an ``X-Accel-Redirect: /_redir_/dir/file.data``\nheader in the response. (This, hopefully, will cause nginx to send\nthe desired file directly to the client.)\n\n.. _uwsgi: http://uwsgi-docs.readthedocs.org/en/latest/\n\nThe format of ``X_REDIRECT_MAP`` is a comma-separated list of\n\u201c``/prefix/=/base_uri/``\u201d mappings. As a short-cut, \u201c``/prefix/``\u201d\n(with no equals sign) means the same as \u201c``/prefix/=/prefix/``\u201d (an\n``X-Accel-Redirect`` header containing the original file name will be\nsent for matching paths.) The entries in the map are checked in\norder; the first matching entry wins. If none of the entries match,\nthen the middleware will pass the response on up the chain unmolested.\n\n**Warning**:\nThe parsing of ``X_REDIRECT_MAP`` is rather simplistic. Things will\nprobably not go well if you try to include commas, equal signs,\nor any non-ASCII characters in either the *prefix* or *base_uri*.\nAlso, do not include any extraneous white space in ``X_REDIRECT_MAP``.\n\nAuthor\n======\n\nThis package was written by `Jeff Dairiki`_.\n\n.. _Jeff Dairiki: mailto:dairiki@dairiki.org\n\n.. |build status| image::\n https://travis-ci.org/dairiki/xsendfile_middleware.svg?branch=master\n :target: https://travis-ci.org/dairiki/xsendfile_middleware\n\n\n=======\nChanges\n=======\n\n0.1.1 (2016-10-28)\n==================\n\n(Release 0.1 does not exist. It had corrupt rST in its PKG-INFO\ncausing the README on PyPI not to be formatted.)\n\nNo changes (other than test configuration) from 0.1a3. This package\nhas been used in production for years now \u2014 might as well drop the\n\u201calpha\u201d designation.\n\nTesting\n-------\n\n* Drop support for python 3.2. Now tested under pythons 2.6, 2.7,\n 3.3, 3.4, 3.5, pypy and pypy3.\n\n0.1a3 (2015-05-08)\n==================\n\nBrown bag. The previous release was unusable do to this bug:\n\n* Make sure not to include unicode strings in the headers passed to\n ``start_response``.\n\n0.1a2 (2015-05-08)\n==================\n\n* Py3k, pypy compatibility: the tests now run under python 2.6, 2.7,\n 3.2, 3.3, 3.4, pypy and pypy3.\n\n0.1a1 (2013-12-11)\n==================\n\nInitial Release\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dairiki/xsendfile_middleware", "keywords": "wsgi middleware paste x-accel-redirect nginx file_wrapper", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "xsendfile_middleware", "package_url": "https://pypi.org/project/xsendfile_middleware/", "platform": "Any", "project_url": "https://pypi.org/project/xsendfile_middleware/", "project_urls": { "Homepage": "https://github.com/dairiki/xsendfile_middleware" }, "release_url": "https://pypi.org/project/xsendfile_middleware/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "WSGI middleware to send files using X-Accel-Redirect", "version": "0.1.1" }, "last_serial": 2429873, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "708d0eec1426b2dcced56a31e4ac8440", "sha256": "88541ac8d2bb100a3478eaed9dfccc9a16fa7fb49d27de9c1c012e2dcf221160" }, "downloads": -1, "filename": "xsendfile_middleware-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "708d0eec1426b2dcced56a31e4ac8440", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11435, "upload_time": "2016-10-28T23:26:05", "url": "https://files.pythonhosted.org/packages/3f/08/a32a4cf1e1eb51f631cc15cd64478e2ca1a4e2c152919de149701886b2b1/xsendfile_middleware-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "428e27c57816969b266ed537aba7cce7", "sha256": "0cbc008b165e75e64557273a425b02c37dc5a08cfc09ba6bf3c11c070d609f33" }, "downloads": -1, "filename": "xsendfile_middleware-0.1.1.tar.gz", "has_sig": false, "md5_digest": "428e27c57816969b266ed537aba7cce7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8198, "upload_time": "2016-10-28T23:26:02", "url": "https://files.pythonhosted.org/packages/7a/2c/3adb7fbd50408f32c50a042295a91a9e31dcbe48a3a0d27211341e5a67d9/xsendfile_middleware-0.1.1.tar.gz" } ], "0.1a1": [ { "comment_text": "", "digests": { "md5": "0ca9dd3aba8739b7a4dab86cfcf9fb0d", "sha256": "5b887885b1fd6fdef27f5a447ba876363e23eaf988433813537c3e44c8d58372" }, "downloads": -1, "filename": "xsendfile_middleware-0.1a1.tar.gz", "has_sig": true, "md5_digest": "0ca9dd3aba8739b7a4dab86cfcf9fb0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6964, "upload_time": "2013-12-12T01:07:41", "url": "https://files.pythonhosted.org/packages/91/7f/d3063e7bc80a8a6e701dd193c70442ccd1fee64755ded0dae4bd4f8d87a0/xsendfile_middleware-0.1a1.tar.gz" } ], "0.1a3": [ { "comment_text": "", "digests": { "md5": "7fd9fc4ec58b916401b7dcbc5ef9b6fd", "sha256": "3e6360bde69d9637b96ab408aee51165c964c7fe7964b129ec57f40365d4e067" }, "downloads": -1, "filename": "xsendfile_middleware-0.1a3-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "7fd9fc4ec58b916401b7dcbc5ef9b6fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11012, "upload_time": "2015-05-08T21:30:03", "url": "https://files.pythonhosted.org/packages/90/f5/b0656a92a40265bfadf46ae721fee4d79eaa17382696aedbd5d75792fd4d/xsendfile_middleware-0.1a3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0a32b19b4f81131f3dac534f2cfbc7fd", "sha256": "df8aaa557e7ebb1da43d46c7b1eb60ff7a2c56649dfa8f305f573380caf80425" }, "downloads": -1, "filename": "xsendfile_middleware-0.1a3.tar.gz", "has_sig": true, "md5_digest": "0a32b19b4f81131f3dac534f2cfbc7fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7876, "upload_time": "2015-05-08T21:29:47", "url": "https://files.pythonhosted.org/packages/24/2d/1f4d787904f972001ca0664e551283f62e328e6508e473792e27498bc124/xsendfile_middleware-0.1a3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "708d0eec1426b2dcced56a31e4ac8440", "sha256": "88541ac8d2bb100a3478eaed9dfccc9a16fa7fb49d27de9c1c012e2dcf221160" }, "downloads": -1, "filename": "xsendfile_middleware-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "708d0eec1426b2dcced56a31e4ac8440", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11435, "upload_time": "2016-10-28T23:26:05", "url": "https://files.pythonhosted.org/packages/3f/08/a32a4cf1e1eb51f631cc15cd64478e2ca1a4e2c152919de149701886b2b1/xsendfile_middleware-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "428e27c57816969b266ed537aba7cce7", "sha256": "0cbc008b165e75e64557273a425b02c37dc5a08cfc09ba6bf3c11c070d609f33" }, "downloads": -1, "filename": "xsendfile_middleware-0.1.1.tar.gz", "has_sig": false, "md5_digest": "428e27c57816969b266ed537aba7cce7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8198, "upload_time": "2016-10-28T23:26:02", "url": "https://files.pythonhosted.org/packages/7a/2c/3adb7fbd50408f32c50a042295a91a9e31dcbe48a3a0d27211341e5a67d9/xsendfile_middleware-0.1.1.tar.gz" } ] }