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

IRC log for #mojo, 2018-02-23

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

All times shown according to UTC.

Time Nick Message
00:46 matt joined #mojo
03:30 khamsin joined #mojo
03:49 khamsin joined #mojo
04:09 gabiruh joined #mojo
04:41 mohawk Grinnz, thanks for the drive-by review
04:41 mohawk i'm having trouble actually repro-ing for a failing test
04:42 gabiruh joined #mojo
04:42 mohawk i tried in t/basic.t to put: $@ = ''; # before the things that throw exceptions there
04:42 mohawk and $@ is still correctly set
04:43 mohawk and on 5.24 this does not silently lose $@:
04:44 mohawk perl -e 'sub md { local $@; die "yo" } print "1: $@\n"; eval { md() }; print "2: $@\n"; '
04:46 mohawk i commented on the same commit
04:47 khamsin joined #mojo
04:48 gabiruh joined #mojo
04:48 Repaster joined #mojo
04:49 pink_mist mohawk: https://perl.bot/p/xneoqv perls earlier than 5.14 seems to have issues with your code
04:51 mohawk pink_mist, thanks! it's as well MooX::Thunking is 5.14+ then!
04:52 mohawk also, i did not know of that service, which is pretty neat
04:54 pink_mist it sure is =)
04:54 pink_mist simcop2387 is the man behind it
04:55 Grinnz yeah, it's only a problem on <5.14
04:55 Grinnz probably still a good idea to add the test
04:55 mohawk nice one simcop2387
04:56 simcop2387 lots of planned improvements to it still, i have too many projects
04:57 simcop2387 and it's powered by mojo too! https://github.com/perlbot/perlbuut-pastebin/
04:57 simcop2387 though the new civ 6 expansion hasn't helped any personal projects at all
05:04 dboehmer_ joined #mojo
05:22 khamsin joined #mojo
05:39 dustinm joined #mojo
06:11 mohawk jberger, no merge on openapi blog post tweaks?
06:39 sh14 joined #mojo
06:45 dim0 joined #mojo
07:58 noganex joined #mojo
07:59 McA joined #mojo
08:02 Vandal joined #mojo
08:07 berov joined #mojo
08:16 dod joined #mojo
08:16 petru joined #mojo
08:21 dod joined #mojo
08:50 trone joined #mojo
09:00 Edward joined #mojo
09:11 sri mohawk: https://irclog.perlgeek.de/mojo/2018-02-20#i_15839586
09:51 coolo joined #mojo
10:11 djk joined #mojo
10:54 tchaves joined #mojo
11:17 tcohen joined #mojo
13:55 gizmomathboy joined #mojo
14:01 tcohen joined #mojo
14:39 dod joined #mojo
14:43 petru joined #mojo
14:51 Pyritic joined #mojo
15:11 gryphon joined #mojo
15:28 jkramer https://github.com/perl6/perl6.org/blob/master/source/fun/index.html - the troll link is dead and also there's an unmatched </div> at the end and one too many </ul>s in the middle
15:28 jkramer Sorry wrong chat :)
15:30 wouter joined #mojo
15:30 wouter hi -- can I set a default for a particular header in a way that it will be sent out with every request?
15:31 wouter I can do a $c->headers->foo($c->foo_helper) at the start of every request sub, but that seems error-prone
15:32 jberger wouter: to clarify, this is using Mojo::UserAgent?
15:32 wouter jberger: no, the server side of things
15:32 jberger so this is response
15:32 wouter yeah
15:32 jberger oh, I guess I can see how your question is read that way, sorry, I read it wrong
15:33 jberger anyway, yes, you can use one of several of the application hooks
15:33 wouter well, I should have used the correct terminology to start with :)
15:33 jberger http://mojolicious.org/perldoc/Mojolicious#HOOKS
15:34 jberger probably before_dispatch
15:45 wouter that seems to work, thanks!
15:46 dantti_laptop|2 joined #mojo
15:59 dod joined #mojo
16:15 berov joined #mojo
16:38 ChmEarl joined #mojo
16:45 kes joined #mojo
16:47 kes in mojolicious the type html is defined as:
16:47 kes html     => ['text/html;charset=UTF-8'],
16:49 kes why when I send req with next headers: http://paste.scsys.co.uk/574019
16:49 kes the 'htm' exists in $c->accepts?
16:50 kes what did I wrong?
17:04 Grinnz um, 'text/html' and 'text/html;charset=UTF-8' are different
17:29 epiphero joined #mojo
17:29 epiphero joined #mojo
17:30 kes But I can not mix them together as you show
17:30 kes https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
17:46 dod joined #mojo
17:50 tcohen joined #mojo
17:56 maschine joined #mojo
17:58 kes errr... this section do not describe different behavior when $c->req->is_xhr is TRUE
17:58 kes http://mojolicious.org/perldoc/Mojolicious/Plugin/DefaultHelpers#accepts
18:02 kes Please extend this section to be similar to this: http://mojolicious.org/perldoc/Mojolicious/Renderer#accepts
18:02 kes or reduce it to just: Select best possible representation with  "accepts" in Mojolicious::Renderer
18:02 kes to force reader look at FULL version
18:15 matt joined #mojo
18:20 anony joined #mojo
18:32 kes The requests can be done not only with browsers. And when client says: "Accept: text/html,application/xml;q=0.9" the mojo application faulty thinks that client wants 'json':
18:32 kes $c->accepts( 'json', 'html' ); # json
18:33 trone joined #mojo
18:33 jberger kes: accepts returns the first item if nothing specific is found
18:34 jberger that's why $c->accepts('', 'json') is recommended for checking if json is explicitly requested
18:34 kes doing same request from browser will return:
18:34 jberger so what your example is showing is that it doesn't split the accept header into multiple parts
18:34 kes $c->accepts( 'json', 'html' ); # html
18:35 spicyjack joined #mojo
18:36 jberger kes: I don't understand what you are actually asking
18:37 kes I want to say that server (mojo app) should not decide what client want
18:37 kes https://metacpan.org/source/SRI/Mojolicious-7.67/lib/Mojolicious/Types.pm#L44
18:39 kes in first case client asks html or xml, but server return 'json'
18:39 Grinnz jberger already told you how to fix that
18:40 cng joined #mojo
18:43 kes That still does not work: $c->accepts( '', 'json', 'html' )
18:43 kes it return '' instead of 'html'
18:43 kes for header: text/html,application/xml;q=0.9
18:44 jberger as is documented "defaults to returning the first extension if no preference could be detected"
18:44 kes but doing same request from browser will return 'html'
18:45 good_news_everyon joined #mojo
18:45 good_news_everyon [mojo] kraih tagged v7.68 at 78f89b3: https://git.io/vAaMY
18:45 good_news_everyon left #mojo
18:45 good_news_everyon joined #mojo
18:45 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vAaMO
18:45 good_news_everyon mojo/master 3197f6c Sebastian Riedel: bump version
18:45 good_news_everyon left #mojo
18:45 jberger kes: so after all that, your question is "why does accepts use is_xhr to determine whether to check the multiple format accept header or not?"
18:45 jberger and to that, I don't have the answer, I assume there's a "living spec" kind of answer
18:45 kes as work around I add X-Requested-With: XMLHttpRequest for all clients which make request
18:46 jberger kes: why not use a more standard accept header instead?
18:47 kes because mojo ignores its content if there are mote than one type
18:47 kes *more
18:48 jberger sigh, that isn't what I asked, I asked why are you sending an accept header with more than one type?
18:50 jberger kes: it seems that the reason the helper uses is_xhr is that browsers have typically sent very bad accept headers but xhr are user-generated requests and can be better trusted
18:52 kes I do not know why that is done that way. Maybe because that client can process answers with both types. I can not restrict that I just add new header to not break existing code (
18:52 Seth joined #mojo
19:34 dod1 joined #mojo
19:37 Pyritic joined #mojo
20:17 Pyritic joined #mojo
20:28 dantti_laptop|2 joined #mojo
20:29 jamesaxl joined #mojo

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