diff options
author | Martin Szulecki | 2011-04-07 15:10:18 +0200 |
---|---|---|
committer | Martin Szulecki | 2011-04-07 15:10:18 +0200 |
commit | 70510e357ede9c2fd366dcfa5315c70dd11b5673 (patch) | |
tree | 72b988c9483fa17061a52e345ee76535e5922f87 | |
parent | 3218ff200f946f517cfab9020001cd59319cd069 (diff) | |
download | totem-plugin-airplay-70510e357ede9c2fd366dcfa5315c70dd11b5673.tar.gz totem-plugin-airplay-70510e357ede9c2fd366dcfa5315c70dd11b5673.tar.bz2 |
Allow custom headers for a response
-rw-r--r-- | AirPlayService.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/AirPlayService.py b/AirPlayService.py index 3c9557c..5b4e58c 100644 --- a/AirPlayService.py +++ b/AirPlayService.py @@ -106,7 +106,7 @@ class AirPlayProtocolHandler(asyncore.dispatcher_with_send): d, p = self.service.get_scrub() content = "duration: " + str(float(d)) content += "\nposition: " + str(float(p)) - answer = self.create_request(200, content) + answer = self.create_request(200, "", content) elif request.type == 'POST': self.service.set_scrub(float(request.params['position'])) answer = self.create_request() @@ -131,7 +131,7 @@ class AirPlayProtocolHandler(asyncore.dispatcher_with_send): datestr = today.strftime("%a, %d %b %Y %H:%M:%S") return datestr+" GMT" - def create_request(self, status = 200, body = ""): + def create_request(self, status = 200, header = "", body = ""): clength = len(bytes(body)) if (status == 200): answer = "HTTP/1.1 200 OK" @@ -143,6 +143,8 @@ class AirPlayProtocolHandler(asyncore.dispatcher_with_send): answer += "\nConnection: Upgrade" answer += "\nDate: " + self.getDateTime() answer += "\nContent-Length: " + str(clength) + if (header != ""): + answer += "\n" + header answer +="\n\n" answer += body return answer |