Mercurial > hg > webaudioevaluationtool
comparison python/pythonServer.py @ 3065:b3230c0da598
Possible fix for #196
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Tue, 31 Oct 2017 17:14:23 +0000 |
parents | 9a201c63a0eb |
children | aae564b49b5a |
comparison
equal
deleted
inserted
replaced
3064:a504a17dcf9f | 3065:b3230c0da598 |
---|---|
67 s.path = s.path[0] | 67 s.path = s.path[0] |
68 s.path = s.path[1:len(s.path)] | 68 s.path = s.path[1:len(s.path)] |
69 st = s.path.rsplit(',') | 69 st = s.path.rsplit(',') |
70 lenSt = len(st) | 70 lenSt = len(st) |
71 fmt = st[lenSt-1].rsplit('.') | 71 fmt = st[lenSt-1].rsplit('.') |
72 fmt = fmt[len(fmt)-1] | |
73 print(st) | |
74 print(fmt) | |
72 fpath = "../"+urllib2.unquote(s.path) | 75 fpath = "../"+urllib2.unquote(s.path) |
73 size = os.path.getsize(fpath) | 76 size = os.path.getsize(fpath) |
74 fileDump = open(fpath) | 77 fileDump = open(fpath, mode='rb') |
75 s.send_response(200) | 78 s.send_response(200) |
76 | 79 |
77 if (fmt[1] == 'html'): | 80 if (fmt == 'html'): |
78 s.send_header("Content-type", 'text/html') | 81 s.send_header("Content-type", 'text/html') |
79 elif (fmt[1] == 'css'): | 82 elif (fmt == 'css'): |
80 s.send_header("Content-type", 'text/css') | 83 s.send_header("Content-type", 'text/css') |
81 elif (fmt[1] == 'js'): | 84 elif (fmt == 'js'): |
82 s.send_header("Content-type", 'application/javascript') | 85 s.send_header("Content-type", 'application/javascript') |
83 else: | 86 else: |
84 s.send_header("Content-type", 'application/octet-stream') | 87 s.send_header("Content-type", 'application/octet-stream') |
85 fileRead = fileDump.read() | 88 fileRead = fileDump.read() |
86 s.send_header("Content-Length", len(fileRead)) | 89 s.send_header("Content-Length", len(fileRead)) |