-
Жокир
Just wondering, is there any particular reason why xmpp isn't length prefixed and rather the whole stream is one never ending document? I mean if it were length prefixed than inband binary data could be transmitted without b64✎ -
Жокир
Just wondering, is there any particular reason why xmpp isn't length prefixed and rather the whole stream is one never ending document? I mean if it were length prefixed than inband binary data could be transmitted without b64, among other things ✏
-
lovetox
sounds complicated✎ -
lovetox
sounds more complex to implement ✏
-
lovetox
right now i just feed the stream to a parser
-
lovetox
i try to think about when i need inband data transfered
-
lovetox
and only avatars come to mind
-
Жокир
> sounds more complex to implement Quite the contrary. If stanzas were length prefixed standalone documents you could just feed them to a regular dom building parser of which there are plenty for every language.
-
lovetox
and what is the difference to the parser i push it now?
-
lovetox
do you mean the xml would just end in the middle, like <data>binary data<data>?✎ -
lovetox
do you mean the xml would just end in the middle, like <data>binary data</data>? ✏
-
lovetox
if yes, this would of course be nice, but i maintain a decade old client, and as i said the only usecase come to mind are avatars
-
lovetox
for everything else, you would want to have a out of band transfer that you prefereably can do async
-
lovetox
and i was not there back then, but i guess avatars was not on the mind of xmpp creators, and even if it would be debateable if you design a whole protocol around transfering avatars which is like 1% of xmpp usage or less
-
MattJ
Data framing has some nice properties, but would essentially need everyone to write custom parsers
-
MattJ
XMPP over websocket is framed, FWIW, and supported by many servers
-
flow
Жокир, I think the simple answer is: because XMPP re-uses XML as building block
-
flow
also it is *not* a never ending document, there is an end (at least if you use a transport that closes the connection by sending a closing </stream> tag)
-
Guus
There are limits to max stanza lengths. I don't think that the spec defines a limit, only that one is allowed to exist.
-
Guus
(although I can't immediately find it. Am I wrong here?)
-
Zash
> A deployed server's maximum stanza size MUST NOT be smaller than 10000 bytes
-
Zash
https://xmpp.org/rfcs/rfc6120.html#rfc.section.13.12
-
lovetox
the whole domain name stuff is insane
-
lovetox
luckily python has a idna lib for that
-
lovetox
and i discovered just now luckily it has a UTS46 mapping mode
-
Zash
IDNA 2003/2008 issue?
-
lovetox
2008
-
lovetox
but imagine there would be no python lib for that
-
lovetox
and everybody who implements xmpp, needs to implement the whole idna spec with it
-
lovetox
probably would stop right there and do something different
-
lovetox
yeah easy to miss, the IDNA2003 spec required a mapping phase in the first stage
-
lovetox
for example XMPP.net -> xmpp.net
-
lovetox
IDNA2008 does not require or describe that phase anymore
-
lovetox
so if you do purley idna2008, then you end up with different JIDs here
-
lovetox
it seems they excluded that mapping spec to some other standard because its no strictly required anymore
-
Zash
IIRC our IDNA 2003 code didn't do any lowercasing.
-
lovetox
just discovered this now
-
Zash
But the current stuff seems to do it
-
Zash
"current" = future, actually
-
lovetox
apperently it does
-
lovetox
http://unicode.org/reports/tr46/#IDNA2003-Section
-
lovetox
or it did
-
Zash
$ idn <<< XMPP.net XMPP.net $ idn2 <<< XMPP.net xmpp.net
-
Zash
🤷
-
lovetox
then this is weird, because the standard says, IDNA2003 does require a mapping phase
-
lovetox
IDNA2008 does not
-
lovetox
but maybe this idn2 application just uses sane defaults
-
lovetox
and you can disable the mapping
-
lovetox
just to be clear, 2008 does not require it as part of the IDNA standard
-
Zash
Keep in mind that with JIDs you'd do some stringprep or precis operation on the host part first
-
lovetox
but of course application can do a mapping if wished
-
Zash
IDNA is only for when you do DNS lookups, and DNS is case-insensitive
-
lovetox
Zash, you dont do any precis operation on the domain part
-
Zash
Not?
-
Zash
This topic. Are you trying to make everyone cry themselves to sleep tonight?
-
lovetox
no Zash, it refers to the IDNA rfc
-
lovetox
so we dont need IDNA only for dns lookups
-
lovetox
we need it to know that a@XMPP.net = a@xmpp.net
-
Zash
So IDNA becomes the nameprep step then.
-
lovetox
yes
-
lovetox
to be precis IDNA2008 does no mapping, and requires no mapping
-
lovetox
you need a lib that implements IDNA2008, and the UTS46 mapping or some equivalent
-
lovetox
which is not specified in the idna spec
-
lovetox
hence, my first statement its all insane, and if there would be no lib that would just do that for me
-
lovetox
i probably would stop right there to develop my client :D
-
Zash
I know the feeling.
-
Zash
Hence the part about crying.
-
Zash
We don't have any PRECIS lib atm. We use libidn for stringprep and IDNA (2003). But libidn is deprecated and replaced by libidn2, which does *only* IDNA 2008. No stringprep or precis. Thus not an option.
-
lovetox
and just out of interest i looked up the docs of your application
-
lovetox
and indeed it uses the sane default
-
lovetox
but you can disable it
-
lovetox
--no-tr46 Disable TR46 processing
-
Zash
$ idn2 --no-tr46 <<< XMPP.net xmpp.net
-
lovetox
hm
-
lovetox
lovetox@lovetox:~$ idn2 --no-tr46 XMPP.net XMPP.net
-
lovetox
dont know what your "<<<" does
-
lovetox
but nothing good :)
-
Zash
bash magic, dumps that string to stdin
-
Zash
heredoc without eof marker
-
Zash
pretty handy imo
-
lovetox
yeah but not if it ignores your options
-
Zash
$ idn2 --no-tr46 XMPP.net xmpp.net
-
Zash
Weird
-
lovetox
thats indeed weird
-
lovetox
i use version 2.2.0
-
Zash
https://gitlab.com/libidn/libidn2/-/blob/master/NEWS#L25
-
lovetox
great :)