Mercurial > hg > webaudioevaluationtool
comparison pythonServer.py @ 750:c9c010690d56
Python server ignores GET in URL
author | Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk> |
---|---|
date | Mon, 21 Dec 2015 13:01:01 +0000 |
parents | 07c996307cbd |
children | f9c9a40f33bd |
comparison
equal
deleted
inserted
replaced
749:07c996307cbd | 750:c9c010690d56 |
---|---|
22 curFileName = 'test-0.xml' | 22 curFileName = 'test-0.xml' |
23 while(path.isfile('saves/'+curFileName)): | 23 while(path.isfile('saves/'+curFileName)): |
24 curSaveIndex += 1; | 24 curSaveIndex += 1; |
25 curFileName = 'test-'+str(curSaveIndex)+'.xml' | 25 curFileName = 'test-'+str(curSaveIndex)+'.xml' |
26 | 26 |
27 print "Next save - " + curFileName | |
28 pseudo_index = curSaveIndex % len(pseudo_files) | 27 pseudo_index = curSaveIndex % len(pseudo_files) |
29 print "Next test in pseudo-random queue - " + pseudo_files[pseudo_index] | 28 |
29 print 'URL: http://localhost:8000/index.html' | |
30 | 30 |
31 def send404(s): | 31 def send404(s): |
32 s.send_response(404) | 32 s.send_response(404) |
33 s.send_header("Content-type", "text/html") | 33 s.send_header("Content-type", "text/html") |
34 s.end_headers() | 34 s.end_headers() |
35 | 35 |
36 def processFile(s): | 36 def processFile(s): |
37 s.path = s.path.rsplit('?') | |
38 s.path = s.path[0] | |
37 s.path = s.path[1:len(s.path)] | 39 s.path = s.path[1:len(s.path)] |
38 st = s.path.rsplit(',') | 40 st = s.path.rsplit(',') |
39 lenSt = len(st) | 41 lenSt = len(st) |
40 fmt = st[lenSt-1].rsplit('.') | 42 fmt = st[lenSt-1].rsplit('.') |
41 size = path.getsize(urllib2.unquote(s.path)) | 43 size = path.getsize(urllib2.unquote(s.path)) |