소스 검색

server: send_headers() accepts optional 'extra' argument for custom headers

Helge Jung 9 년 전
부모
커밋
8b495c9822
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      ffstatus/server.py

+ 3 - 1
ffstatus/server.py

@@ -155,7 +155,7 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
 
     def send_headers(self,
                      content_type='text/html; charset=utf-8',
-                     nocache=True):
+                     nocache=True, extra={}):
         """Send HTTP 200 Response header with the given Content-Type.
         Optionally send no-caching headers, too."""
 
@@ -163,6 +163,8 @@ class BatcaveHttpRequestHandler(BaseHTTPRequestHandler):
         self.send_header('Content-Type', content_type)
         if nocache:
             self.send_nocache_headers()
+        for key in extra:
+            self.send_header(key, extra[key])
         self.end_headers()
 
     def parse_post_params(self):