From 359fe1110c8eb4692ab28d0865db2e059e180a7c Mon Sep 17 00:00:00 2001 From: NullArray Date: Wed, 27 Dec 2017 15:26:53 +0000 Subject: [PATCH 01/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec34a54..b160453 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ I was in need of a quick HTTP-Server for a project I am working on at the time o ## Usage -Place the `server.py` file into the directory you wish to serve files from. Start it from the command line and simply answer the promts. When the server is configured it will start serving the files in said directory. +Place the `server.py` file into the directory you wish to serve files from. Start it from the command line and simply answer the prompts. When the server is configured it will start serving the files in said directory. ### Dependencies From 4e24bd1e2f7cacd4253296dc75910b5aac994a39 Mon Sep 17 00:00:00 2001 From: NullArray Date: Wed, 27 Dec 2017 15:29:33 +0000 Subject: [PATCH 02/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b160453..59ebdb2 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ I was in need of a quick HTTP-Server for a project I am working on at the time o ## Usage -Place the `server.py` file into the directory you wish to serve files from. Start it from the command line and simply answer the prompts. When the server is configured it will start serving the files in said directory. +Clone the repo with `git clone https://github.com/NullArray/HTTP-Server.git` After which you can place the `server.py` file into the directory you wish to serve files from. Start it from the command line and simply answer the prompts. When the server is configured it will start serving the files in said directory. ### Dependencies From d68bcd99244464419abdb2d1a72dd4b54a11bef6 Mon Sep 17 00:00:00 2001 From: NullArray Date: Wed, 27 Dec 2017 15:30:09 +0000 Subject: [PATCH 03/11] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59ebdb2..c5066e3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,11 @@ I was in need of a quick HTTP-Server for a project I am working on at the time o ## Usage -Clone the repo with `git clone https://github.com/NullArray/HTTP-Server.git` After which you can place the `server.py` file into the directory you wish to serve files from. Start it from the command line and simply answer the prompts. When the server is configured it will start serving the files in said directory. +Clone the repo with; + +`git clone https://github.com/NullArray/HTTP-Server.git` + +After which you can place the `server.py` file into the directory you wish to serve files from. Start it from the command line and simply answer the prompts. When the server is configured it will start serving the files in said directory. ### Dependencies From 9dabbf3fef76b980b79c06ef40fee54f982cfb39 Mon Sep 17 00:00:00 2001 From: NullArray Date: Fri, 12 Jan 2018 18:36:48 +0000 Subject: [PATCH 04/11] Catching keyboard interrupt for aesthetics --- server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 8fd067f..3437d13 100644 --- a/server.py +++ b/server.py @@ -71,4 +71,8 @@ def quickshell(): print "[" + t.green("+") + "]Serving at", IP, repr(PORT) -httpd.serve_forever() +# Catching keyboard interrupt for aesthetics purposes +try: + httpd.serve_forever() +except KeyboardInterrupt: + print "\n[" + t.red("!") + "]User Aborted." From 29d971d4ab7823bbb448fa425d0226e0d45f1a9c Mon Sep 17 00:00:00 2001 From: NullArray Date: Fri, 16 Feb 2018 16:28:27 +0000 Subject: [PATCH 05/11] bug fixes --- server.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server.py b/server.py index 3437d13..3a51f9a 100644 --- a/server.py +++ b/server.py @@ -10,7 +10,7 @@ t = Terminal() def quickshell(): - cwd = os.system('pwd') + cwd = cwd = os.getcwd() print "[" + t.green("+") + "]OS Shell in " + cwd print "[" + t.green("+") + "]Enter 'Q' to quit" @@ -30,24 +30,24 @@ def quickshell(): print "\n[" + t.green("+") + "]Basic HTTP Server.\n" -default = raw_input("[" + t.magenta("?") + "]Default Config? [Y]es/[N]o: ") -if default == 'y' or 'Y': +default = raw_input("[" + t.magenta("?") + "]Default Config? [Y]es/[N]o: ").lower() +if default == 'y': PORT = 8000 IP = "127.0.0.1" print "\n[" + t.green("+") + "]Default settings loaded.\n" -elif default == 'n' or 'N': +elif default == 'n': print "[" + t.green("+") + "]Specify custom values.\n" - PORT = raw_input(int("[" + t.magenta("?") + "]Enter port: ")) - IP = raw_input("[" + t.magenta("?") + "]Enter host: ") + PORT = input("Enter port: ") + IP = raw_input("Enter host: ") print "[" + t.green("+") + "]Invoke a shell to make adjustments in server directory?" - invoke = raw_input("[" + t.magenta("?") + "][Y]es/[N]o: ") - if invoke == 'y' or 'Y': + invoke = raw_input("[" + t.magenta("?") + "][Y]es/[N]o: ").lower() + if invoke == 'y': quickshell() - elif invoke == 'n' or 'N': + elif invoke == 'n': print "[" + t.green("+") + "]Done." else: print "\n[" + t.red("!") + "]Unhandled Option." From 7153f27e43fb62924e113a171e183eeced2b248e Mon Sep 17 00:00:00 2001 From: NullArray Date: Fri, 16 Feb 2018 16:34:34 +0000 Subject: [PATCH 06/11] Update server.py --- server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server.py b/server.py index 3a51f9a..9b96e26 100644 --- a/server.py +++ b/server.py @@ -10,12 +10,11 @@ t = Terminal() def quickshell(): - cwd = cwd = os.getcwd() + cwd = os.getcwd() print "[" + t.green("+") + "]OS Shell in " + cwd print "[" + t.green("+") + "]Enter 'Q' to quit" try: - while True: command = raw_input("\n<" + t.cyan("SERVER") + ">$ ") if not command in ('q', 'Q'): From 8878db130fee740401ec106499ec22c76601ac72 Mon Sep 17 00:00:00 2001 From: NullArray Date: Fri, 16 Feb 2018 17:01:25 +0000 Subject: [PATCH 07/11] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index c5066e3..77577d2 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,11 @@ Clone the repo with; After which you can place the `server.py` file into the directory you wish to serve files from. Start it from the command line and simply answer the prompts. When the server is configured it will start serving the files in said directory. +Personally i just put the execution of the script on an alias like so. +`alias serve='cd /home/uname/server && python server.py` + +Easier than a one-liner and with extra featres to boot in my humble opinion. + ### Dependencies For this to work you will need the `SimpleHTTPServer` and `blessings` modules. From 8f254774351e5db23e4c54ec7c91303d2547116f Mon Sep 17 00:00:00 2001 From: NullArray Date: Fri, 16 Feb 2018 17:13:29 +0000 Subject: [PATCH 08/11] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 77577d2..e899c3b 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Clone the repo with; After which you can place the `server.py` file into the directory you wish to serve files from. Start it from the command line and simply answer the prompts. When the server is configured it will start serving the files in said directory. Personally i just put the execution of the script on an alias like so. + `alias serve='cd /home/uname/server && python server.py` Easier than a one-liner and with extra featres to boot in my humble opinion. From f4544ed0ec3a47541513b50b4c442b8e83a20ce5 Mon Sep 17 00:00:00 2001 From: NullArray Date: Sat, 17 Feb 2018 15:36:26 +0000 Subject: [PATCH 09/11] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e899c3b..7ed0121 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ After which you can place the `server.py` file into the directory you wish to se Personally i just put the execution of the script on an alias like so. -`alias serve='cd /home/uname/server && python server.py` +`alias serve='cd /home/uname/server && python server.py'` -Easier than a one-liner and with extra featres to boot in my humble opinion. +Easier than a one-liner and with extra features to boot in my humble opinion. ### Dependencies From ba51c24b676b292d4a7e97844a6110040b1851b3 Mon Sep 17 00:00:00 2001 From: NullArray Date: Mon, 19 Feb 2018 10:42:50 +0000 Subject: [PATCH 10/11] Update server.py --- server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.py b/server.py index 9b96e26..1163740 100644 --- a/server.py +++ b/server.py @@ -1,4 +1,4 @@ -#!/usr/bin/python 2.7 +#!/usr/bin/env python 2.7 import SimpleHTTPServer import SocketServer From abe68e195060b10195faa420a139fce40b8ed447 Mon Sep 17 00:00:00 2001 From: NullArray Date: Sat, 14 Apr 2018 15:51:35 +0000 Subject: [PATCH 11/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ed0121..2ca4897 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ After which you can place the `server.py` file into the directory you wish to se Personally i just put the execution of the script on an alias like so. -`alias serve='cd /home/uname/server && python server.py'` +`alias serve='cd /home/$USER/server && python server.py'` Easier than a one-liner and with extra features to boot in my humble opinion.