{ "info": { "author": "Jakub Roztocil", "author_email": "jakub@roztocil.co", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development", "Topic :: System :: Networking", "Topic :: Terminals", "Topic :: Text Processing", "Topic :: Utilities" ], "description": "# `httpcat`\n\n[![Build Status](https://travis-ci.org/jkbrzt/httpcat.svg?branch=master)](https://travis-ci.org/jkbrzt/httpcat)\n\n``httpcat`` is a simple utility for constructing raw HTTP\nrequests on the command line.\n\n\n## Why?\n\nSometimes it is useful to be able to create an actual raw \n[HTTP request](https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html)\non the command line:\n \n* To debug a server issue\n* To test the handling of invalid HTTP requests\n* To learn how HTTP works under the hood\n\nIn such cases, existing CLI HTTP clients\u2014such as \n[`httpie`](https://httpie.org),\n[`curl`](https://curl.haxx.se/), \nor [`wget`](https://www.gnu.org/software/wget/) \n\u2014are too high-level as they provide\nan abstraction layer and one doesn't have a complete control over the \nexact raw data that gets written to the HTTP socket connection.\n\nLower-level tools, such as the popular \n[`netcat`](https://en.wikipedia.org/wiki/Netcat), are better suited for this \njob.\n\nHowever, the syntax of HTTP requires headers to be separated with \n`\\r\\n` which makes it difficult to produce them on the command line. \nA typical solution involves the use of `echo`:\n\n\n```bash\n$ echo -ne 'GET / HTTP/1.1\\r\\nHost: httpbin.org\\r\\nContent-Length: 5\\r\\n\\r\\nHello' | \\\n nc localhost 8000\n```\n\n`httpcat` makes this easier:\n\n\n## How it works\n\n1. Reads command arguments as lines and then lines from ``stdin``\n2. Auto-completes them, if necessary\n3. Writes them to ``stdout``\n\n\n## Features\n\n* Automatic ``\\r\\n`` completion\n* Automatic `Method` completion in `Request-Line`\n* Automatic `HTTP-Version` completion in `Request-Line`\n\n\n## Usage\n\nInteractively create a request and send it with `nc`:\n\n```bash\n$ httpcat -v | nc httpbin.org 80\nPOST /post HTTP/1.1\n> POST /post HTTP/1.1\\r\\n\nHost: httpbin.org\n> Host: httpbin.org\\r\\n\nContent-Length: 6\n> Content-Length: 6\\r\\n\n\n> \\r\\n\n> Hello\n```\n\nSpecify the whole request in the arguments. Here `''` represents an empty\nline which will be converted to `\\r\\n\\` separating the headers and the body. \nNote also that the omitted `HTTP-Version` is auto-completed:\n\n```bash\nhttpcat -v 'POST /post' 'Host: httpbin.org' 'Content-Length: 5' '' 'Hello' | nc httpbin.org 80\n> POST /post HTTP/1.1\\r\\n\n> Host: httpbin.org\\r\\n\n> Content-Length: 5\\r\\n\n> \\r\\n\n> Hello\n\n```\n\nSpecify headers and body on the command line. \nNote that the omitted `Method` is set to `GET` and `HTTP-Version` \nis auto-completed:\n\n```bash\n$ httpcat -vn '/' 'Host: example.org' '' | nc example.org 80\n-> GET / HTTP/1.1\\r\\n\n-> Host: example.org\\r\\n\n-> \\r\\n [headers written]\n```\n\nYou can, for example, use `stdin` for data and arguments for headers: \n\n```bash\ncat file.txt | httpcat -v 'POST /post' 'Host: httpbin.org' 'Content-Length: 16' '' | nc httpbin.org 80\n> POST /post HTTP/1.1\\r\\n\n> Host: httpbin.org\\r\\n\n> Content-Length: 16\\r\\n\n> \\r\\n\n> Hello from file\n```\n\nSee also `httpcat --help`:\n\n```\nusage: httpcat [-h] [-V, --version] [-v] [-n] [line [line ...]]\n\nCreate raw HTTP requests on the command line.\n\npositional arguments:\n line input lines read before lines from stdin\n\noptional arguments:\n -h, --help show this help message and exit\n -V, --version show program's version number and exit\n -v, --verbose print info about output lines to stderr\n -n, --no-stdin disable reading of lines from stdin\n```\n\n\n## Dependencies\n\n* Python 3\n\n\n## Installation\n\n\n```bash\npip3 install httpcat\n```\n\nAlternatively, you can just download `httpcat.py` manually and invoke \nit as `./httpcat.py` instead of `httpcat`. \n\n\n## Tests\n\n```bash\npython3 setup.py test\n```\n\n## Changelog\n\n\n* `0.0.2` (2016-12-13)\n * Added `-v, --verbose` and the command is more quiet by default.\n * Added `-n, --no-stdin`\n * Added `-h, --help` \n * Added `-V, --version`\n\n* `0.0.1` (2016-12-12)\n * Initial release.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/jkbrzt/httpcat", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jkbrzt/httpcat", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "httpcat", "package_url": "https://pypi.org/project/httpcat/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/httpcat/", "project_urls": { "Download": "https://github.com/jkbrzt/httpcat", "Homepage": "https://github.com/jkbrzt/httpcat" }, "release_url": "https://pypi.org/project/httpcat/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "Create raw HTTP requests on the command line.", "version": "0.0.2" }, "last_serial": 2516850, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4ce7e4bb3bf667c35d1d10ee71fa455d", "sha256": "3cd51b5e98333fe25263fbc54978dbd85639832ae6735abc727351641369358f" }, "downloads": -1, "filename": "httpcat-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4ce7e4bb3bf667c35d1d10ee71fa455d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4566, "upload_time": "2016-12-12T17:12:12", "url": "https://files.pythonhosted.org/packages/7f/4d/58711228ab08f14c383e208035202c9402f1ba5ea1e4c8edcba585069889/httpcat-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "d3fdd3164e4f93566dd11c4df0079ac9", "sha256": "07a4ffee01518cb81de345305985dc85ccab74d6de91d770c8d03f5e0c470e78" }, "downloads": -1, "filename": "httpcat-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d3fdd3164e4f93566dd11c4df0079ac9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5206, "upload_time": "2016-12-13T17:58:25", "url": "https://files.pythonhosted.org/packages/80/f9/8c5243e4a7856d04691faf94be22b2787dae8eb054feb9570d05522b9cea/httpcat-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d3fdd3164e4f93566dd11c4df0079ac9", "sha256": "07a4ffee01518cb81de345305985dc85ccab74d6de91d770c8d03f5e0c470e78" }, "downloads": -1, "filename": "httpcat-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d3fdd3164e4f93566dd11c4df0079ac9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5206, "upload_time": "2016-12-13T17:58:25", "url": "https://files.pythonhosted.org/packages/80/f9/8c5243e4a7856d04691faf94be22b2787dae8eb054feb9570d05522b9cea/httpcat-0.0.2.tar.gz" } ] }