class_docstr: A tiny, hacky http(s) server for testing ship logs.
  
  It's about the same amount of code as subclassing the stdlib's SimpleHTTPRequestHandler, but it
  shuts down much faster.
class_docstr_tok: ["A","tiny",",","hacky","http","(","s",")","server","for","testing","ship","logs",".","It","'s","about","the","same","amount","of","code","as","subclassing","the","stdlib","'s","SimpleHTTPRequestHandler",",","but","it","shuts","down","much","faster","."]
code: def __init__(
      self,
      ctx: Optional[ssl.SSLContext] = None,
      reject_logs: bool = False,
  ) -> None:
      self.ctx = ctx
      self.reject_logs = reject_logs
      self.quit = False
      self.logs: List[str] = []
  
      self.listener = socket.socket()
      self.listener.bind(("127.0.0.1", 0))
      self.listener.listen(5)
  
      _, self.port = self.listener.getsockname()
  
      self.thread = threading.Thread(target=self.serve_requests)
      self.thread.start()
  
imports: import io
  import json
  import logging
  import os
  import shutil
  import signal
  import socket
  import ssl
  import subprocess
  import sys
  import tempfile
  import textwrap
  import threading
  import time
  from typing import Any, List, Optional
  import pytest
label_desc: Use image node_id 1 to create a new ShipLogServer object  with example: obj = ShipLogServer(ctx, reject_logs)