Skip to main content

A small HTTP file server with directory browsing and uploads.

Project description

simple_http_server

Features

  • ✔ simple
  • ✔ upload
  • ✔ batch upload
  • ✔ download
  • ✔ support python2, python3
  • ✔ Multi-threaded

Usage

# get code
$ git clone https://github.com/freelamb/simple_http_server.git

# enter directory
$ cd simple_http_server

# run server
$ python simple_http_server.py 8000

# allow upload requests up to 1 GiB
$ python simple_http_server.py --max-upload-size 1024 8000

# expose to another host in a trusted network
$ python simple_http_server.py --bind 0.0.0.0 8000

Install from PyPI after a release is published:

$ python -m pip install simple-http-server-upload
$ simple-http-server-upload 8000
# run as docker container
# 1.build the image('.' below refer to the root path of this project)
docker build -t freelamb/simple_http_server .
# 2.run the container using the image built just now in docker 
docker run 
  --name simple_http_server \ 
  -p 8000:8000 \ 
  -v /opt/data:/opt/data \ 
  -d freelamb/simple_http_server:latest

Security

This server is intended for temporary file sharing in trusted environments. The default bind address is 127.0.0.1; use --bind 0.0.0.0 only when you explicitly want other hosts to connect.

Uploaded file names are sanitized, upload results and directory listings escape user-controlled text, and upload requests larger than 100 MiB are rejected by default. Use --max-upload-size MIB to raise that limit in trusted environments.

Example

Todo

  • add docker images

Contributing

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
  2. Fork the repository_ on GitHub to start making your changes to the master branch (or branch off of it).
  3. Write a test which shows that the bug was fixed or that the feature works as expected.
  4. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_.

Changelog

Changelog

reference

https://github.com/tualatrix/tools/blob/master/SimpleHTTPServerWithUpload.py

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_http_server_upload-0.3.5.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_http_server_upload-0.3.5-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file simple_http_server_upload-0.3.5.tar.gz.

File metadata

File hashes

Hashes for simple_http_server_upload-0.3.5.tar.gz
Algorithm Hash digest
SHA256 87d21a4667a0055726dedbd669b017a512adc0de96b753edcb3e9dccbf459e08
MD5 ee4eab4b32867b7ea788802c95a8889b
BLAKE2b-256 b0b554037942d809a569d240d2ac8377a99072c450526601a202e9002649ddad

See more details on using hashes here.

File details

Details for the file simple_http_server_upload-0.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_http_server_upload-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e06431922df51f3596e3128dd364dd4620ba5f45c0652c72df550f9df35a8250
MD5 7a945c0199b1e6d090501e942bca2f6b
BLAKE2b-256 044d5dd5c5ea1b345a9d22cfab636acc3d0829810b5a7e489f7248623041395e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page