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

IRC log for #mojo, 2016-03-12

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

All times shown according to UTC.

Time Nick Message
00:00 batman https://drive.google.com/open?id=0B_tCHIu9z7YSVjhDVEpjcFJFUDg
00:00 batman oh. wrong channel :/
00:00 batman time to get some sleep i guess :-)
01:05 asarch joined #mojo
03:25 new_student joined #mojo
03:34 kaare joined #mojo
03:41 noganex joined #mojo
05:24 ichi joined #mojo
05:26 irqq joined #mojo
06:25 sebbe joined #mojo
06:28 Kundun joined #mojo
07:09 avkhozov joined #mojo
07:25 bpmedley joined #mojo
07:36 eseyman joined #mojo
07:40 dod joined #mojo
07:44 dod joined #mojo
08:12 Vandal joined #mojo
08:13 batman joined #mojo
08:24 irqq joined #mojo
09:06 jasanj joined #mojo
09:08 jasanj hi
09:08 jasanj $ua->start($tx)
09:09 jasanj I want modify the $tx->req->headers then reuse this $tx
09:09 jasanj $ua->start($tx)
09:09 jasanj then, I got  Can't call method "stream" on an undefined value
09:10 jasanj what's correct way to do this ?
09:32 klapperl_ joined #mojo
09:38 jasanj http://stackoverflow.com/questions/33096215/using-the-same-connection-with-mojouseragent
09:39 jasanj actually I got the same problem with this
10:17 Kundun joined #mojo
10:48 kes joined #mojo
11:46 batman jasanj: Mojo::UserAgent automatically keeps open keep-alive connections
11:46 batman you can configure the number of connections to keep alive using the max_connections() attribute
11:50 jasanj` joined #mojo
11:50 jasanj` because NTLM need a keep-alive connection, the first handshake will
11:50 jasanj` response code 401, this make $tx close(in Mojo::UserAgent code), So
11:50 jasanj` I can't continue the second connection with last $tx
11:50 jasanj`
11:54 jasanj` batman: max_connection default is 5, I don't think my connection number will break this
11:55 jasanj` batman: my problem is how to keep-alive if the connection response code 401 ?
11:55 batman don't paste.
11:56 batman i don't know NTLM. can't help you.
11:59 irqq joined #mojo
13:29 kes jasanj`: 4xx codes is error codes. We can not keep-alive if remote side return us error. Why the NTLM first handshake return 401?
13:31 kes 401 means Unauthorized. Do you supply right arguments to enable connection?
13:33 jberger jasanj`: have you tried while setting MOJO_USERAGENT_DEBUG=1 ?
13:33 jberger You can see from that output if it is reusing the connection
13:34 aborazmeh joined #mojo
13:34 jberger But reading through the code i don't see that it closes connections on 401 status
13:44 bpmedley jasanj , jasanj` : Will you pastie or gist some sample client code?
14:02 jasanj` kes: http://www.innovation.ch/personal/ronald/ntlm.html
14:02 jasanj` see the NTLM Handshake part
14:04 jasanj` at step 2 and step 4, server will response 401
14:05 kes Why you expect keep-alive?
14:05 kes I think the 'S' do not keep connection because you are not authorized yet.
14:06 jasanj` jberger: yes, I've open this debug option, it'll print '-- Reusing connection ..'
14:06 kes Then after you complete all steps only at that case 'S' will enable connection with 'C' and may keep-alive
14:11 jasanj` kes: please see the 'Keeping the connection alive' part below, it requres kept alive between step 4 and step 5
14:11 kes yes, but it is not required for first handshake (between step 2 and 3)
14:12 jasanj` yes
14:13 jasanj` actually I do need keep alive at step 3,4,5,6
14:13 jasanj` and at step 4 it'll response 401 and the connection close
14:13 kes does the connection is closed after step 4?
14:14 kes ok. What the NTLM server logs says?
14:14 kes after it send response to you after step 4?
14:16 kes it is maybe the NT do not know your host or domain you are sending at first message, so it close connection
14:16 kes *first message = Type-1 Message
14:18 kes or you send broken Type-1 Message. Look to logs of server you send messages to
14:21 kes do you send direct requests or through proxy?
14:23 jasanj kes: I use direct requests
14:23 jasanj I'll put some log to gist for you
14:23 kes Because Certain HTTP proxies will break NTLM authentication, presumably by not allowing persistent connections
14:24 kes maybe this will be useful to you: http://davenport.sourceforge.net/ntlm.html section NTLM HTTP Authentication
14:27 jberger if you see "Reusing Connection" then I think we can say it isn't a Mojo issue
14:27 bpmedley jasanj` : Can I see your perl client code?
14:37 jasanj https://gist.github.com/tadegenban/25a89fe9576e8e0741f3
14:39 jasanj bpmedley: here is my client code, I attempt to port a LWP::Authen::Ntlm with Mojo::UserAgent
14:40 jasanj most code is borrowed from Mojo::UserAgent::DigestAuth
14:41 jasanj because the server site is an internal site, so you can't connect to it
14:41 kes jasanj: where logs from server?
14:41 bpmedley jasanj : Casual visual inspection looks like you're rebuilding a $tx
14:41 jberger jasanj: does it work blocking?
14:42 jberger this is a blocking request here: https://gist.github.com/tadegenban/25a89fe9576e8e0741f3#file-ntlm-authetication-L42
14:43 jberger which means if you are trying to do a nonblocking request and the second request is blocking then you use a different ioloop and thus a different connection
14:43 jasanj kes: how to get log from server? it's an internal site not under my control
14:43 bpmedley https://gist.github.com/tadegenban/25a89fe9576e8e0741f3#file-ntlm-authetication-L38 <-- Is this a new tx?  Won't this create a new connection?
14:43 jberger bpmedley: not necessarily
14:43 jberger the question is keep alive
14:44 jberger and jasanj already said that (s)he sees "Reusing connection" so keep alive is working
14:44 jberger (which actually answers my question I guess)
14:45 jberger but I suspect you are going to have a problem with the nonblocking form
14:47 jasanj I think i'm using blocking method
14:47 jberger jasanj: why are the logs out of order there
14:47 jberger copypasta?
14:47 jasanj I'm not sure, I do not use any callback, So I use blocking form right?
14:47 jberger right
14:48 jberger wait! you are calling start twice
14:48 jasanj yes
14:49 jberger line 42 and line 70
14:49 jasanj what's the problem ?
14:49 jberger those are both on the second request
14:49 jasanj I need request twice
14:49 jberger let me say it differently
14:49 jberger overall you are calling start 3 times
14:50 jberger line 68 (req1) then line 42 (req2-1) then line 70 (req2-2)
14:50 jasanj yes
14:50 jberger that's not right
14:51 jasanj I want do 3 require
14:51 jberger then you need 3 transactions
14:52 jberger I have no idea what happens if you call start on a transaction more than once
14:52 jberger but I'm gonna guess it doesn't work too well
14:52 jasanj the first transaction is not important, I need make sure the 2nd , 3rd transction is the 'same transaction' I don't know how to describe it, which the document says 'keep alive'
14:53 jberger keep alive is done at the TCP level
14:53 jasanj yes it will fail https://gist.github.com/tadegenban/25a89fe9576e8e0741f3#file-ntlm-authetication-L150
14:54 jasanj and it only failed when the last request return 401
14:54 jasanj it will worked will when the last request return 200
14:55 kes jberger: how to make second request in the current transaction?
14:55 jberger kes: there is no explicit way to do that, you have to trust that the connection is kept alive
14:57 kes so is it  ok to call start two or more times?
14:58 jberger I already said that that is almost certainly undefined behavior
14:58 kes ((
14:58 jberger the transaction object is a container for one transaction
14:59 jberger https://github.com/kraih/mojo/blob/master/lib/Mojo/UserAgent.pm#L169
14:59 jberger calling _dequeue is where you get cached connections
14:59 jberger if you want to see how that works
15:00 jberger and they are cached in the _reuse method
15:00 kes jasanj: why you get 'can't call method 'stream': https://gist.github.com/tadegenban/25a89fe9576e8e0741f3#file-ntlm-authetication-L150
15:00 jberger none of that is public api and that is by design
15:01 jberger I think any protocol that depends on HTTP keep alive is kinda insane though
15:01 jberger keep alive is an optimization
15:02 jasanj kes: that's because https://metacpan.org/source/SRI/Mojolicious-6.55/lib/Mojo/UserAgent.pm#L153  $c->{ioloop} is not defined
15:03 jasanj and that's because the $ua->{connections} is {} when the 2nd transaction finisd
15:04 jasanj the 2nd transaction got 401 so it close the connection, then $ua->{connections} is empty
15:06 kes may run code under debugger? it will take you over all steps. So can see where it is closed and why
15:06 jasanj perl -d ?
15:06 kes yes
15:06 jasanj I've never used this, I can have a try
15:07 kes you 'n' command if you want to step over, or 's' if you want to dig deeper, 'r' to return from sub
15:08 jberger jasanj: have you tried with a third transaction yet?
15:08 kes 'x' to spy variable value
15:08 kes x $variable
15:08 jberger (btw as I'm readying about this protocol I only see two request cycles)
15:11 jberger hmmmm now I see one with three
15:12 jasanj https://gist.github.com/tadegenban/25a89fe9576e8e0741f3#file-ntlm-authetication-L70
15:12 jasanj this is the third transcation
15:13 jberger this is the best documentation I've found so far: https://blogs.msdn.microsoft.com/chiranth/2013/09/20/ntlm-want-to-know-how-it-works/
15:14 jberger jasanj: no that's the second use of the second transaction
15:14 jberger please try it with a third transaction object
15:16 sri 4xx/5xx handling is borked in Mojo::UserAgent
15:17 jberger sri: ?
15:17 sri "Connection: close" is supposed to end the keep-alive connection, not arbitrary 4xx/5xx response codes
15:17 jberger sri: it doesn't
15:17 sri Mojo::Server::Daemon gets it right
15:18 sri Mojo::UserAgent needs to be fixed
15:18 jberger sri: I don't think that's the case
15:18 sri it is
15:19 jberger sri: is calling start two times on the same $tx supported?
15:19 sri a 401 response shouldn't kill the keep-alive connection
15:20 jberger until I see that jasanj has the same behavior when using a different $tx container I'm not going to start digging around in Mojo::UserAgent
15:20 sri actualy, i might just be wrong, lol
15:21 sri just looked over the conversation on my phone, can't test it
15:21 sri in fact, ignore me
15:21 * sri vanishes
15:22 jberger :D
15:22 * jberger looks around for sri
15:24 sri yea, i got the order wrong in _finish, and no, reusing transactions would be crazy
15:25 sri haha, now i need to hide in shame for at least two weeks ;p
15:25 * jberger absolves sri's shame
15:26 jasanj jberger: actually I used a third transaction before, and I'll not got any fail, but it'll never pass the NTLM authenication
15:26 jberger jasanj: I can't advise you on how to do NTLM, this is the first I'm hearing of it
15:27 jberger but I can definitely say that using the same transaction object twice is not supported
15:27 jberger so feel free to continue however you'd like given that information
15:28 jberger I hope I'm not sounding too harsh
15:29 sri should be easy enough to deal with it like redirects
15:29 jberger but I also have no interest in continuing down a debugging path that starts at a scenario that I know is unsupported
15:30 jasanj fine
16:01 sri jberger: umm, actually i was not wrong -.-
16:01 sri Mojo::UserAgent is borked
16:01 jberger oh?
16:02 sri https://gist.github.com/anonymous/ca074ea5d4fa5896147c
16:04 sri totally borked, any 4xx/5xx response will kill the keep-alive connection
16:05 * sri will not be working on a fix while on hiatus though
16:06 sri 404 breaking keep-alive seems like a pretty big performance problem
16:08 gryphon joined #mojo
16:09 sri all yours ;p https://github.com/kraih/mojo/issues/935
16:13 sri there's two _reuse calls in _finish, i missed that when i looked at the code on my phone
16:13 sri second one is the broken one
16:15 jberger what does it mean for a connection to already have a ->connection on it
16:15 jberger looking at this line: https://github.com/kraih/mojo/blob/master/lib/Mojo/UserAgent.pm#L169
16:17 neilhwatson joined #mojo
16:36 thowe joined #mojo
16:42 jberger sri: git bisect points to this commit https://github.com/kraih/mojo/commit/f7ea445163f31710008f6605445f9ce7fbf90792
16:46 sri if i had to guess, CONNECT support
16:51 lluad joined #mojo
16:53 jberger actually, its obvious
16:53 jberger https://github.com/kraih/mojo/blob/master/lib/Mojo/UserAgent.pm#L281
16:53 jberger || $tx->error
16:55 jberger removing that check makes your new tests pass but horribly breaks t/mojolicious/longpolling_lite_app.t
16:57 jberger sri ^^
16:57 cpan_mojo Mojolicious-Plugin-Tables-0.02 by FRANKC https://metacpan.org/release/FRANKC/Mojolicious-Plugin-Tables-0.02
16:58 sri problem is this https://github.com/kraih/mojo/blob/master/lib/Mojo/UserAgent.pm#L226-L228
16:59 sri should be easy to fix with some cleaning up of the checks
16:59 sri (not that i know how)
17:04 jberger I think it works just moving the elsif (now if) under the second _reuse
17:04 * jberger is making a patch
17:05 jberger git-apply doesn't seem to like your test patch :s
17:05 sri sue me
17:05 jberger ah newline
17:07 jberger hmmm one other test breaks
17:08 jberger or maybe my box is being insane
17:09 jberger heisenbug: sometimes t/mojo/prefork.t line 75. fails
17:11 good_news_everyon joined #mojo
17:11 good_news_everyon [mojo] jberger created keep-alive-fix (+1 new commit): https://git.io/vanAy
17:11 good_news_everyon mojo/keep-alive-fix a999f69 Joel Berger: Check for HTTP errors after attempting to cache connection for reuse...
17:11 good_news_everyon left #mojo
17:16 Kundun joined #mojo
17:17 sri you forgot to remove a comment ;p
17:17 jberger I'm starting to think that my box was doing something strange
17:17 jberger oh, damn I remember thinking about that
17:17 sri funny how that fix wouldn't have been possible without our recent refactoring
17:19 sri don't dismiss random errors, could be a timing problem
17:20 sri happens a lot in the longpolling test when changing this kinda code
17:21 good_news_everyon joined #mojo
17:21 good_news_everyon [mojo] jberger pushed 1 new commit to keep-alive-fix: https://git.io/vanxr
17:21 good_news_everyon mojo/keep-alive-fix 4f00c4c Joel Berger: improve comments
17:21 good_news_everyon left #mojo
17:22 sri jberger: that seems a bit too verbose
17:22 sri "# Handle redirects or invoke callback"
17:22 sri lol
17:22 jberger what do you want from me :-P
17:23 jberger I can't make that test fail again
17:23 sri if in doubt, just get rid of the comment
17:24 * sri tries to limit his commenting to stuff that answers the "why?", or labeling a series of code blocks that makes it easier to find the right one
17:25 jberger the setting of the 4xx/5xx errors probably don't need the comment either
17:25 good_news_everyon joined #mojo
17:25 good_news_everyon [mojo] jberger pushed 1 new commit to keep-alive-fix: https://git.io/vanxb
17:25 good_news_everyon mojo/keep-alive-fix 85c3fd4 Joel Berger: de-improve the comments
17:25 good_news_everyon left #mojo
17:26 jberger don't worry about the noise, I'll squash this up
17:26 jberger how does that look overall?
17:26 sri i would also remove the empty lines in between i guess
17:27 sri _reuse is not actually finishing the connection
17:27 sri the callback is what finishes it imo
17:27 jberger I thought that was the user-provided callback
17:28 sri it is (most of the time)
17:28 jberger _reuse calls _remove
17:28 sri i suppose one might also say that the transaction itself is already finished
17:29 jberger if you'd like to push a commit to the branch for comments you'd prefer, be my guest
17:29 jberger I'll just squash them in
17:30 jberger or I could squash now and you could tweak after
17:30 sri no, i'm just judging from a distance ;p
17:30 jberger ok force-push coming
17:32 good_news_everyon joined #mojo
17:32 good_news_everyon [mojo] jberger force-pushed keep-alive-fix from 85c3fd4 to 213bbcb: https://git.io/vanpE
17:32 good_news_everyon mojo/keep-alive-fix 213bbcb Joel Berger: Check for HTTP errors after attempting to cache connection for reuse...
17:32 good_news_everyon left #mojo
17:34 jberger look good? I can't replicate the one test failure
17:35 lsm joined #mojo
17:35 jberger I've run the tests many times now
17:40 jberger ok, well I'm gonna call that good
17:41 good_news_everyon joined #mojo
17:41 good_news_everyon [mojo] jberger pushed 1 new commit to master: https://git.io/vanpd
17:41 good_news_everyon mojo/master 3eeedce Joel Berger: Check for HTTP errors after attempting to cache connection for reuse...
17:41 good_news_everyon left #mojo
17:41 good_news_everyon joined #mojo
17:41 good_news_everyon [mojo] jberger deleted keep-alive-fix at 213bbcb: https://git.io/vanpN
17:41 good_news_everyon left #mojo
17:42 sri that newline seems weird https://github.com/kraih/mojo/commit/3eeedce16da1c19db430b6d437b9ce8c8565c9e3#diff-955b07afef3c0b8632a50118b370262cR242
17:42 sri style of the Changes entry is inconsistent ;p https://github.com/kraih/mojo/commit/3eeedce16da1c19db430b6d437b9ce8c8565c9e3#diff-c112bb3542e98308d12d5ecb10a67abcR3
17:42 jberger the remaining stuff has nothing to do with the comment
17:43 jberger argh
17:43 sri maybe just remove the comment?
17:43 good_news_everyon joined #mojo
17:43 good_news_everyon [mojo] jberger pushed 1 new commit to master: https://git.io/vanh3
17:43 good_news_everyon mojo/master 6fe5224 Joel Berger: fix style in Changes
17:43 good_news_everyon left #mojo
17:44 sri it's also past tence
17:44 sri :)
17:45 good_news_everyon joined #mojo
17:45 good_news_everyon [mojo] jberger pushed 1 new commit to master: https://git.io/vanh0
17:45 good_news_everyon mojo/master 6cb1172 Joel Berger: tidy up a little
17:45 good_news_everyon left #mojo
17:46 jberger http://i0.kym-cdn.com/photos/images/newsfeed/000/305/236/ddc.jpg
17:46 sri jberger++
17:47 jberger jasanj`: can you try your code (hopefully with three transactions :-P) against the master branch
17:47 * sri still loves this one http://25.media.tumblr.com/b03462cfcf14e505d7ee429db972178f/tumblr_mgojlkFgev1ry16ypo1_500.gif
17:47 jberger hehe
17:47 asarch joined #mojo
18:00 jberger sri: since it went from elsif to if, do you think if would be important to check !$res->error here https://github.com/kraih/mojo/commit/3eeedce16da1c19db430b6d437b9ce8c8565c9e3#diff-955b07afef3c0b8632a50118b370262cR243
18:22 ichi joined #mojo
18:40 jontaylor joined #mojo
18:52 PryMar56 joined #mojo
18:56 HtbaaPi joined #mojo
19:07 marty joined #mojo
19:11 jberger hey look another one https://metacpan.org/pod/Crypt::LE
19:15 lluad joined #mojo
19:25 jontaylor joined #mojo
20:02 jontaylor joined #mojo
20:11 genio joined #mojo
20:45 irqq joined #mojo
21:12 genio joined #mojo
21:23 Vitrifur joined #mojo
22:46 genio joined #mojo
23:07 rabbit joined #mojo
23:09 rabbit I'm converting a section of my (previous CGI) code to use mojolicious, and it is the upload manager. I have the ENCTYPE listed as multipart/form-data, and I'm defining <input type="FILE" name="ulfile0" />, should params pick this up? It doesn't seem to be listed in the list of params.
23:18 rabbit Please cancel the request as I think I can probably solve this.
23:21 jabberwok joined #mojo

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