Python - 浏览器在发送自定义标头时不会完成请求

时间:2015-08-02 01:37:10

标签: python http-headers

我目前正在制作一部依赖自定义标头的直播电台服务。但是当我发送它们时,浏览器永远不会加载音频内容页面。 这是我发送的内容:

JButton

如果我删除XYZ标题一切正常,是不是可以发送自定义标题?

以防万一:

 # self.header is an `OrderedDict`
 # the header `HTTP/1.1 200 OK` is sent in the `HEADER` function

 self.header['Content-Type'] = 'audio/mpeg'
 self.header['XYZ-mount-point'] = config.MOUNT_POINT
 self.header['XYZ-artist'] = mp3.MP3(self.files[self.count]).artist()
 self.header['XYZ-album'] = mp3.MP3(self.files[self.count]).album()
 self.header['XYZ-title'] = mp3.MP3(self.files[self.count]).title()
 self.header['XYZ-duration'] = mp3.MP3(self.files[self.count]).duration()
 self.header['Connection'] = 'keep-alive'
 self.header['Content'] = buffer # raw audio data to be played
 header.HEADER(self.header, con) # sends the headers

0 个答案:

没有答案