IRC Logs for #circuits Thursday, 2013-10-31

*** ninkotech has quit IRC10:11
*** ninkotech has joined #circuits10:12
*** ninkotech has quit IRC10:50
*** punx has joined #circuits11:52
*** ninkotech has joined #circuits11:58
*** ninkotech has quit IRC12:36
*** ninkotech has joined #circuits12:39
spaceonebecuase there are enough17:20
*** jgiorgi has joined #circuits20:06
jgiorgiis it possible to determine the number of downloads currently in progress on circuits.web.Server, i'm attempting to reject excessive requests20:07
spaceonejgiorgi: "number of downsloads" ?21:06
jgiorgias in the number of concurrent downloads the server is providing to clients21:07
spaceonelen(self._clients)21:07
jgiorgion the instance of Server I presume?21:07
spaceonewait21:07
spaceonethe HTTP class21:08
spaceonewhich would be server.http._clients21:09
jgiorgiawesome, that makes that a simple task21:09
jgiorginext i forget the object that circuits.web uses when a client uploads a file as part of a form21:10
spaceoneoh the circuits.web api for this is not nice21:11
spaceonelet me lookup21:11
spaceoneif request.headers.get('Content-Type', '').startswith('application/multipart'): circuits.web.utils.parse_body(request, response, {}); request.body.read()21:15
spaceone(this will fail if 2 files are served by the client)21:15
spaceonebut there is another parser:21:16
spaceonecircuits.web.processors.process(request, {})21:16
jgiorgii'll only ever be using one, all i need is for one file (and a bit of other form data) get's through which iirc it does fine but how do i get to the file21:17
spaceonetake the second21:18
spaceonethe file is request.body after the processing21:18
spaceoneso you basically do:21:18
spaceoneparams = {}21:18
spaceonecircuits.web.processors.process(request, params)21:18
spaceoneprint(params)21:19
spaceoneprint(request.body.read())21:19
spaceonewhich is the file then21:19
jgiorgiin a request handler isnt it already parsed via the first method?21:24
jgiorgifrom within that handler can i do what you're suggesting?21:25
spaceonei don't understand?21:26
spaceonethe Dispatcher class does this automatically, yes21:27
*** koobs has joined #circuits21:30
*** koobs has quit IRC21:30
*** koobs has joined #circuits21:30
jgiorgispaceone: im confused as well, with a stock Server and Controller, within a handler (ie index) what's the method for reading the file? just self.request.body.read()?21:37
spaceonejgiorgi: yes22:00
prologicmorn'n all22:49
prologicjgiorgi:  not number of downloads22:50
prologicbut you could determine the no. of currency connections open to the server22:50
prologicby inspecting the _clients dict on the socket server component22:50
prologicI think it's called _clients22:50
prologicspaceone, jgiorgi  yes we do need to improve the file uploading / form handling a bit more22:52
prologicspecifically I'd like to support streamed uploads22:52
prologicso it can cope with large files22:52
spaceoneand i already programmed this22:57
prologicreally?23:06
prologiccould you contribute it back to circuits?23:06
prologicI'd really like that if you could23:06
prologicre mio -- there are never enough programming languages :)23:06

Generated by irclog2html.py 2.11.0 by Marius Gedminas - find it at mg.pov.lt!