Browse Source

Merge pull request #8 from l-n-s/server_fix

Send content-length header
pull/9/head
l-n-s 7 years ago committed by GitHub
parent
commit
a60122a165
  1. 3
      pyseeder/server.py

3
pyseeder/server.py

@ -1,6 +1,7 @@
import http.server import http.server
import urllib.parse import urllib.parse
import ssl import ssl
import os
class ReseedHandler(http.server.SimpleHTTPRequestHandler): class ReseedHandler(http.server.SimpleHTTPRequestHandler):
"""Handles reseeding requests""" """Handles reseeding requests"""
@ -13,6 +14,8 @@ class ReseedHandler(http.server.SimpleHTTPRequestHandler):
if path == "/i2pseeds.su3": if path == "/i2pseeds.su3":
self.send_response(200) self.send_response(200)
self.send_header("Content-Type", "application/octet-stream") self.send_header("Content-Type", "application/octet-stream")
self.send_header("Content-Length",
os.path.getsize(self.i2pseeds_file))
self.end_headers() self.end_headers()
with open(self.i2pseeds_file, 'rb') as f: with open(self.i2pseeds_file, 'rb') as f:
self.wfile.write(f.read()) self.wfile.write(f.read())

Loading…
Cancel
Save