22 Feb 2024
SmokeMachine jnthn: 👆 23:09
jnthn: I tried doing `my &where = -> Int $i, Int $actual { say "$actual == $i -> { $actual == $i }"; $actual == $i }` and used it on when like: `post -> Int $a where &where.assuming: $i {...}` 23:18
I 'm still getting: www.irccloud.com/pastebin/bBAmBlLc/ 23:19
is there a way to do that inside a loop? 23:21
or the only solution is have a single route and do the validation inside of it? 23:23
jnthn Nol the `where` block is not a closure. You can try requesting /0 and /1 and probably observe it always compares against the same RHS
It's either that or something EVAL-y 23:24
SmokeMachine ok, I'll try that...thanks 23:25
jnthn You can completely golf Cro out of it, fwiw 23:26
raku -e 'my @x; ^3.map: -> $i { @x.push(-> $ where { say $i; $_ == $i } { say $i }) }; @x[0](0)'
SmokeMachine yes... 23:31
m: my @x; ^3 .map: -> $i { @x.push(-> $ where { say $i; $_ == $i } { say $i }) }; @x[0](2)
oh, sorry... no camelia... :(
23 Feb 2024
Have anyone seen this? it breaks when receive a request with empty body and content-type application/x-www-form-urlencoded: gist.github.com/FCO/e41f8620aa38a2...7143cadd50 23:06
24 Feb 2024
jnthn SmokeMachine: Try upgrading to the latest Cro::HTTP; I think I discovered and fixed that one last month. 18:03
SmokeMachine :) thanks, I'll try 20:01
6 Mar 2024
Geth cro-webapp: patrickbkr++ created pull request #88:
Fix using template parts via render-template
21:27
japhb I took a look at the PR, which seems pretty simple, but it's failing CI ... and as far as I can tell, that's unrelated to the PR, but rather a problem or incompatibility between Digest and the 2021.03 Rakudo release. 23:36
I want CI to actually be useful for us, so I'm going to try CI'ing with only Rakudo latest. (I've recently come across at least one module that only works in 2023.12 or later *intentionally* so it seems there's a compatibility break there of some kind.) 23:38
OK, trying by just running the ubuntu-latest/latest Rakudo job in the CI version matrix, we'll see how it goes. 23:39
12 Mar 2024
Xliff Wakey wakey? 00:11
Has anyone done anything with Cro::HTTP::Auth?
japhb Xliff: A tiny bit: github.com/Raku-MUGS/MUGS-UI-WebSi...on.rakumod 00:32
Xliff: That defines a session, and then the session-routes() sub here makes use of the definitions: github.com/Raku-MUGS/MUGS-UI-WebSi...es.rakumod 00:33
Xliff Thanks, japhb! I'll take a look, later. 00:34
japhb :+1:
patrickb Cliff: Another case: I use a JWT auth in the RakudoCIBot: github.com/Raku/RakudoCIBot/blob/m...akumod#L20 08:17
14 Mar 2024
melezhik o/ my cro application (sparky) consumes way too much CPU even being idle, is it typical for cro? 18:03
basically here the code - github.com/melezhik/sparky/blob/ma...y-web.raku
maybe web sockets do that? 18:04
github.com/melezhik/images/blob/0b...21.05.jpeg 18:06
github.com/melezhik/sparky/commit/...12e180fc4d 18:16
hopefully this will fix this 18:21
japhb melezhik: Did that work? Because no, >2.6 cores at *idle* is really not normal. 23:48
I did a lot of work on Cro's WebSockets performance, and assuming you're not sending a *continuous* stream of packets or connection requests, or really *large* packets, it should barely even notice it. 23:50
15 Mar 2024
melezhik . 12:52
hi japhb, yes this did the trick, basically I had a web socket endpoint gets called all the time from the main page, that produces constant web socket flow and executing uptime command every 10 second, and that consumed a lot of CPU, now this endpoint is not called from web UI - 12:54
github.com/melezhik/sparky/blob/ma...#L409-L428
good lesson for me )
26 Mar 2024
Xliff This mechanism could be exploited by Cro-based servers for implementing virtual hosting. Consider: 05:41
route { get { content 'text.html', load-template('index.crotmp') }; } # Normal 05:42
route { get -> :$Host is required is header where * eq 'my.virtual.host' { content 'text.html', load-template('mvh-index.crotmp') }; } # Only shows up when my.virtual.host is used to access the server 05:43
There are drawbacks to this, but it is nice to know that the effect is possible.
Now to figure out how to make it configurable.... Hmmm....
/j #raku 18:35
1 Apr 2024
lizmat: Did you see my earlier comment about implementing virtual domains with Cro::HTTP::Router? 14:12
lizmat yes, I did, sounds like being useful ? 14:15
Xliff Yes, think I have a way to formalize it so that you don't have to add it to a signature for every method you want on that virtual domain. 14:36
I'm still hoping I can get my Raku-based app server released from $dayJob.
lizmat that'd be cool 15:53
8 Apr 2024
Xliff aku 02:13
9 Apr 2024
SmokeMachine Is there a way to make Cro work with unix sockets? 00:05