Compare commits
No commits in common. "f2594c2adf530ef330ebaf1ee54e4b3c6c1b713c" and "864b2161b16e432c8ba19db1914809e080d793af" have entirely different histories.
f2594c2adf
...
864b2161b1
13
ChangeLog
13
ChangeLog
|
@ -1,19 +1,6 @@
|
|||
servefile changelog
|
||||
===================
|
||||
|
||||
|
||||
2020-10-29 v0.5.0
|
||||
-----------------
|
||||
|
||||
0.5.0 released
|
||||
|
||||
* python3 support
|
||||
* test suite
|
||||
* fixed an endless redirect loop when serving ../
|
||||
* added sorting for list view
|
||||
* added lzma/xz as compression method
|
||||
|
||||
|
||||
2015-11-10 v0.4.4
|
||||
-----------------
|
||||
|
||||
|
|
33
README.md
33
README.md
|
@ -1,33 +0,0 @@
|
|||
Servefile
|
||||
=========
|
||||
|
||||
Serve files from shell via a small HTTP server. The server redirects all HTTP
|
||||
requests to the file, so only IP and port must be given to another user to
|
||||
access the file. Its main purpose is to quickly send a file to users in your
|
||||
local network, independent of their current setup (OS/software). Besides that
|
||||
it also supports uploads, SSL, HTTP basic auth and directory listings.
|
||||
|
||||
Features:
|
||||
* serve single file
|
||||
* serve a directory with directory index
|
||||
* file upload via webinterface
|
||||
* HTTPS with on the fly generated self signed SSL certificates
|
||||
* HTTP basic authentication
|
||||
* serving files/directories as on request generated tar files
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
Via pip
|
||||
```shell
|
||||
pip install servefile
|
||||
```
|
||||
After installation either execute `servefile --help` or `python -m servefile --help`
|
||||
|
||||
Standalone:
|
||||
If you don't have pip available just copy `servefile/servefile.py` onto the target machine, make it executable and you are ready to go.
|
||||
```shell
|
||||
$ wget https://raw.githubusercontent.com/sebageek/servefile/master/servefile/servefile.py -O servefile
|
||||
$ chmod +x servefile
|
||||
$ ./servefile --help
|
||||
```
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
from __future__ import print_function
|
||||
|
||||
__version__ = '0.5.0'
|
||||
__version__ = '0.4.4'
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
|
@ -1109,7 +1109,7 @@ class AuthenticationHandler():
|
|||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(prog='servefile', description='Serve a single file via HTTP.')
|
||||
parser = argparse.ArgumentParser(description='Serve a single file via HTTP.')
|
||||
parser.add_argument('--version', action='version', version='%(prog)s ' + __version__)
|
||||
parser.add_argument('target', metavar='file/directory', type=str)
|
||||
parser.add_argument('-p', '--port', type=int, default=8080, \
|
|
@ -1,4 +1,4 @@
|
|||
.TH SERVEFILE 1 "September 2020" "servefile 0.5.0" "User Commands"
|
||||
.TH SERVEFILE 1 "November 2015" "servefile 0.4.4" "User Commands"
|
||||
|
||||
.SH NAME
|
||||
servefile \- small HTTP-Server for temporary file transfer
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
from . import servefile
|
||||
|
||||
servefile.main()
|
20
setup.py
20
setup.py
|
@ -1,19 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/python
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
with open("README.md") as f:
|
||||
long_description = f.read()
|
||||
|
||||
setup(
|
||||
name='servefile',
|
||||
description='Serve files from shell via a small HTTP server',
|
||||
long_description=long_description,
|
||||
long_description_content_type='text/markdown',
|
||||
long_description='Serve files from shell via a small HTTP server. The server redirects all HTTP requests to the file, so only IP and port must be given to another user to access the file. Its main purpose is to quickly send a file to users in your local network, independent of their current setup (OS/software). Beneath that it also supports uploads, SSL, HTTP basic auth and directory listings.',
|
||||
platforms='posix',
|
||||
version='0.5.0',
|
||||
version='0.4.4',
|
||||
license='GPLv3 or later',
|
||||
url='https://github.com/sebageek/servefile/',
|
||||
url='https://seba-geek.de/stuff/servefile/',
|
||||
author='Sebastian Lohff',
|
||||
author_email='seba@someserver.de',
|
||||
install_requires=['pyopenssl'],
|
||||
|
@ -22,12 +18,7 @@ setup(
|
|||
'pytest',
|
||||
'requests',
|
||||
],
|
||||
packages=["servefile"],
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"servefile = servefile.servefile:main",
|
||||
],
|
||||
},
|
||||
scripts=['servefile'],
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Environment :: Console',
|
||||
|
@ -38,7 +29,6 @@ setup(
|
|||
'Programming Language :: Python :: 2',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
|
|
|
@ -27,15 +27,9 @@ def run_servefile():
|
|||
def _run_servefile(args, **kwargs):
|
||||
if not isinstance(args, list):
|
||||
args = [args]
|
||||
if kwargs.pop('standalone', None):
|
||||
# directly call servefile.py
|
||||
servefile_path = [str(Path(__file__).parent.parent / 'servefile' / 'servefile.py')]
|
||||
else:
|
||||
# call servefile as python module
|
||||
servefile_path = ['-m', 'servefile']
|
||||
|
||||
print("running {} with args {}".format(", ".join(servefile_path), args))
|
||||
p = subprocess.Popen([sys.executable] + servefile_path + args, **kwargs)
|
||||
print("running with args", args)
|
||||
servefile_path = str(Path(__file__).parent.parent / 'servefile')
|
||||
p = subprocess.Popen([sys.executable, servefile_path] + args, **kwargs)
|
||||
time.sleep(kwargs.get('timeout', 0.3))
|
||||
instances.append(p)
|
||||
|
||||
|
@ -91,29 +85,14 @@ def check_download(expected_data=None, path='/', fname=None, status_code=200, **
|
|||
return r # for additional tests
|
||||
|
||||
|
||||
def _test_version(run_servefile, standalone):
|
||||
def test_version(run_servefile):
|
||||
# we expect the version on stdout (python3.4+) or stderr(python2.6-3.3)
|
||||
s = run_servefile('--version', standalone=standalone, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
s = run_servefile('--version', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
s.wait()
|
||||
version = s.stdout.readline().decode().strip()
|
||||
|
||||
# python2 is deprecated, but we still want our tests to run for it
|
||||
# CryptographyDeprecationWarnings get in the way for this
|
||||
if 'CryptographyDeprecationWarning' in version:
|
||||
s.stdout.readline() # ignore "from x import y" line
|
||||
version = s.stdout.readline().decode().strip()
|
||||
|
||||
# hardcode version as string until servefile is a module
|
||||
assert version == 'servefile 0.5.0'
|
||||
|
||||
|
||||
def test_version(run_servefile):
|
||||
_test_version(run_servefile, standalone=False)
|
||||
|
||||
|
||||
def test_version_standalone(run_servefile):
|
||||
# test if servefile also works by calling servefile.py directly
|
||||
_test_version(run_servefile, standalone=True)
|
||||
assert version == 'servefile 0.4.4'
|
||||
|
||||
|
||||
def test_correct_headers(run_servefile, datadir):
|
||||
|
@ -346,7 +325,6 @@ def test_https(run_servefile, datadir):
|
|||
urllib3.disable_warnings()
|
||||
check_download(data, protocol='https', verify=False)
|
||||
|
||||
|
||||
def test_https_big_download(run_servefile, datadir):
|
||||
# test with about 10 mb of data
|
||||
data = "x" * (10 * 1024 ** 2)
|
||||
|
|
Loading…
Reference in New Issue