Improve logging, fix small issues
This commit is contained in:
@@ -5,7 +5,7 @@ from abc import ABC, abstractmethod
|
||||
from datetime import datetime
|
||||
|
||||
from httplib import parser
|
||||
from httplib.exceptions import NotFound, Forbidden, NotModified
|
||||
from httplib.exceptions import NotFound, Forbidden, NotModified, BadRequest
|
||||
from httplib.httpsocket import FORMAT
|
||||
from httplib.message import RequestMessage as Message
|
||||
|
||||
@@ -66,8 +66,6 @@ class AbstractCommand(ABC):
|
||||
|
||||
def _build_message(self, status: int, content_type: str, body: bytes, extra_headers=None):
|
||||
|
||||
if extra_headers is None:
|
||||
extra_headers = {}
|
||||
self._process_conditional_headers()
|
||||
|
||||
message = f"HTTP/1.1 {status} {status_message[status]}\r\n"
|
||||
@@ -237,3 +235,9 @@ class PutCommand(AbstractModifyCommand):
|
||||
@property
|
||||
def _file_mode(self):
|
||||
return "w"
|
||||
|
||||
def execute(self):
|
||||
if "content-range" in self.msg.headers:
|
||||
raise BadRequest("PUT request contains Content-Range header")
|
||||
|
||||
super().execute()
|
||||
|
Reference in New Issue
Block a user