import subprocess
import sys, os
if sys.version_info>=(3,0):
from urllib.parse import urlparse
else:
from urlparse import urlparse
import http.server
import socketserver
#Web server
class TsWEB(http.server.BaseHTTPRequestHandler):
def do_GET(self):
parsed_path=urlparse(self.path)
message_parts = [
'CLIENT VALUES:',
'client_address=%s (%s)' % (self.client_address, self.address_string()),
'command=%s' % self.command,
'path=%s' % self.path,
'real path=%s' % parsed_path.path,
'query=%s' % parsed_path.query,
'request_version=%s' % self.request_version,
'',
'SERVER VALUES:',
'server_version=%s' % self.server_version,
'sys_version=%s' % self.sys_version,
'protocol_version=%s' % self.protocol_version,
'',
'HEADERS RECEIVED:',
]
for name, value in sorted(self.headers.items()):
message_parts.append('%s=%s' % (name, value.rstrip()))
message_parts.append('')
message = '
'.join(message_parts)
self.send_response(200)
self.end_headers()
self.wfile.write(b"