The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2017-01-27

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:00 sugar joined #mojo
00:05 inokenty joined #mojo
00:29 kiwiroy joined #mojo
00:46 vytas joined #mojo
00:55 aborazmeh joined #mojo
01:03 kiwiroy joined #mojo
01:06 bpmedley joined #mojo
01:22 orev1 joined #mojo
01:25 sugar joined #mojo
01:50 marty_ joined #mojo
01:58 vicash left #mojo
02:18 kiwiroy joined #mojo
02:26 lluad joined #mojo
02:29 [vlad] joined #mojo
02:58 kiwiroy joined #mojo
03:44 noganex_ joined #mojo
03:59 stryx` joined #mojo
04:28 inokenty-w joined #mojo
05:04 dboehmer joined #mojo
06:02 coolo sri: something like encoding was my suspicion as well when I stopped yesterday
06:04 coolo the data sent looks like this
06:04 coolo 01 00 00 00 00 00 D0 00 0A 00 0B 00 00 00 84 0B
06:04 coolo and the data received looks like
06:05 coolo 01 00 00 00 00 00 C3 90 00 0A 00 0B 00 00 00 84 0B
06:05 coolo UTF-8 sounds about right
06:09 coolo yeah, U+0090 is Ð and encoded as c3 90
06:09 coolo aehm, U+00D0 obviously
06:39 kes joined #mojo
06:46 janl_ joined #mojo
06:58 hernan604 joined #mojo
07:12 coolo sri:    # Placate RT98372
07:12 coolo utf8::downgrade( $_[1] ) or
07:12 coolo carp "Wide character in sslwrite";
07:12 coolo grr
07:12 dod joined #mojo
07:12 coolo this is https://rt.cpan.org/Public/Bug/Display.html?ShowHeaders=1;id=98372
07:12 coolo i.e. IO::Async::SSL as used by Async::AMQP downgrades the string. Noone does that in the case of mojo client
07:14 coolo if I do this directly in Client.pm my frames end up correctly
07:17 dod joined #mojo
07:21 polettix joined #mojo
07:21 coolo https://github.com/inway/mojo-rabbitmq-client/pull/7
07:52 ashimema joined #mojo
07:52 sdeseille joined #mojo
07:53 sdeseille Good morning Mojolicious !!!
08:00 sri coolo: wow, i wonder how we ended up with a binmode utf8 handle
08:00 sri that might affect other things as well
08:04 sri or it's just ssl and the utf8 flag
08:11 AndrewIsh joined #mojo
08:22 dod joined #mojo
08:23 dod joined #mojo
08:41 Vandal joined #mojo
08:42 osfabibisi joined #mojo
08:43 sri coolo: will investigate a bit later to see if we need mojo core changes
08:44 sri just writing corrupted data without error seems like a pretty bad idea
08:45 sri so yea, changes are likely
08:45 Petru joined #mojo
09:15 trone joined #mojo
09:28 osfabibisi joined #mojo
09:54 * sri is pretty happy with $tx->result and $tx->req->is_success/is_error/...
09:54 sri already making a pretty big difference in my REST clients
09:58 Petru joined #mojo
10:00 nic something in my head keeps saying that success/error is part of the response rather than the request
10:02 sri umm
10:02 sri typo :)
10:02 * sri is pretty happy with $tx->result and $tx->res->is_success/is_error/...
10:03 nic me too :)
10:18 sugar joined #mojo
10:43 sugar joined #mojo
10:47 Ryoga joined #mojo
10:58 gregf_ joined #mojo
11:12 janl_ so I have some rather nastily stuctured json documents-> perl hash of hashes. but how do I do unstructured searches in these?
11:13 nic can you explain "unstructured"?
11:13 nic do you mean treat it as one long string?
11:14 janl_ I need to search for a value at some unspecified depth of the hash
11:14 janl_ I sort of need grep
11:14 janl_ and a way to find the parent hash
11:14 nic what form is your 'json' currently in -- a perl hashref or a string of bytes or ...?
11:15 nic ah
11:15 nic so a simple string match isn't going to help you, cos that second part needs to observe structure
11:16 nic are all the entities/objects inside the json/structure hashrefs or might you need to search arrayrefs too?
11:18 janl_ there will be arrayrefs too
11:19 janl_ the string of bytes returned to me is not helpful, it's all in a one line looooong string
11:19 nic In that case I'd write my own recursive search (rather than use something from cpan for hashes of hashes)
11:20 janl_ I was sort of tipping in that direction
11:20 nic Mojo can convert that to a structure; that's your easiest step
11:20 janl_ ref($foo) is my friend I guess
11:20 nic IMO the only intersting bit is the choice of depth-first vs breadth-first
11:21 janl_ *nod*
11:21 janl_ depth-first will work well enough
11:21 janl_ now I have to design a language for this
11:21 nic and whether you can optimise by identifying 'I don't need to search this subtree'
11:21 tchaves joined #mojo
11:22 janl_ I had previously thought about something like CSS selectors but this structure is beyond.
11:22 nic first design some brand new hardware to support this
11:22 nic and market it to the masses
11:22 nic then a new language
11:22 janl_ the masses just want Trump
11:22 nic and an umbrella (shell) company to hold all the assets
11:22 janl_ I want something more elegant
11:23 nic make your new language only executable on hardware that has exactly 6 cores
11:23 nic or.....
11:23 nic solve it with a couple of functions
11:23 nic the latter is obviously far less profitable
11:24 janl_ a couple of functions should be enough in any case
11:24 janl_ the ->parent()->parent() is a bit worrying
11:25 janl_ *mumble*
11:25 nic nah, at each stage of the depth-first search you have a note of all the ancestors of the current node
11:27 janl_ I can even insert it as long as i'm at a hashref
11:45 marty joined #mojo
11:51 sugar joined #mojo
11:57 Petru joined #mojo
12:04 Ryoga joined #mojo
12:26 mrEriksson joined #mojo
12:43 Petru joined #mojo
13:05 sugar joined #mojo
13:06 blonewolfs joined #mojo
13:37 Dandre1 Hello,
13:37 Dandre1 Is there anyway to have session greater than 4K? or is there a plugin that allow storage customisation for sessions?
13:40 pink_mist Dandre1: the size that cookies are allowed to be is limited, in part by browsers ... if you need that much storage per session it'd probably be better to store all that data in the backend and have just a sessionid in the session which would be used to look up the data in the backend
13:41 perlpilot joined #mojo
13:43 Dandre1 Yes, more or less than PHP _SESSION. Is there something already done in mojolicious or must I create it from scratch?
13:43 pink_mist it probably depends on what you have for backend storage
13:44 pink_mist i.e. database
13:46 Petru joined #mojo
13:48 stryx` joined #mojo
13:51 sugar joined #mojo
13:55 Dandre1 I have found Apache::Session but it hasn't been updated since 2007
13:56 Dandre1 oups, sorry 2014...
13:56 pink_mist dude
13:56 pink_mist Apache????
13:56 purl Apache is the microsoft word of web servers
13:57 pink_mist apache is completely the wrong namespace to look at for Mojolicious Plugins
13:57 tchaves joined #mojo
13:57 pink_mist https://metacpan.org/search?q=Mojolicious%3A%3APlugin%20Session here's what you should be searching for
13:58 pink_mist find something amont those results that does what you want
13:58 pink_mist *among
13:59 Dandre1 ok
14:03 ZadYree joined #mojo
14:10 bwf joined #mojo
14:11 gryphon joined #mojo
14:12 tchaves joined #mojo
14:14 Pyritic joined #mojo
14:15 perlpilot joined #mojo
14:16 Ryoga joined #mojo
14:29 sri usually people just realize they don't really need more than 4k sessions
14:30 sri since what they really wanted was some sort of state information in their model
14:30 sri like a permanent shopping cart
14:30 tchaves joined #mojo
14:33 Dandre1 Yes but what do you suggest to store that 'state information' ?
14:33 tchaves joined #mojo
14:48 diegok joined #mojo
14:49 sri your normal database, linked to the user profile
14:59 tchaves joined #mojo
15:01 dikim joined #mojo
15:26 tchaves joined #mojo
15:28 sugar joined #mojo
15:33 gizmomathboy joined #mojo
15:38 batman joined #mojo
15:44 tchaves joined #mojo
15:48 lluad joined #mojo
15:58 dod joined #mojo
16:06 Pyritic joined #mojo
16:07 tchaves1 joined #mojo
16:30 disputin joined #mojo
16:32 Pharmetika joined #mojo
16:35 tchaves joined #mojo
16:37 sugar joined #mojo
16:42 sri hmm
16:42 sri ok, looks like strings with utf8 flag get just written by IO::Socket::SSL without error or warning and end up corrupted
16:43 sri test case https://gist.github.com/anonymous/82f15105133328719f43ee2ab4de3990
16:44 sri remove the upgrade and the test passes
16:47 Petru joined #mojo
16:49 sri cool, if you deactivate tls the test passes too
16:49 sri so, IO::Socket::SSL->syswrite corrupts the string while IO::Socket::IP->syswrite does not
16:52 Dandre joined #mojo
16:54 jberger is that a bug in IO::Socket::SSL then?
16:54 pink_mist sounds like it
16:55 sri possibly
16:57 sri it uses Net::SSLeay functions for writing
16:59 jberger ok, so maybe I should say "a bug in IO::Socket::SSL or its dependencies"
16:59 jberger but that stack generally
16:59 sri workaround patch https://gist.github.com/anonymous/5c104445b17feca80645d2162d21599e
17:00 sri i guess they coudl argue that it's your fault for sending it upgraded strings
17:00 jberger but probably most people don't know that they are doing it
17:00 jberger is there any harm in force-downgrading a string?
17:01 sri i don't know how expensive the downgrade call is
17:02 sri guess it just check the flag and short circuits, which should be dirt cheap
17:02 sri *checks
17:02 sri for those that do it right
17:03 sri 0.525895 wallclock secs ( 0.52 usr +  0.00 sys =  0.52 CPU) @ 19230769.23/s
17:03 sri yea, seems pretty cheap
17:04 jberger does the effect leak back out of our code? meaning does us downgrading $chunk which is passed in downgrade it in the container that the user passed in
17:04 jberger ?
17:05 pink_mist use utf8; my $str = "\x{1f4a9}"; utf8::upgrade $str; utf8::downgrade $str; # Wide character in subroutine entry at
17:07 sri jberger: i wouldn't expect it to
17:13 Grinnz perl APIs should always handle whether they need upgraded or downgraded versions of a string, the user cannot be expected to know about that
17:13 Grinnz meaning the IO::Socket::SSL/Net::SSLeay end should be handling this
17:13 Grinnz whatever part is XS
17:14 Grinnz there is no harm in force downgrading a string as long as all characters are under chr 255
17:14 Grinnz and you aren't planning to pass it to an API which handles downgraded strings improperly, cause that's a thing too
17:14 Grinnz (current DBD::mysql for instance)
17:15 haarg syswrite is only meant to operate on bytes.  eventually sending it a "wide" string will be a fatal error.
17:16 howitdo joined #mojo
17:16 Grinnz jberger: if it's copied out of @_ and not a downgrade operation on $_[X] itself then it wouldn't affect the passed in value no
17:16 jberger ok, I always get worried when calling low-level functions like that
17:16 jberger but more because I DON'T know that because I do
17:36 Petru joined #mojo
17:39 sri if anyone wants to report it as a bug for Net::SSLeay or IO::Socket::SSL please be my guest
17:43 coolo sri: https://rt.cpan.org/Public/Bug/Display.html?ShowHeaders=1;id=98372 - it failed once :)
17:45 jberger interesting, they note that the bug is on Net::SSLeay but also claim it is unfixable
17:45 jberger that would suggest (with the fact that that one failed) that we can and should fix it at the mojo level
17:45 sri nice find
17:46 jberger indeed, coolo++
17:46 Grinnz it does not sound unfixable, but more that the maintainers don't understand how perl strings work
17:47 Grinnz which is common
17:47 jberger but the end result for us is the same
17:47 jberger we can just do it
17:47 sri he calls utf8::downgrade expensive
17:47 sri is there something i might be missing?
17:47 Grinnz expensive or not doesn't matter if you are getting the wrong result
17:48 sri well, if it really is very expensive in some cases we can special case it for TLS alone
17:48 Grinnz usually the solution for this sort of problem is calling the correct XS function to retrieve the string (thus a manual call to utf8::upgrade/downgrade isn't necessary), but i'm not sure if that's the case in this direction
17:50 Grinnz "But you might ask the maintainers of Net::SSLeay if they would add this functionality to SSL_write since checking inside the XS code for SvUTF8 has probably only negligible impact on the performance, compared to doing the same from inside Perl." this is probably the correct answer
17:51 Grinnz unfortunately i don't have the faintest idea how that would be implemented or how to parse Net::SSLeay's code...
17:52 sri his mentions of latin1 seem odd
17:53 coolo sri: the rt is a comment in the IO::Async::SSL code - next to their downgrade call :)
17:53 Grinnz i think he is just referring to how bytes between 128 and 255 would be interpreted after downgrade
17:54 Grinnz which doesnt really matter because they're bytes, not characters
18:00 good_news_everyon joined #mojo
18:00 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vDfEY
18:00 good_news_everyon mojo/master 42a873e Sebastian Riedel: work around a problem with IO::Socket::SSL
18:00 good_news_everyon left #mojo
18:04 good_news_everyon joined #mojo
18:04 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vDfEd
18:04 good_news_everyon mojo/master 822f658 Sebastian Riedel: coolo came up with the test case
18:04 good_news_everyon left #mojo
18:04 sri btw. i've been wondering if maybe we should bring back some way to generate urls with userinfo
18:05 sri $url->to_unsafe_string or so :)
18:10 jberger that issue has come up on #convos too
18:11 jberger I could +1 something like that as long as the name (as you say) makes it clear
18:13 tyldis +1!
18:17 Petru joined #mojo
18:29 good_news_everyon joined #mojo
18:29 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vDf2u
18:29 good_news_everyon mojo/master 132d772 Sebastian Riedel: add to_unsafe_string method to Mojo::URL
18:29 good_news_everyon left #mojo
18:30 tholed joined #mojo
18:31 good_news_everyon joined #mojo
18:31 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vDf2D
18:31 good_news_everyon mojo/master 9438ede Sebastian Riedel: fix typo in example
18:31 good_news_everyon left #mojo
18:32 jberger sri: ah from your test I see why you needed this
18:32 sri you do?
18:33 jberger the browser websocket api can't set headers
18:33 sri actually i just brought back old tests :)
18:33 jberger oh, nm then
18:33 jberger :D
18:34 jberger also, its really annoying that the browser websocket api can't set headers on the handshake request
18:34 sri actually, recently i mostly needed it for REST clients
18:34 sri where you have a configurable base url
18:34 jberger ah true
18:40 sri little unfortunate it takes so much code
19:09 Petru joined #mojo
19:21 disputin joined #mojo
19:22 batman joined #mojo
19:56 PryMar56 joined #mojo
20:15 orev joined #mojo
20:24 rshadow joined #mojo
21:08 gryphon joined #mojo
21:12 sonicepk joined #mojo
21:39 marty_ joined #mojo
21:50 dod joined #mojo
22:21 polettix joined #mojo
22:44 disputin joined #mojo
23:36 sugar joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary