Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Blinov
slapos
Commits
b8de5a4e
Commit
b8de5a4e
authored
Mar 09, 2020
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recipe/simplehttpserver: add support for Python 3
parent
0259193a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
slapos/recipe/simplehttpserver/__init__.py
slapos/recipe/simplehttpserver/__init__.py
+2
-1
slapos/recipe/simplehttpserver/simplehttpserver.py
slapos/recipe/simplehttpserver/simplehttpserver.py
+4
-4
No files found.
slapos/recipe/simplehttpserver/__init__.py
View file @
b8de5a4e
...
...
@@ -27,6 +27,7 @@
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
string
,
random
import
os
from
six.moves
import
range
class
Recipe
(
GenericBaseRecipe
):
...
...
@@ -35,7 +36,7 @@ class Recipe(GenericBaseRecipe):
base_path
=
options
[
'base-path'
]
if
options
.
get
(
'use-hash-url'
,
'True'
)
in
[
'true'
,
'True'
]:
pool
=
string
.
letters
+
string
.
digits
hash_string
=
''
.
join
(
random
.
choice
(
pool
)
for
i
in
x
range
(
64
))
hash_string
=
''
.
join
(
random
.
choice
(
pool
)
for
i
in
range
(
64
))
path
=
os
.
path
.
join
(
base_path
,
hash_string
)
if
os
.
path
.
exists
(
base_path
):
...
...
slapos/recipe/simplehttpserver/simplehttpserver.py
View file @
b8de5a4e
# -*- coding: utf-8 -*-
from
SimpleHTTPServer
import
SimpleHTTPRequestHandler
from
BaseHTTPServer
import
HTTPServer
from
six.moves.
SimpleHTTPServer
import
SimpleHTTPRequestHandler
from
six.moves.
BaseHTTPServer
import
HTTPServer
import
ssl
import
os
import
logging
...
...
@@ -46,7 +46,7 @@ class ServerHandler(SimpleHTTPRequestHandler):
name
=
form
[
'path'
].
value
content
=
form
[
'content'
].
value
method
=
'a'
if
form
.
has_key
(
'clear'
)
and
form
[
'clear'
].
value
==
'1'
:
if
'clear'
in
form
and
form
[
'clear'
].
value
==
'1'
:
method
=
'w'
self
.
writeFile
(
name
,
content
,
method
)
self
.
respond
(
200
,
type
=
self
.
headers
[
'Content-Type'
])
...
...
@@ -97,7 +97,7 @@ def run(args):
httpd
=
server
((
host
,
port
),
Handler
)
scheme
=
'http'
if
args
.
has_key
(
'cert-file'
)
and
args
.
has_key
(
'key-file'
)
and
\
if
'cert-file'
in
args
and
'key-file'
in
args
and
\
os
.
path
.
exists
(
args
[
'cert-file'
])
and
os
.
path
.
exists
(
args
[
'key-file'
]):
scheme
=
'https'
httpd
.
socket
=
ssl
.
wrap_socket
(
httpd
.
socket
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment