On Tue, Oct 1, 2013 at 12:59 AM, Glyph email@example.com wrote:
Most of the code I can think of that wants to use that really wants the * transport* rather than the "protocol",
Yes, but having the protocol would also immediately give you access to the transport, and, from what I understand in most cases of AMP, also everything else :)
but nothing within AMP itself actually uses those arguments; in fact, searching the usual suspects (epsilon, vertex) I can't even find any Arguments that use the 'proto' argument for anything useful.
I suppose it's too late to get "proto" to actually mean "proto" and not "boxSender"? It would definitely be a backwards-incompatible change, and I do actually have some code that somehow relied on it being the boxSender (actually, I think I saved that code in txampext, mostly, except I renamed that thing "proto").
If I recall, I believe the idea behind it was to allow an AMP responder within Vertex to return the peer's IP address back to the peer, from within an authenticated AMP route that (because it was a route) wasn't necessarily connected directly to the transport (and therefore couldn't just do self.transport.getPeer()). Ironically I don't think it'll actually work for that now :-).
When we pull the authentication logic in from < http://bazaar.launchpad.net/%7Edivmod-dev/divmod.org/trunk/view/head:/Epsilo..., you might write a responder that's interested in authentication information that lives in some other relation to the protocol.
I wrote very similar deep-in-AMP auth logic once, and did look at that code (but ended up not using it because I use TLS, so I don't need hand-rolled challenge response or OTP systems).
When you say "other relation to the protocol", does that mean "it can be the protocol because the protocol will have some kind of reference to it"?
So in order to fix fromBox/toBox, we need to do a fix that firms up that contract and perhaps exposes more than a Protocol object. The *recommended* API should be more or less like what ExposingArgument is doing - specify an Argument that asks for a particular attribute of the transport or the protocol or the authentication context or whatever, the implementation details may involve other lower-level public APIs.
That still sounds like it can be done by making "proto" actually the proto ;-) So, basically, the question is if "proto" being the locator is a bug that I can fix, or an interface that I can't.
My contributions to AMP have been more of the defect-findy kind, but I could certainly turn them more into the code-contributy kind. I imagine I'm not the first person to want tests for command classes ( https://github.com/lvh/txampext/blob/master/txampext/commandtests.py) or a nested AMP box ( https://github.com/lvh/txampext/blob/master/txampext/nested.py).
That would be cool. And, you know, that auth thing I said :-).
If I can change "proto" to mean "actually the protocol not something else" then that seems plenty easy to add, and it would definitely be cool if people don't have to mess with this nonsense themselves for something as ostensibly simple as having access to the protocol :-)