]> sourceware.org Git - systemtap.git/commitdiff
stap-exporter: remove chunked transfer encoding
authorAaron Merey <amerey@redhat.com>
Tue, 3 Jul 2018 16:41:11 +0000 (12:41 -0400)
committerAaron Merey <amerey@redhat.com>
Tue, 3 Jul 2018 19:33:05 +0000 (15:33 -0400)
stap-exporter/exporter.conf
stap-exporter/exporter.py

index 16dcf4b0bb270bd94a000edc3ed0fbea855dfe43..d33962358631d0f47ed6f72f231eff2252b604f6 100644 (file)
@@ -1,4 +1,5 @@
-# Script names must be listed here as sections
+# Script names must be listed here as sections. The scripts must be
+# placed in stap-exporter/scripts.
 #
 # startup: If True then the session will launch at startup.
 #          If False or omitted, then the session won't launch
index adf82f8b334d3a136d2ef91ee2ac507b809d85d2..5e50289c444f261b3f3e63050578bdd2cc58a296 100755 (executable)
@@ -130,28 +130,20 @@ class SessionMgr:
 class HTTPHandler(BaseHTTPRequestHandler):
     sessmgr = SessionMgr()
 
-    def set_headers(self, code, content_type, transfer_encoding=None):
+    def set_headers(self, code, content_type):
         self.send_response(code)
         self.send_header('Content-type', content_type)
-
-        if transfer_encoding:
-            self.send_header('Transfer-Encoding', transfer_encoding)
-
         self.end_headers()
 
     def send_metrics(self, sess):
         metrics_path = sess.get_proc_path()
-        self.set_headers(200, 'text/plain', 'chunked')
+        self.set_headers(200, 'text/plain')
         try:
             with open(metrics_path) as metrics:
-                for line in metrics:
-                    self.wfile.write(b'%lx\r\n%b\r\n'
-                                     % (len(line), bytes(line, 'utf-8')))
+                self.wfile.write(bytes(metrics.read(), 'utf-8'))
         except Exception as e:
             msg = bytes(str(e), 'utf-8')
-            self.wfile.write(b'%lx\r\n%b\r\n' % (len(msg), msg))
-
-        self.wfile.write(b'0\r\n\r\n')
+            self.wfile.write(bytes(str(e), 'utf-8'))
 
     def send_msg(self, code, msg):
         self.set_headers(code, 'text/plain')
This page took 0.031324 seconds and 5 git commands to generate.