IRC Logs for #circuits Friday, 2013-03-29

*** ronny has quit IRC00:30
*** ronny has joined #circuits00:45
*** ronny has quit IRC02:43
*** ronny has joined #circuits02:48
*** ronny has quit IRC02:48
*** ronny has joined #circuits02:48
prologichmm03:31
prologiceverything I've been reading about unicode in http header values03:31
prologicmeans you can't use unicode in http headers03:31
prologicat all03:31
prologicor at least most browsers and servers can't on a standard way of encoding03:32
prologicI think I finally solved our unicode problems03:51
ronnyprologic, header values are bytes, not codepoints :)04:59
prologicyeah everything I've read suggested that whilst you can use some high characters05:00
prologicunicode is general isn't well supported in http headers05:00
prologicthere are a few rfc(s)05:00
prologicbut yeah05:00
*** koobs has quit IRC05:51
*** ronny has quit IRC05:53
*** ronny has joined #circuits06:06
*** koobs_ has joined #circuits07:03
*** koobs has joined #circuits07:08
*** ronny has quit IRC08:19
spaceoneprologic: you are currently fire(Write(body)); fire(Write(headers))10:26
*** ronny has joined #circuits10:28
spaceoneah i misslooked... response is only the response lin10:43
spaceonee10:43
spaceonei like the splitting of response line and headers10:43
spaceonebut shouldn't we actually first try to bytes(headers) and then sending the response line if an exceptiuon occurs a wrong response code would be send)10:46
*** ronny has quit IRC10:57
spaceoneprologic: https://bitbucket.org/spaceone/circuits-experimental/commits/f6fe573f4eb12ece49d1d64b5ddbf4f2d0ea25b111:04
prologican exception converting the response to bytes?14:07
prologicI'm not sure how your change is semantaically any diferent14:15
spaceoneprologic: puttin things to bytes is not a problem ;)14:25
spaceonebut see what you are doing in __bytes__14:25
spaceoneyou do str(self).encode(foo)14:25
spaceonedecode*14:25
spaceonethis can of course raise an exception!14:25
prologicyeah but youre just assigning the bytes call to variables15:26
prologicnot really necessary imho15:26
prologicspaceone, I realize it can cause an exception16:06
prologichowever that should be handled anyway16:07
prologicat least I think we have a response_failure feedback16:07
prologicI'll check16:07
prologicyeah we do16:07
prologicwhether we handle response_failure is another thing16:07
prologicI'll check that too16:07
spaceonejeah but that does not help16:07
spaceonelook:16:07
prologicyeah we do16:08
spaceoneyou are writing successfully '200 OK HTTP/1.1' to the socket16:08
prologicno it doesn't help if the byteS(response) itself fails16:08
spaceonethen you try to write the headers16:08
prologicit'll go into an infinite event loop16:08
prologicahh yes and if that fails16:08
spaceonewhich fails16:08
prologichmm16:08
prologicI see your point16:08
spaceone...16:08
spaceonedetails (DETAILS!!!)16:08
prologicwhat could potentially fail here?16:08
prologicUnicodeEncode exception?16:09
spaceoneyes16:09
spaceonebut also other exceptions, if we have an other codec tahn utf-816:09
prologichttp://codepad.org/rfmTlwEQ16:15
prologicI need a test case to test this UnicodeEncodeError now16:15
prologichow can I test this? i.e: make it blow up?16:15
prologicmaybe I just just catch all exceptions from doing bytes(response) and bytes(headers)16:16
spaceoneprologic: s/505/500/16:20
prologicoops :)16:25
prologicsorry copied that line from somewhere else16:25
prologicfixed16:25
prologicneed a way to test this16:25
prologichttp://codepad.org/AEPZmJJP16:28
spaceoneone moment16:36
spaceonein python 2:16:38
spaceoneheaders['foo'] = '16:38
prologichmm ok let's try that :)16:42
spaceonein the test case do this:16:44
prologichttp://codepad.org/WXlINzYw16:44
prologicthat did not raise an exception16:44
spaceoneprologic: did you use python2 ?16:45
prologicnope16:46
prologicalso did not raise an exception16:46
prologichttp://codepad.org/9eafpqug16:46
prologicyeah16:46
prologic2.6.616:46
spaceoneDETAILS!16:56
prologicit seems hard to cause en exception from bytes(foo)16:56
prologic:)16:56
spaceoneno16:56
spaceoneit is easy16:56
prologicshow me :)16:57
prologicso far nothing16:57
spaceoneprologic: replace the line with:16:57
spaceonenote the u''16:57
spaceone(details!)16:58
prologicThere we go!17:19
prologicExample Output:17:19
prologichttp://codepad.org/CPYcgwch17:19
prologicExample Code:17:19
prologichttp://codepad.org/IoQU2qeu17:19
prologicFinal Patch to circuits.web:17:19
prologichttp://codepad.org/auHMHwHr17:19
prologicI had to recreate the response/headers objects in this case17:20
prologicrather then fire another HTTPError event17:20
prologicwhich ends up in an infinite event loop17:20
prologici.e: same data causing the same error over and over again17:20
prologicI think this works really well though17:20
prologicshould avoid all future problems with getting the response out17:21
spaceoneok18:06
prologicso I should build a unit test for this18:17
prologicin general - failure of response18:17
prologicand commit/push this18:17
prologicall tests pass18:17
*** irclogger_ has joined #circuits19:09
prologicooops19:10
prologic4am for you :)19:10
spaceoneprologic: yep19:14
spaceonebut it is okay19:14
spaceonei am not sleeping19:14
spaceonei have to work on documentation19:14
prologicahh cool19:18
prologicso yeah anyway19:18
prologicthis new patch works just as well19:18
prologic-iif- we re-write the response properly in the http_error handler19:19
*** qwebirc29055 has joined #circuits22:30
*** qwebirc29055 has quit IRC22:31

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