Closed glaslos closed 11 years ago
Correct me if I am wrong, but I guess this could be done by customizing one of the many available HTTP libraries. This way we can keep separate the protocol_layer from the network_layer, as in current buttinsky code.
Yes, that should basically do it. I think the main part for this is to provided all the options in the settings file to customize the HTTP request. E.g. user agent, HTTP version... The actual request should be in the behavior layer I'd say.
I don't think we need a HTTP library. Just provide basic HTTP requesting and response parsing. The request and response part will be usually customized so we have to make this as open as possible.
Do you mean "basic" in a way that provides the following?
Pretty much.
I have trouble with this code. iqueue.get()
works for IRC where the server has a banner, but not for HTTP.
class Client(object):
# ...
def _event_loop(self):
while True:
line = self.conn.iqueue.get()
if self.layer1 != None:
self.layer1.receive(Message(line))
P.S. Sorry for the duplicate commits, I've pushed a rebased branch.
Is that blocking your connection? You could try a iqueue.get_nowait() and catch the Empty exception. Careful, this might put you in a CPU eating loop :)
Maybe it's better if I do that only for the first time, before the loop. :-) I'll do some testing and let you know.
@adepasquale do you consider this done?
Needs some more testing but otherwise done.
Provide the standard HTTP methods and parsers for requests, responses, header and payloads.