http-relay


Namehttp-relay JSON
Version 2.1.3 PyPI version JSON
download
home_pagehttps://github.com/ctu-vras/http_relay
SummaryRelay for HTTP messages (reverse proxy)
upload_time2023-09-13 08:27:04
maintainerMartin Pecka
docs_urlNone
authorMartin Pecka
requires_python>=2.7
licenseBSD 3-Clause License Copyright (c) 2023, Czech Technical University in Prague Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of the copyright holder 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 HOLDER 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.
keywords http proxy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
SPDX-License-Identifier: BSD-3-Clause
SPDX-FileCopyrightText: Czech Technical University in Prague
-->

# http-relay

Relay HTTP requests from localhost to a remote host (act as reverse HTTP proxy).

This HTTP relay properly processes also the nonstandard HTTP responses like `ICY 200 OK` produced by Shoutcast or NTRIP streaming servers.

The relay works properly with hostnames, IPv4 and IPv6 addresses. IPv6 addresses can be specified with or without `[]`. 

## Usage

```
usage: http-relay [-h] [-n NUM_THREADS] [-b BUFFER_SIZE] [-t SIGKILL_TIMEOUT] [-s] host [port] [local_port] [local_addr]

positional arguments:
  host                  The remote host to connect to (e.g. "cvut.cz")
  port                  The remote host's port to connect to (e.g. 80).
  local_port            The local port to be used for the relay. If left out, will be the same as remote port.
  local_addr            Local interface (IP or hostname) to run the relay on. By default, it runs on all IPv4 interfaces (0.0.0.0).

optional arguments:
  -h, --help            show this help message and exit
  -n NUM_THREADS, --num-threads NUM_THREADS
                        Number of threads servicing the incoming requests.
  -b BUFFER_SIZE, --buffer-size BUFFER_SIZE
                        Size of the buffer used for reading responses. Generally, a larger buffer should be more efficient, but if it is too large, the local clients may time out before they receive any data.
  -t SIGKILL_TIMEOUT, --sigkill-timeout SIGKILL_TIMEOUT
                        If specified, the relay will be sigkilled in this number of seconds.
  -s, --sigkill-on-stream-stop
                        If True, --sigkill-timeout will not be counted when no requests are active, and during requests, each successful data transmission will reset the timeout. This can be used to detect
                        stale streams if you expect an application to be constantly receiving data.

```

## Python module

This package also provides Python module `http_relay`. You can start the relay as a part of your application like this:

```python
from http_relay import run

# ...

run("0.0.0.0", 80, "cvut.cz", 80)
```

## Examples

```bash
http-relay cvut.cz 80 8080  # redirects local port 8080 to cvut.cz:80
http-relay cvut.cz 2101  # redirects local port 2101 to cvut.cz:2101
http-relay cvut.cz 80 8080 localhost  # redirects localhost:8080 to cvut.cz:80 (i.e. no external access to the 8080 port)

http-relay stream.cz 2101 -t 10 -s  # redirects local port 2101 to stream.cz and kills the relay after 10 secs if a stream is being downloaded and becomes stale
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ctu-vras/http_relay",
    "name": "http-relay",
    "maintainer": "Martin Pecka",
    "docs_url": null,
    "requires_python": ">=2.7",
    "maintainer_email": "Martin Pecka <peci1@seznam.cz>",
    "keywords": "http,proxy",
    "author": "Martin Pecka",
    "author_email": "Martin Pecka <peci1@seznam.cz>",
    "download_url": "https://files.pythonhosted.org/packages/54/fe/a1d216fc990e3405c4630e95b347c5aa9e06638eae148ad93c44e4239916/http-relay-2.1.3.tar.gz",
    "platform": null,
    "description": "<!--\nSPDX-License-Identifier: BSD-3-Clause\nSPDX-FileCopyrightText: Czech Technical University in Prague\n-->\n\n# http-relay\n\nRelay HTTP requests from localhost to a remote host (act as reverse HTTP proxy).\n\nThis HTTP relay properly processes also the nonstandard HTTP responses like `ICY 200 OK` produced by Shoutcast or NTRIP streaming servers.\n\nThe relay works properly with hostnames, IPv4 and IPv6 addresses. IPv6 addresses can be specified with or without `[]`. \n\n## Usage\n\n```\nusage: http-relay [-h] [-n NUM_THREADS] [-b BUFFER_SIZE] [-t SIGKILL_TIMEOUT] [-s] host [port] [local_port] [local_addr]\n\npositional arguments:\n  host                  The remote host to connect to (e.g. \"cvut.cz\")\n  port                  The remote host's port to connect to (e.g. 80).\n  local_port            The local port to be used for the relay. If left out, will be the same as remote port.\n  local_addr            Local interface (IP or hostname) to run the relay on. By default, it runs on all IPv4 interfaces (0.0.0.0).\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -n NUM_THREADS, --num-threads NUM_THREADS\n                        Number of threads servicing the incoming requests.\n  -b BUFFER_SIZE, --buffer-size BUFFER_SIZE\n                        Size of the buffer used for reading responses. Generally, a larger buffer should be more efficient, but if it is too large, the local clients may time out before they receive any data.\n  -t SIGKILL_TIMEOUT, --sigkill-timeout SIGKILL_TIMEOUT\n                        If specified, the relay will be sigkilled in this number of seconds.\n  -s, --sigkill-on-stream-stop\n                        If True, --sigkill-timeout will not be counted when no requests are active, and during requests, each successful data transmission will reset the timeout. This can be used to detect\n                        stale streams if you expect an application to be constantly receiving data.\n\n```\n\n## Python module\n\nThis package also provides Python module `http_relay`. You can start the relay as a part of your application like this:\n\n```python\nfrom http_relay import run\n\n# ...\n\nrun(\"0.0.0.0\", 80, \"cvut.cz\", 80)\n```\n\n## Examples\n\n```bash\nhttp-relay cvut.cz 80 8080  # redirects local port 8080 to cvut.cz:80\nhttp-relay cvut.cz 2101  # redirects local port 2101 to cvut.cz:2101\nhttp-relay cvut.cz 80 8080 localhost  # redirects localhost:8080 to cvut.cz:80 (i.e. no external access to the 8080 port)\n\nhttp-relay stream.cz 2101 -t 10 -s  # redirects local port 2101 to stream.cz and kills the relay after 10 secs if a stream is being downloaded and becomes stale\n```\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2023, Czech Technical University in Prague  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. 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.  3. Neither the name of the copyright holder 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 HOLDER 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. ",
    "summary": "Relay for HTTP messages (reverse proxy)",
    "version": "2.1.3",
    "project_urls": {
        "Homepage": "https://github.com/ctu-vras/http_relay"
    },
    "split_keywords": [
        "http",
        "proxy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b38a877670a15589868663cfb570e9a2da2e8455ee9a9817e37e52459022f421",
                "md5": "5e6fa1aa43aaef98e1376e4c337244e4",
                "sha256": "e476e3867cbf38165290113e69387c0330dd3687ed5c54688ae78aea73f4914e"
            },
            "downloads": -1,
            "filename": "http_relay-2.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5e6fa1aa43aaef98e1376e4c337244e4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=2.7",
            "size": 10804,
            "upload_time": "2023-09-13T08:27:02",
            "upload_time_iso_8601": "2023-09-13T08:27:02.457143Z",
            "url": "https://files.pythonhosted.org/packages/b3/8a/877670a15589868663cfb570e9a2da2e8455ee9a9817e37e52459022f421/http_relay-2.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "54fea1d216fc990e3405c4630e95b347c5aa9e06638eae148ad93c44e4239916",
                "md5": "b02341932decdd5c4b838ba6f58a78b4",
                "sha256": "15f5d218cfa6d7187e47f0aefce725bd7445d1c5bcb9f285435eda3ec9fb9ddc"
            },
            "downloads": -1,
            "filename": "http-relay-2.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "b02341932decdd5c4b838ba6f58a78b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7",
            "size": 12025,
            "upload_time": "2023-09-13T08:27:04",
            "upload_time_iso_8601": "2023-09-13T08:27:04.043040Z",
            "url": "https://files.pythonhosted.org/packages/54/fe/a1d216fc990e3405c4630e95b347c5aa9e06638eae148ad93c44e4239916/http-relay-2.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-13 08:27:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ctu-vras",
    "github_project": "http_relay",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "http-relay"
}
        
Elapsed time: 0.11826s