diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..35740e3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016-present Sanic Community + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README b/README index 53dda2b..602e172 100644 --- a/README +++ b/README @@ -1,6 +1,9 @@ httpserver ======================================= This httpserver is a enhanced version of SimpleHTTPServer. + It was write in python, I use some code from bottle[https://github.com/defnull/bottle] + It support resuming download, you can set the document root, it has more + friendly error hit, and it can handle mimetype gracefully diff --git a/httpserver.py b/httpserver.py index 660d559..db9d1e0 100755 --- a/httpserver.py +++ b/httpserver.py @@ -204,7 +204,7 @@ def translate_path(self, path): path = posixpath.normpath(urllib.unquote(path)) words = path.split('/') words = filter(None, words) - path = root_path#os.getcwd() + path = root_path for word in words: drive, word = os.path.splitdrive(word) head, word = os.path.split(word) @@ -217,11 +217,8 @@ def _test(self): headers = str(self.headers).split() print 'Range' in self.headers for index,data in enumerate(headers): - #print data if data.strip().lower().startswith('range'):#.startswith('range:'): - #print data, headers[index+1] pass - #print str(headers) return _RerootedHTTPRequestHandler class ThreadingServer(ThreadingMixIn, HTTPServer):