server: add commands
This commit is contained in:
@@ -41,14 +41,6 @@ class AbstractCommand(ABC):
|
||||
def command(self):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def build_message(command, host, path):
|
||||
message = f"{command} {path} HTTP/1.1\r\n"
|
||||
message += f"Host: {host}\r\n"
|
||||
message += "Accept: */*\r\nAccept-Encoding: identity\r\n"
|
||||
|
||||
return message.encode(FORMAT)
|
||||
|
||||
def execute(self, sub_request=False):
|
||||
(host, path) = self.parse_uri()
|
||||
|
||||
@@ -120,10 +112,6 @@ class AbstractCommand(ABC):
|
||||
|
||||
class AbstractWithBodyCommand(AbstractCommand, ABC):
|
||||
|
||||
@staticmethod
|
||||
def build_message(command, host, path):
|
||||
message = AbstractCommand.build_message()
|
||||
|
||||
def _build_message(self, message: str) -> bytes:
|
||||
body = input(f"Enter {self.command} data: ").encode(FORMAT)
|
||||
print()
|
||||
|
Reference in New Issue
Block a user