Always call setHeader with a string, not an int. Fixes "500 Internal
Server Error" when performing HEAD requests to a buildmaster that uses
Twisted 19 or later. Simplified adaptation of this commit from 0.9.11:
https://github.com/buildbot/buildbot/pull/3515/commits/5be61e8df842897827cbea50349d91d63c174fd8
--- buildbot/status/web/base.py.orig	2016-07-15 06:42:03.000000000 -0500
+++ buildbot/status/web/base.py	2021-03-03 01:33:41.000000000 -0600
@@ -398,7 +398,7 @@
                 data = data.encode("utf-8")
             request.setHeader("content-type", self.contentType)
             if request.method == "HEAD":
-                request.setHeader("content-length", len(data))
+                request.setHeader("content-length", str(len(data)))
                 return ''
             return data
         d.addCallback(handle)
--- buildbot/status/web/feeds.py.orig	2016-07-15 06:42:03.000000000 -0500
+++ buildbot/status/web/feeds.py	2021-03-03 01:33:49.000000000 -0600
@@ -57,7 +57,7 @@
         data = self.content(request)
         request.setHeader("content-type", self.contentType)
         if request.method == "HEAD":
-            request.setHeader("content-length", len(data))
+            request.setHeader("content-length", str(len(data)))
             return ''
         return data
 
--- buildbot/status/web/logs.py.orig	2016-07-15 06:42:03.000000000 -0500
+++ buildbot/status/web/logs.py	2021-03-03 01:35:08.000000000 -0600
@@ -115,7 +115,7 @@
         self._setContentType(req)
 
         # vague approximation, ignores markup
-        req.setHeader("content-length", self.original.length)
+        req.setHeader("content-length", str(self.original.length))
         return ''
 
     def render_GET(self, req):
