IRC Logs for #circuits-dev Thursday, 2013-03-14

*** Osso has joined #circuits-dev00:39
OssoI'll switch to here it's confusing to have 2 conversations in the same place02:21
Ossowe can  u(s, encoding) and then that would work as we think it should02:21
Ossobut I bet there's a way to use the six way of doing02:21
OssoI don't see how though02:22
Ossoprologic: here :)02:23
Ossomy point is the six one has to make sense02:23
prologicI do agree02:42
prologicsix.u should make sense02:42
prologicbut from testing it I don't see how02:42
prologicit doesn't function the same way as u"foo" on 2.x or 3.302:42
OssoI am proposing some fixes02:42
Ossowe'll see how it works02:42
prologicok!02:45
prologicmaybe you'll have better luck than i02:45
prologicdon't forget to test on both 2 and 302:45
Ossothe __unicode__ thing is tricky02:51
prologicwell I'm not even sure that's the right way of doing it02:52
prologicbasically we need 2 things I guess02:52
prologichandle unicode in the request body02:52
prologichandle unicode in the headers02:52
prologicand be able to dump them back out as bytes again in the final response02:53
Ossogoing to eat if you are here in an hour I'll fix that too02:56
Ossoyeah02:56
OssoI saw a few places we were mixing02:56
prologickk02:57
prologicI'll be here02:57
prologicI'm really keen to get this fixed :)02:57
prologicspace one's project based now on circuits.web is quite exciting02:57
OssoI am back from lunch04:19
Ossohttp.client.BadStatusLine: b'HTTP/1.1' b'200 OK'04:41
OssoI wonder why it's wrong04:41
Ossoit's doing if not version.startswith("HTTP/"):04:41
Ossook I see04:54
prologichow's it all going?05:04
prologicmaking more progress than i did? :)05:04
Ossogetting there05:08
Ossoit's decoding the response wrong now05:08
Ossoon 3.205:08
prologicyou mean encoding?05:09
Ossonope05:09
Ossowhen I do write05:09
Ossob'HTTP/1.1 200 OK\r\nDate: Thu, 14 Mar 2013 14:07:53 CET\r\nX-Powered-By: circuits.web/2.1.1idev\r\nA: \xc3\xa4\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: 2\r\n\r\n'05:09
Ossonote the \xc3\xa405:09
Ossobut when I read it05:10
prologicahh05:12
prologichmmm05:12
prologicthat bute stream looks ok thi ni?05:13
Ossoyes the byte stream looks good05:14
Ossooh wait05:14
Ossodoes py3 want a byte stream?05:15
prologicyeah when you write to a socket it must he bytes05:15
prologicwhat you pasted looks good i thunk05:15
Ossoit is good05:16
Ossomaybe HttpConnection is bugged ?05:16
prologicmaybe05:16
prologictest with curl or chrome?05:17
prologicif HTTPConnection is buggered we can use circuits.web.client05:17
OssoI am checking with a raw socket05:18
Ossoah right with our client05:20
prologicyup!05:20
prologicwe need to add chunked reading support to it too btw ;)05:20
*** circuits has joined #circuits-dev05:26
Ossoyes yes ~05:28
prologicoooh?05:31
prologicworking? :)05:31
Ossowait05:33
Ossoit wants a base url05:33
prologicyeah I think I want to modify the API of circuits.web.client05:35
prologicto be more like HTTPConnection05:35
prologiceg:05:35
prologicclient = Client(host, port)05:35
prologicclient.request(GET, "/")05:35
Ossoyeah sounds good05:37
Ossoso know I have to wait for the event05:37
Ossoso hard to use it05:37
prologiccircuits.web.client?05:38
Ossoyeah05:38
prologicwell it's designed to be used asynchronously ofc :)05:38
prologichow can we make it nicer to use?05:38
Ossoconnect is not working for some reason05:38
prologictests.web.test_client passes though05:39
prologicso it must work :)05:39
prologicI'll add a story in to also improve the API of circuits.web.client05:40
Ossomaybe my host is wrong05:42
OssoI so forgot client.start @#$@#$#@05:47
prologicahh :)05:48
prologicthat'll do it :)05:48
prologicor not making it a part of any active system05:48
Ossoit's passing !!!!!05:49
Ossooh wait it's for the content05:49
Ossochecking the header know05:49
Ossoit's passing05:52
Ossoyeah05:52
prologicsweet :)05:55
prologicdo you have py32, py33 and pypy on your system?05:55
prologicyou could try to run tox now05:55
Ossothat's with py3205:56
prologicah k05:57
Ossoand py2705:57
prologicoh nice!05:57
prologiccommit it and push it up to dev05:58
prologicyou should have access to the new repos05:58
prologichttps://bitbucket.org/circuits/circuits-dev05:58
Ossothe FieldStorage is breaking again06:04
Ossohow did we fix that one last time ?06:05
prologicTextIOWrapper(request.body)06:05
Ossosomething weird06:15
Ossolook at this http://circuits.codepad.org/41Ixom1d06:16
Ossotype of data is clearly bytes and it is tested by the code itself06:17
Ossobut write wants a str?06:17
prologichave the implementation of cgi.py's FieldStorage class is really weird06:18
prologicI'm thinking we should cp cgi.py into our codebase06:18
prologicand modify it to suit06:18
prologicI came across that too06:18
prologicand basically wtf06:18
prologicI'm giving you bytes06:18
prologicbut you open the file in text mode?06:18
prologicthat's what's happenning06:18
prologicit's because the self._binary_file test is failing06:19
prologicor something06:19
OssoI am glad we agree06:19
prologicL823: def make_file(...)06:20
prologiclook at the test it's doing06:20
prologicNow look at06:20
prologicL49806:20
prologicas we're passing in a buffer06:20
prologicand not an actual file06:20
prologicself.filename will always be None06:21
prologicso self._binary_file will always be False06:21
Ossoyeah06:21
prologicgo fuck'n figure06:21
prologicuseless really06:21
prologicno matter how hard I tried to tell it to eat my bytes06:21
prologicI could not06:21
prologicI'm +1 for copying it and integrating it directly06:21
Ossowe are parsing the body for a get06:41
OssoI think we can avoid this06:41
prologicumm06:42
prologicyou can still have a body for a GET :)06:42
Ossoyes06:43
Ossobut there's not parsing involved06:43
Ossothe parse_body is to update the event.kwargs06:43
prologicyeah06:45
prologicso where are we parsing the body twice?06:45
Ossoin the dispatcher06:47
Ossowell it's not twice06:47
Ossobut06:47
Ossoin case of GET we can skip it06:49
Ossocause there's no fields in the body06:49
circuits2 commit(s) pushed to circuits-dev06:52
circuitsbc78534868f7 by osso: Fixed unicode support for headers [Delivers #45421527]06:52
circuits7402ed1a6a8e by osso: merges unicode branch06:52
prologicyeah no but that's what I was trying to say06:53
prologicthere _could_ be fields in a GET request's body06:53
Ossooh ?06:54
prologictry it :)06:56
prologictry it with curl06:57
prologicthe spec doesn't prohibit it06:57
prologicit's just most web developers think GET is for getting resources06:57
prologicwhilst POST is for updating resources06:57
prologicbut they are just verbs06:57
prologican application can and does make use of them in any way they see fit really06:58
prologicspeaking of which06:58
prologicwe don't seem to support HEAD?06:58
prologicor do we06:58
prologichmm06:58
prologicI think we do rather (automatically)06:58
prologicwe support any HTTP verb I think06:58
prologichaha06:59
prologicnice work :)06:59
Ossoit seems like you can have a body with a GET request indeed according to the spec07:00
prologicyeap :)07:00
Ossobesides we may have the same problem with POST07:01
prologic*nods*07:01
prologicand PUT07:01
prologicand DELETE07:01
prologicHEAD is the only verb that does not accept a body afaik07:01
prologicyou like our commit bot?07:04
prologicall tests pass here on all environments07:13
OssoI love it!07:13
prologicwe do have to undo that skiping of parsing GET though07:13
Osso:(07:14
prologicyou didn't try to copy cgi.py did you?07:14
prologicI think that should be our next step07:14
circuits1 commit(s) pushed to circuits-dev07:15
circuits6fafd430641c by osso: Reenables parsing of body for GET requests07:15
OssoI think so but07:16
prologicbut?07:22
Ossodunno anymore :(07:26
prologichmm07:28
prologicdoes it make sense to keep the form fields, query string fields etc as bytes?07:29
prologicfiles obviously must remain bytes07:29
*** christopher_ has quit IRC07:35
Ossoyeah I think so ?07:38
Ossobb in 15 minutes07:38
prologicI just ported the cgi.py module from py3307:41
prologicso far so good07:41
prologicI stripped a bunch of shit we don't need from it though07:41
prologicit only deals with binary data07:42
prologichrmm07:51
prologicthis is not so straight forward07:52
prologicbringing in cgi.py from py33 is a lot harder than I thought07:52
prologicso much changed code07:52
prologicI have to bring in half of urllib.parse07:52
prologicand friends07:52
*** christopher_ has joined #circuits-dev07:52
Ossodamn ~07:56
prologicI tell you the reaosn this shit is so buggy in the stdlib07:57
prologicis because it's not being used07:57
prologicgah07:57
prologicwe have 2 options07:57
prologicrip off someone else's body/entity parsing code07:58
prologiceg: cherrypy07:58
prologicor write our own07:58
prologiccherrypy*07:58
*** christopher_ has quit IRC08:02
*** christopher has joined #circuits-dev08:05
prologicI have to go to bed08:14
prologicCan I leave you with it?08:14
prologicMaybe you have some brilliant other idea :)08:14
OssoI think looking for other implementations was the idea08:20
Ossocherrypy or somebody else would be good08:20
OssoI have to catch up on work :)08:20
*** Osso has quit IRC09:17
*** christopher has joined #circuits-dev10:25
*** Guest99624 has joined #circuits-dev13:37
*** Guest99624 has quit IRC17:10
*** Guest99624 has joined #circuits-dev17:13
circuits1 commit(s) pushed to circuits-dev18:27
circuits01df0b2bbbd8 by prologic: Guard against invalid headers. Fixes Issue #3818:27

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