190 return |
190 return |
191 |
191 |
192 self.httpdata += data.replace ('\r', '') |
192 self.httpdata += data.replace ('\r', '') |
193 |
193 |
194 def finish (self): |
194 def finish (self): |
195 handle_rest_http (self.httpdata.split ('\n'), self.address[0]) |
195 handle_rest_http (self.httpdata.splitlines(), self.address[0]) |
196 self.close() |
196 self.close() |
197 |
197 |
198 def handle_write (self): |
198 def handle_write (self): |
199 self.send (self.writebuffer) |
199 self.send (self.writebuffer) |
200 self.writebuffer='' |
200 self.writebuffer='' |
201 |
201 |
202 def handle_error (self): |
202 def handle_error (self): |
203 raise |
203 raise |
204 |
204 |
205 class RESTServer (asyncore.dispatcher): |
205 class RestServer (asyncore.dispatcher): |
206 def __init__ (self): |
206 def __init__ (self): |
207 global g_portnumber |
207 global g_portnumber |
208 |
208 |
209 if g_portnumber == None: |
209 if g_portnumber == None: |
210 g_portnumber = Config.get_node ('rest').get_value ('port') |
210 g_portnumber = Config.get_node ('rest').get_value ('port') |