uploadserver 6.0.0__tar.gz → 6.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: uploadserver
3
- Version: 6.0.0
3
+ Version: 6.0.2
4
4
  Summary: Python's http.server extended to include a file upload page
5
5
  Home-page: https://github.com/Densaugeo/uploadserver
6
6
  Author: Densaugeo
@@ -11,6 +11,15 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.9
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: home-page
20
+ Dynamic: license-file
21
+ Dynamic: requires-python
22
+ Dynamic: summary
14
23
 
15
24
  # uploadserver
16
25
 
@@ -32,13 +41,13 @@ Python's http.server extended to include a file upload page
32
41
 
33
42
  ## Installation
34
43
 
35
- ~~~
44
+ ~~~bash
36
45
  python3 -m pip install --user uploadserver
37
46
  ~~~
38
47
 
39
48
  ## Usage
40
49
 
41
- ~~~
50
+ ~~~bash
42
51
  python3 -m uploadserver
43
52
  ~~~
44
53
 
@@ -49,18 +58,18 @@ After the server starts, the upload page is at /upload. For example, if the serv
49
58
  Warning: This is an upload server, and running it will allow uploads.
50
59
 
51
60
  Now supports uploading multiple files at once! Select multiple files in the web page's file selector, or upload with cURL:
52
- ~~~
61
+ ~~~bash
53
62
  curl -X POST http://127.0.0.1:8000/upload -F 'files=@multiple-example-1.txt' -F 'files=@multiple-example-2.txt'
54
63
  ~~~
55
64
 
56
65
  ## Basic Authentication (downloads and uploads)
57
66
 
58
- ~~~
67
+ ~~~bash
59
68
  python3 -m uploadserver --basic-auth hello:world
60
69
  ~~~
61
70
 
62
71
  Now you can upload with basic authentication. For example:
63
- ~~~
72
+ ~~~bash
64
73
  curl -X POST http://127.0.0.1:8000/upload -F 'files=@basicauth-example.txt' -u hello:world
65
74
  ~~~
66
75
 
@@ -68,7 +77,7 @@ All requests without authentication will be rejected. Note that basic authentica
68
77
 
69
78
  ## Basic Authentication (uploads only)
70
79
 
71
- ~~~
80
+ ~~~bash
72
81
  python3 -m uploadserver --basic-auth-upload hello:world
73
82
  ~~~
74
83
 
@@ -79,18 +88,18 @@ If both `--basic-auth` and `--basic-auth-upload` are specified, all requests wil
79
88
  ## Theme Option
80
89
 
81
90
  The upload page supports a dark mode for showing white text on black background. If no option is specified, the color scheme is chosen from the client’s browser’s preference (which typically matches their operating system’s setting, if light or dark mode is supported by the OS). To enforce the light or dark theme, the CLI parameter `--theme` can be used:
82
- ~~~
91
+ ~~~bash
83
92
  python3 -m uploadserver --theme light
84
93
  ~~~
85
94
  or
86
- ~~~
95
+ ~~~bash
87
96
  python3 -m uploadserver --theme dark
88
97
  ~~~
89
98
 
90
99
  ## HTTPS Option
91
100
 
92
101
  Run with HTTPS and without client authentication:
93
- ~~~
102
+ ~~~bash
94
103
  # Generate self-signed server certificate
95
104
  openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
96
105
 
@@ -103,7 +112,7 @@ curl -X POST https://localhost:8000/upload --insecure -F files=@simple-example.t
103
112
  ~~~
104
113
 
105
114
  Run with HTTPS and with client authentication:
106
- ~~~
115
+ ~~~bash
107
116
  # Generate self-signed server certificate
108
117
  openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
109
118
 
@@ -207,3 +216,5 @@ Thanks to marvinruder for work on the upload progress indicator, theme option, a
207
216
  Thanks to shuangye for finding an easy way to handle large file uploads, and improved handling of filename collisions.
208
217
 
209
218
  Thanks to abbbe for adding HTTP basic auth (has now replaced the token option).
219
+
220
+ Thanks to SimarMugattarov, theo543, and poshul for minor updates.
@@ -18,13 +18,13 @@ Python's http.server extended to include a file upload page
18
18
 
19
19
  ## Installation
20
20
 
21
- ~~~
21
+ ~~~bash
22
22
  python3 -m pip install --user uploadserver
23
23
  ~~~
24
24
 
25
25
  ## Usage
26
26
 
27
- ~~~
27
+ ~~~bash
28
28
  python3 -m uploadserver
29
29
  ~~~
30
30
 
@@ -35,18 +35,18 @@ After the server starts, the upload page is at /upload. For example, if the serv
35
35
  Warning: This is an upload server, and running it will allow uploads.
36
36
 
37
37
  Now supports uploading multiple files at once! Select multiple files in the web page's file selector, or upload with cURL:
38
- ~~~
38
+ ~~~bash
39
39
  curl -X POST http://127.0.0.1:8000/upload -F 'files=@multiple-example-1.txt' -F 'files=@multiple-example-2.txt'
40
40
  ~~~
41
41
 
42
42
  ## Basic Authentication (downloads and uploads)
43
43
 
44
- ~~~
44
+ ~~~bash
45
45
  python3 -m uploadserver --basic-auth hello:world
46
46
  ~~~
47
47
 
48
48
  Now you can upload with basic authentication. For example:
49
- ~~~
49
+ ~~~bash
50
50
  curl -X POST http://127.0.0.1:8000/upload -F 'files=@basicauth-example.txt' -u hello:world
51
51
  ~~~
52
52
 
@@ -54,7 +54,7 @@ All requests without authentication will be rejected. Note that basic authentica
54
54
 
55
55
  ## Basic Authentication (uploads only)
56
56
 
57
- ~~~
57
+ ~~~bash
58
58
  python3 -m uploadserver --basic-auth-upload hello:world
59
59
  ~~~
60
60
 
@@ -65,18 +65,18 @@ If both `--basic-auth` and `--basic-auth-upload` are specified, all requests wil
65
65
  ## Theme Option
66
66
 
67
67
  The upload page supports a dark mode for showing white text on black background. If no option is specified, the color scheme is chosen from the client’s browser’s preference (which typically matches their operating system’s setting, if light or dark mode is supported by the OS). To enforce the light or dark theme, the CLI parameter `--theme` can be used:
68
- ~~~
68
+ ~~~bash
69
69
  python3 -m uploadserver --theme light
70
70
  ~~~
71
71
  or
72
- ~~~
72
+ ~~~bash
73
73
  python3 -m uploadserver --theme dark
74
74
  ~~~
75
75
 
76
76
  ## HTTPS Option
77
77
 
78
78
  Run with HTTPS and without client authentication:
79
- ~~~
79
+ ~~~bash
80
80
  # Generate self-signed server certificate
81
81
  openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
82
82
 
@@ -89,7 +89,7 @@ curl -X POST https://localhost:8000/upload --insecure -F files=@simple-example.t
89
89
  ~~~
90
90
 
91
91
  Run with HTTPS and with client authentication:
92
- ~~~
92
+ ~~~bash
93
93
  # Generate self-signed server certificate
94
94
  openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
95
95
 
@@ -193,3 +193,5 @@ Thanks to marvinruder for work on the upload progress indicator, theme option, a
193
193
  Thanks to shuangye for finding an easy way to handle large file uploads, and improved handling of filename collisions.
194
194
 
195
195
  Thanks to abbbe for adding HTTP basic auth (has now replaced the token option).
196
+
197
+ Thanks to SimarMugattarov, theo543, and poshul for minor updates.
@@ -5,7 +5,7 @@ with open('README.md', 'r') as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name='uploadserver',
8
- version='6.0.0',
8
+ version='6.0.2',
9
9
  author='Densaugeo',
10
10
  author_email='author@example.com',
11
11
  description='Python\'s http.server extended to include a file upload page',
@@ -1,4 +1,5 @@
1
1
  import http.server, http, pathlib, sys, argparse, ssl, os, builtins, tempfile
2
+ import ipaddress
2
3
  import base64, binascii, functools, contextlib
3
4
 
4
5
  # Does not seem to do be used, but leaving this import out causes uploadserver
@@ -185,8 +186,8 @@ handler: http.server.BaseHTTPRequestHandler, auth: str,
185
186
  except binascii.Error:
186
187
  return (False, 'Credentials incorrectly formatted')
187
188
 
188
- http_username, http_password = http_username_password.split(':', 2)
189
- args_username, args_password = auth.split(':', 2)
189
+ http_username, http_password = http_username_password.split(':', 1)
190
+ args_username, args_password = auth.split(':', 1)
190
191
  if http_username != args_username: return (False, 'Bad username')
191
192
  if http_password != args_password: return (False, 'Bad password')
192
193
 
@@ -452,5 +453,14 @@ def main():
452
453
 
453
454
  args = parser.parse_args()
454
455
  if not hasattr(args, 'directory'): args.directory = os.getcwd()
456
+ if args.bind:
457
+ try:
458
+ ipaddress.ip_address(args.bind)
459
+ except ValueError:
460
+ parser.error(
461
+ 'Invalid -b/--bind address. Expected an IP address (no port). '
462
+ 'Example: -b 192.168.1.10 and pass the port as a separate '
463
+ 'argument.'
464
+ )
455
465
 
456
466
  serve_forever()
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: uploadserver
3
- Version: 6.0.0
3
+ Version: 6.0.2
4
4
  Summary: Python's http.server extended to include a file upload page
5
5
  Home-page: https://github.com/Densaugeo/uploadserver
6
6
  Author: Densaugeo
@@ -11,6 +11,15 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.9
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: home-page
20
+ Dynamic: license-file
21
+ Dynamic: requires-python
22
+ Dynamic: summary
14
23
 
15
24
  # uploadserver
16
25
 
@@ -32,13 +41,13 @@ Python's http.server extended to include a file upload page
32
41
 
33
42
  ## Installation
34
43
 
35
- ~~~
44
+ ~~~bash
36
45
  python3 -m pip install --user uploadserver
37
46
  ~~~
38
47
 
39
48
  ## Usage
40
49
 
41
- ~~~
50
+ ~~~bash
42
51
  python3 -m uploadserver
43
52
  ~~~
44
53
 
@@ -49,18 +58,18 @@ After the server starts, the upload page is at /upload. For example, if the serv
49
58
  Warning: This is an upload server, and running it will allow uploads.
50
59
 
51
60
  Now supports uploading multiple files at once! Select multiple files in the web page's file selector, or upload with cURL:
52
- ~~~
61
+ ~~~bash
53
62
  curl -X POST http://127.0.0.1:8000/upload -F 'files=@multiple-example-1.txt' -F 'files=@multiple-example-2.txt'
54
63
  ~~~
55
64
 
56
65
  ## Basic Authentication (downloads and uploads)
57
66
 
58
- ~~~
67
+ ~~~bash
59
68
  python3 -m uploadserver --basic-auth hello:world
60
69
  ~~~
61
70
 
62
71
  Now you can upload with basic authentication. For example:
63
- ~~~
72
+ ~~~bash
64
73
  curl -X POST http://127.0.0.1:8000/upload -F 'files=@basicauth-example.txt' -u hello:world
65
74
  ~~~
66
75
 
@@ -68,7 +77,7 @@ All requests without authentication will be rejected. Note that basic authentica
68
77
 
69
78
  ## Basic Authentication (uploads only)
70
79
 
71
- ~~~
80
+ ~~~bash
72
81
  python3 -m uploadserver --basic-auth-upload hello:world
73
82
  ~~~
74
83
 
@@ -79,18 +88,18 @@ If both `--basic-auth` and `--basic-auth-upload` are specified, all requests wil
79
88
  ## Theme Option
80
89
 
81
90
  The upload page supports a dark mode for showing white text on black background. If no option is specified, the color scheme is chosen from the client’s browser’s preference (which typically matches their operating system’s setting, if light or dark mode is supported by the OS). To enforce the light or dark theme, the CLI parameter `--theme` can be used:
82
- ~~~
91
+ ~~~bash
83
92
  python3 -m uploadserver --theme light
84
93
  ~~~
85
94
  or
86
- ~~~
95
+ ~~~bash
87
96
  python3 -m uploadserver --theme dark
88
97
  ~~~
89
98
 
90
99
  ## HTTPS Option
91
100
 
92
101
  Run with HTTPS and without client authentication:
93
- ~~~
102
+ ~~~bash
94
103
  # Generate self-signed server certificate
95
104
  openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
96
105
 
@@ -103,7 +112,7 @@ curl -X POST https://localhost:8000/upload --insecure -F files=@simple-example.t
103
112
  ~~~
104
113
 
105
114
  Run with HTTPS and with client authentication:
106
- ~~~
115
+ ~~~bash
107
116
  # Generate self-signed server certificate
108
117
  openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
109
118
 
@@ -207,3 +216,5 @@ Thanks to marvinruder for work on the upload progress indicator, theme option, a
207
216
  Thanks to shuangye for finding an easy way to handle large file uploads, and improved handling of filename collisions.
208
217
 
209
218
  Thanks to abbbe for adding HTTP basic auth (has now replaced the token option).
219
+
220
+ Thanks to SimarMugattarov, theo543, and poshul for minor updates.
File without changes
File without changes