├── docs ├── _data │ ├── terms.yml │ ├── glossary.yml │ ├── definitions.yml │ ├── tags.yml │ ├── topnav.yml │ ├── sidebars │ │ └── home_sidebar.yml │ └── alerts.yml ├── .gitignore ├── _layouts │ ├── none.html │ ├── page_print.html │ ├── default_print.html │ ├── page.html │ └── default.html ├── images │ ├── favicon.ico │ ├── company_logo.png │ ├── doc_example.png │ ├── workflowarrow.png │ ├── export_example.png │ ├── company_logo_big.png │ └── colab.svg ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── _includes │ ├── inline_image.html │ ├── callout.html │ ├── note.html │ ├── tip.html │ ├── important.html │ ├── warning.html │ ├── archive.html │ ├── notebook_colab_link.html │ ├── image.html │ ├── search_google_custom.html │ ├── footer.html │ ├── google_analytics.html │ ├── toc.html │ ├── search_simple_jekyll.html │ ├── links.html │ ├── head_print.html │ ├── sidebar.html │ ├── topnav.html │ ├── initialize_shuffle.html │ └── head.html ├── css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ ├── boxshadowproperties.css │ ├── modern-business.css │ ├── theme-green.css │ ├── theme-blue.css │ ├── printstyles.css │ └── syntax.css ├── Gemfile ├── sidebar.json ├── tooltips.json ├── sitemap.xml ├── js │ ├── jquery.ba-throttle-debounce.min.js │ ├── customscripts.js │ ├── jquery.navgoco.min.js │ ├── toc.js │ └── jekyll-search.js ├── licenses │ ├── LICENSE │ └── LICENSE-BSD-NAVGOCO.txt ├── _config.yml ├── feed.xml ├── decorator.html ├── index.html └── http.html ├── examples ├── Caddyfile ├── cgi-bin │ ├── Caddyfile │ └── say_hello.py ├── say_hello_fcgi.py ├── README.md └── say_hello_handler.py ├── fastcgi ├── __init__.py ├── _nbdev.py ├── decorator.py ├── http.py └── core.py ├── MANIFEST.in ├── CHANGELOG.md ├── get_http2fcgi.sh ├── .github ├── workflows │ ├── main.yml │ └── python.yml └── scripts │ └── build.sh ├── Makefile ├── settings.ini ├── .gitignore ├── CONTRIBUTING.md ├── setup.py ├── README.md ├── 01_decorator.ipynb ├── index.ipynb ├── LICENSE ├── 02_http.ipynb └── 00_core.ipynb /docs/_data/terms.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _site/ 2 | -------------------------------------------------------------------------------- /docs/_data/glossary.yml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_data/definitions.yml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_layouts/none.html: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | {{content}} -------------------------------------------------------------------------------- /docs/_data/tags.yml: -------------------------------------------------------------------------------- 1 | allowed-tags: 2 | - getting_started 3 | - navigation 4 | -------------------------------------------------------------------------------- /examples/Caddyfile: -------------------------------------------------------------------------------- 1 | :8000 2 | 3 | reverse_proxy unix/fcgi.sock { transport fastcgi } 4 | 5 | -------------------------------------------------------------------------------- /docs/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/images/favicon.ico -------------------------------------------------------------------------------- /examples/cgi-bin/Caddyfile: -------------------------------------------------------------------------------- 1 | :1234 2 | reverse_proxy unix/fcgi.sock { transport fastcgi } 3 | 4 | -------------------------------------------------------------------------------- /docs/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /docs/images/company_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/images/company_logo.png -------------------------------------------------------------------------------- /docs/images/doc_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/images/doc_example.png -------------------------------------------------------------------------------- /docs/images/workflowarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/images/workflowarrow.png -------------------------------------------------------------------------------- /docs/_includes/inline_image.html: -------------------------------------------------------------------------------- 1 | {{include.alt}} 2 | -------------------------------------------------------------------------------- /docs/css/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/css/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /docs/images/export_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/images/export_example.png -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/images/company_logo_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/images/company_logo_big.png -------------------------------------------------------------------------------- /docs/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /fastcgi/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "0.0.3" 2 | from .core import * 3 | from .decorator import * 4 | from .http import * 5 | -------------------------------------------------------------------------------- /docs/_includes/callout.html: -------------------------------------------------------------------------------- 1 |
{{include.content}}
2 | -------------------------------------------------------------------------------- /docs/css/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/css/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/css/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/css/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/css/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/css/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/css/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/css/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include settings.ini 2 | include LICENSE 3 | include CONTRIBUTING.md 4 | include README.md 5 | recursive-exclude * __pycache__ 6 | -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fastai/fastcgi/HEAD/docs/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem 'github-pages', group: :jekyll_plugins 4 | 5 | gem "nokogiri" 6 | gem "jekyll" 7 | gem "kramdown" 8 | -------------------------------------------------------------------------------- /docs/_includes/note.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_includes/tip.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_includes/important.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_includes/warning.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/sidebar.json: -------------------------------------------------------------------------------- 1 | { 2 | "fastcgi": { 3 | "Overview": "/", 4 | "fastcgi API": "core.html", 5 | "fastcgi.decorator": "decorator.html", 6 | "fastcgi.http": "http.html" 7 | } 8 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Release notes 2 | 3 | 4 | 5 | 6 | ## 0.0.1 7 | 8 | ### New Features 9 | 10 | - add http handler ([#1](https://github.com/fastai/fastcgi/issues/1)) 11 | 12 | -------------------------------------------------------------------------------- /docs/_data/topnav.yml: -------------------------------------------------------------------------------- 1 | topnav: 2 | - title: Topnav 3 | items: 4 | - title: github 5 | external_url: https://github.com/fastai/fastcgi/tree/master/ 6 | 7 | #Topnav dropdowns 8 | topnav_dropdowns: 9 | - title: Topnav dropdowns 10 | folders: -------------------------------------------------------------------------------- /docs/_includes/archive.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | type: archive 4 | --- 5 | 6 |
7 |

{{ page.title }}

8 |
9 |
10 | 11 | {{ content }} 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/say_hello_fcgi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from fastcgi import * 3 | from time import sleep 4 | 5 | @fastcgi 6 | def hello(): 7 | name = sys.stdin.read() 8 | sys.stdout.write(f'Content-type: text/html\n\nHello {name}\n') 9 | sys.stdout.write(f'{os.environ}\n') 10 | 11 | -------------------------------------------------------------------------------- /examples/cgi-bin/say_hello.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from fastcore.script import * 3 | import sys,os 4 | 5 | @call_parse 6 | def hello(): 7 | length = int(os.environ.get('CONTENT_LENGTH', 0)) 8 | name = sys.stdin.read(length) 9 | sys.stdout.write(f'Content-type: text/html\r\n\r\nHello {name}\r\n') 10 | 11 | -------------------------------------------------------------------------------- /docs/_includes/notebook_colab_link.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | Open In Colab 4 | 5 |
6 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # CGI and FastCGI examples 2 | 3 | ## CGI 4 | 5 | Run `python -m http.server --cgi 8000` in this directory. Then in another terminal: 6 | 7 | curl 'localhost:8000/cgi-bin/say_hello.py' -X POST -d yourname 8 | 9 | Take a look at the `say_hello.py` script - it's only 3 lines of code. 10 | 11 | ## FastCGI 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/tooltips.json: -------------------------------------------------------------------------------- 1 | --- 2 | layout: null 3 | search: exclude 4 | --- 5 | 6 | { 7 | "entries": 8 | [ 9 | {% for page in site.tooltips %} 10 | { 11 | "doc_id": "{{ page.doc_id }}", 12 | "body": "{{ page.content | strip_newlines | replace: '\', '\\\\' | replace: '"', '\\"' }}" 13 | } {% unless forloop.last %},{% endunless %} 14 | {% endfor %} 15 | ] 16 | } 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /get_http2fcgi.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | nm=http2fcgi 5 | case "$OSTYPE" in 6 | darwin*) os=darwin; ;; 7 | linux*) os=linux; ;; 8 | windows*) os=windows; ;; 9 | *) echo "unknown: $OSTYPE" ;; 10 | esac 11 | 12 | [[ -f $nm ]] && exit 13 | wget -qO- https://github.com/fastai/$nm/releases/latest/download/$nm-$os-amd64.tgz | tar xz 14 | chmod u+x $nm 15 | 16 | -------------------------------------------------------------------------------- /docs/_includes/image.html: -------------------------------------------------------------------------------- 1 |
{% if {{include.url}} %}{% endif %}{{include.alt}}{% if {{include.url}} %}{% endif %}{% if {{include.caption}} %}
{{include.caption}}
{% endif %}
2 | -------------------------------------------------------------------------------- /docs/_layouts/page_print.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default_print 3 | comments: true 4 | --- 5 |
6 |

{{ page.title }}

7 |
8 | 9 |
10 | 11 | {% if page.summary %} 12 |
{{page.summary}}
13 | {% endif %} 14 | {{ content }} 15 |
16 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [push, pull_request, workflow_dispatch] 3 | jobs: 4 | build: 5 | runs-on: ubuntu-20.04 6 | steps: 7 | - uses: actions/checkout@v1 8 | - uses: actions/setup-python@v2 9 | with: {python-version: '3.8'} 10 | - name: Install and test 11 | run: | 12 | pip install --upgrade --upgrade-strategy eager -e .[dev] 13 | bash .github/scripts/build.sh 14 | -------------------------------------------------------------------------------- /.github/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | fail() { echo -e "::error::${1}"; exit 1; } 4 | 5 | nbdev_read_nbs 6 | nbdev_clean_nbs 7 | status=$(git status -uno -s) 8 | [[ -n "${status}" ]] && fail "Detected unstripped out notebooks.\nRemember to run nbdev_install_git_hooks.\n\n${status}" 9 | diffs=$(nbdev_diff_nbs) 10 | [[ -n "${diffs}" ]] && fail "Detected difference between the notebooks and the library.\n\n${diffs}" 11 | make test 12 | -------------------------------------------------------------------------------- /examples/say_hello_handler.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from fastcgi import * 3 | from pathlib import Path 4 | from socketserver import UnixStreamServer,TCPServer 5 | from warnings import warn 6 | 7 | class TestHandler(FcgiHandler): 8 | def handle(self): 9 | self.print(f'Content-type: text/html\n\nHello {self.content()}') 10 | 11 | p = Path('fcgi.sock') 12 | if p.exists(): p.unlink() 13 | with UnixStreamServer(str(p), TestHandler) as srv: srv.serve_forever() 14 | 15 | -------------------------------------------------------------------------------- /docs/_includes/search_google_custom.html: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 | 15 |
16 | 17 | -------------------------------------------------------------------------------- /docs/_includes/footer.html: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /.github/workflows/python.yml: -------------------------------------------------------------------------------- 1 | name: Cache 2 | on: 3 | workflow_dispatch: 4 | 5 | jobs: 6 | test: 7 | runs-on: ubuntu-20.04 8 | steps: 9 | - uses: actions/checkout@v1 10 | - uses: actions/setup-python@v2 11 | with: 12 | python-version: '3.8' 13 | - uses: actions/cache@v2 14 | with: 15 | path: ${{ env.pythonLocation }} 16 | key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('settings.ini') }} 17 | - name: Install requirements 18 | run: pip install --upgrade --upgrade-strategy eager -e .[dev] 19 | -------------------------------------------------------------------------------- /docs/_layouts/default_print.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% include head_print.html %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 |
16 | 17 | {{content}} 18 |
19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/_includes/google_analytics.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% if site.google_analytics %} 4 | 5 | 6 | {% endif %} -------------------------------------------------------------------------------- /docs/sitemap.xml: -------------------------------------------------------------------------------- 1 | --- 2 | layout: none 3 | search: exclude 4 | --- 5 | 6 | 7 | 8 | {% for post in site.posts %} 9 | {% unless post.search == "exclude" %} 10 | 11 | {{site.url}}{{post.url}} 12 | 13 | {% endunless %} 14 | {% endfor %} 15 | 16 | 17 | {% for page in site.pages %} 18 | {% unless page.search == "exclude" %} 19 | 20 | {{site.url}}{{ page.url}} 21 | 22 | {% endunless %} 23 | {% endfor %} 24 | -------------------------------------------------------------------------------- /docs/css/boxshadowproperties.css: -------------------------------------------------------------------------------- 1 | /* box-shadow fonts return errors with prince, so extracting here to put in web output only */ 2 | 3 | #search-demo-container ul#results-container { 4 | box-shadow: 2px 3px 2px #dedede; 5 | } 6 | 7 | 8 | hr.shaded { 9 | box-shadow: inset 0 6px 6px -6px rgba(0,0,0,0.5); 10 | } 11 | 12 | .videoThumbs img { 13 | box-shadow: 2px 2px 1px #f0f0f0; 14 | } 15 | 16 | .box { 17 | box-shadow: 2px 2px 4px #dedede; 18 | } 19 | 20 | @media (max-width: 1200px) { 21 | .navbar-collapse { 22 | box-shadow: inset 0 1px 0 rgba(255,255,255,0.1); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .ONESHELL: 2 | SHELL := /bin/bash 3 | SRC = $(wildcard ./*.ipynb) 4 | 5 | all: fastcgi docs 6 | 7 | fastcgi: $(SRC) 8 | nbdev_build_lib 9 | touch fastcgi 10 | 11 | sync: 12 | nbdev_update_lib 13 | 14 | docs_serve: docs 15 | cd docs && bundle exec jekyll serve 16 | 17 | docs: $(SRC) 18 | nbdev_build_docs 19 | touch docs 20 | 21 | test: 22 | nbdev_test_nbs --n_workers 0 23 | 24 | release: pypi conda_release 25 | nbdev_bump_version 26 | 27 | conda_release: 28 | fastrelease_conda_package 29 | 30 | pypi: dist 31 | twine upload --repository pypi dist/* 32 | 33 | dist: clean 34 | python setup.py sdist bdist_wheel 35 | 36 | clean: 37 | rm -rf dist 38 | -------------------------------------------------------------------------------- /docs/_data/sidebars/home_sidebar.yml: -------------------------------------------------------------------------------- 1 | 2 | ################################################# 3 | ### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ### 4 | ################################################# 5 | # Instead edit ../../sidebar.json 6 | entries: 7 | - folders: 8 | - folderitems: 9 | - output: web,pdf 10 | title: Overview 11 | url: / 12 | - output: web,pdf 13 | title: fastcgi API 14 | url: core.html 15 | - output: web,pdf 16 | title: fastcgi.decorator 17 | url: decorator.html 18 | - external_url: http.html 19 | output: web,pdf 20 | title: fastcgi.http 21 | output: web 22 | title: fastcgi 23 | output: web 24 | title: Sidebar 25 | -------------------------------------------------------------------------------- /settings.ini: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | host = github 3 | lib_name = fastcgi 4 | user = fastai 5 | description = A fastcgi handler for Python's `socketserver` classes 6 | keywords = fastcgi python http socketserver server 7 | author = Jeremy Howard 8 | author_email = info@fast.ai 9 | copyright = fast.ai, Inc 10 | branch = master 11 | version = 0.0.3 12 | min_python = 3.6 13 | audience = Developers 14 | language = English 15 | license = apache2 16 | status = 3 17 | requirements = fastcore 18 | dev_requirements = nbdev jupyter 19 | nbs_path = . 20 | doc_path = docs 21 | doc_host = https://fastai.github.io 22 | doc_baseurl = /fastcgi/ 23 | git_url = https://github.com/fastai/fastcgi/tree/master/ 24 | lib_path = fastcgi 25 | title = fastcgi 26 | 27 | -------------------------------------------------------------------------------- /docs/js/jquery.ba-throttle-debounce.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery throttle / debounce - v1.1 - 3/7/2010 3 | * http://benalman.com/projects/jquery-throttle-debounce-plugin/ 4 | * 5 | * Copyright (c) 2010 "Cowboy" Ben Alman 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://benalman.com/about/license/ 8 | */ 9 | (function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); -------------------------------------------------------------------------------- /docs/_includes/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 |
22 | -------------------------------------------------------------------------------- /docs/_includes/search_simple_jekyll.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 | 6 | 17 | -------------------------------------------------------------------------------- /docs/_data/alerts.yml: -------------------------------------------------------------------------------- 1 | tip: '