jdev - 2021-10-17


  1. malthe has left
  2. moparisthebest has left
  3. moparisthebest has joined
  4. debacle has left
  5. marc0s has left
  6. marc0s has joined
  7. Sam has left
  8. stpeter has left
  9. Vaulor has left
  10. mac has left
  11. mac has joined
  12. Sam has joined
  13. paul has left
  14. stpeter has joined
  15. wurstsalat has left
  16. mac has left
  17. mac has joined
  18. raghavgururajan has left
  19. raghavgururajan has joined
  20. raghavgururajan has left
  21. goffi has left
  22. mac has left
  23. mac has joined
  24. raghavgururajan has joined
  25. stpeter has left
  26. stpeter has joined
  27. Yagizа has joined
  28. stpeter has left
  29. Vaulor has joined
  30. DebXWoody has joined
  31. DebXWoody has left
  32. stpeter has joined
  33. marc0s has left
  34. marc0s has joined
  35. paul has joined
  36. stpeter has left
  37. stpeter has joined
  38. stpeter has left
  39. marc0s has left
  40. marc0s has joined
  41. DebXWoody has joined
  42. Pete has left
  43. Pete has joined
  44. atomicwatch has joined
  45. Alex has left
  46. Alex has joined
  47. mikeye has joined
  48. raghavgururajan has left
  49. emus has joined
  50. mikeye has left
  51. dezant has left
  52. pasdesushi has joined
  53. jgart has left
  54. jgart has joined
  55. jgart has left
  56. mac has left
  57. raghavgururajan has joined
  58. emus has left
  59. emus has joined
  60. malthe has joined
  61. nephele has joined
  62. nephele has left
  63. Vaulor has left
  64. wurstsalat has joined
  65. malthe has left
  66. malthe has joined
  67. debacle has joined
  68. goffi has joined
  69. antranigv has joined
  70. goffi has left
  71. goffi has joined
  72. antranigv has left
  73. antranigv has joined
  74. inky has joined
  75. malthe has left
  76. jgart has joined
  77. debacle has left
  78. marc0s has left
  79. marc0s has joined
  80. Vaulor has joined
  81. malthe has joined
  82. larma has left
  83. goffi has left
  84. raghavgururajan has left
  85. pasdesushi has left
  86. xecks has joined
  87. huhn has joined
  88. qrpnxz has left
  89. qrpnxz has joined
  90. debacle has joined
  91. pasdesushi has joined
  92. inky has left
  93. inky has joined
  94. marmistrz has left
  95. marc0s has left
  96. marc0s has joined
  97. pasdesushi has left
  98. xecks has left
  99. pasdesushi has joined
  100. huhn has left
  101. larma has joined
  102. jgart has left
  103. sonny has left
  104. SouL has left
  105. SouL has joined
  106. PapaTutuWawa has joined
  107. emus has left
  108. marc0s has left
  109. marc0s has joined
  110. inky has left
  111. raghavgururajan has joined
  112. jgart has joined
  113. jgart has left
  114. larma has left
  115. larma has joined
  116. larma has left
  117. larma has joined
  118. larma has left
  119. larma has joined
  120. marc0s has left
  121. marc0s has joined
  122. DebXWoody has left
  123. raghavgururajan has left
  124. raghavgururajan has joined
  125. debacle has left
  126. marc0s has left
  127. marc0s has joined
  128. Matrix Traveler (bot) has left
  129. homebeach has left
  130. Server Stats Discoverer (traveler bot) has left
  131. Server Stats Discoverer (traveler bot) has joined
  132. Matrix Traveler (bot) has joined
  133. homebeach has joined
  134. malthe has left
  135. marc0s has left
  136. marc0s has joined
  137. malthe has joined
  138. PapaTutuWawa has left
  139. marc0s has left
  140. marc0s has joined
  141. goffi has joined
  142. lovetox does a element name like <stream:stream> in xml has a special meaning because of the ":" or is this just a element name like any other and ":" has no special meaning
  143. lovetox i tried to find it in the xml spec, but this thing is unreadable for me
  144. flow lovetox, IIRC it has no special meaning if there are no XML namespaces
  145. flow I think https://www.w3.org/TR/xml-names/ is what gives ":" in xml element names a special semantic
  146. flow So as soon as you use namespaces, which is probably true for most practical usages of XML, it has a special meaning
  147. goffi has left
  148. goffi has joined
  149. MattJ Including in XMPP
  150. flow lovetox, but I am curious, as it look like there is some more backstory to this question. if so, would you mind elaborating a bit? :)
  151. sonny has joined
  152. malthe has left
  153. lovetox the backstory is i try to rewrite the nbxmpp streamparser and now i have to understand this :)
  154. flow lovetox, I'd hoped that python has a good xml pull parser library that you could re-use?
  155. flow otherwise I feel like you will hit a few xml trapdoors and probably re-work your implementation 2-3 times :)
  156. flow but you will learn a lot about XML in the process, so not sure if this will be a loss, just be prepared
  157. MattJ 500% use an existing parser
  158. Sam has left
  159. MattJ Please please please
  160. Sam has joined
  161. flow make sure to look at existing APIs. I think Java's StAX is a very good example of an XML stream parser
  162. jonas’ the standard library parser is good enough for that
  163. jonas’ it is based on Expat and does SAX
  164. jonas’ please use that.
  165. MattJ expat is a great choice
  166. Zash just remember to disable all the security holes
  167. jonas’ it can be used non-blockingly. If you need proof, look at aioxmpp.
  168. Zash at least that's easier than reinventing the security holes yourself
  169. lovetox calm down, i use expat
  170. flow jonas’, isn't SAX a push parser? when can those not be used non-blockingly?
  171. lovetox still need to understand xml namespaces
  172. MattJ I think recent expat versions have more sensible defaults, though forbidden XMPP stuff will still need handling
  173. jonas’ lovetox, do you? the parser should do all that for you.
  174. jonas’ (and expat does if you ask nicely)
  175. jonas’ (and by extension, the python standard library xml module does)
  176. flow I think you need to understand XML when parsing XML, and even if not, it can't hurt ;)
  177. jonas’ https://github.com/horazont/aioxmpp/blob/devel/aioxmpp/xml.py#L818-L1111 explicitly waiving the infectiousness of the *GPL for you, lovetox, if you need/use that as inspiration.
  178. lovetox jonas’, if i search for nx prefix in that code, i find a lot of matches
  179. lovetox thanks flow, that document did help to understand prefixes :)
  180. jonas’ nx?
  181. lovetox *ns
  182. lovetox regarding your comment, that its not necessary to understand and python xml libs do it for you
  183. MattJ The summary is that the element called "foo" in one namespace is not the same as the element called "foo" in another namespace. A namespace is identified by a string, usually found in the 'xmlns' attribute. Prefixes are simply a more concise replacement for adding 'xmlns' attributes everywhere (you declare them once and use them as many times as you want)
  184. MattJ This looks like a sane explanation: http://tech.usgin.org/content/xml-namespaces-and-prefixes
  185. MattJ XMPP is heavily based on XML namespaces, so understanding them is not really optional for an XMPP dev. But a good parser (such as expat) will save you from having to handle all the rules (such as inheritance) yourself, and it will tell you what namespace every element is in (regardless of whether it used a prefix or an xmlns attribute)
  186. lovetox yes that would be nice
  187. lovetox i just tested expat
  188. lovetox and it does not handle it
  189. Mx2 has left
  190. lovetox at least the expat api that is accessible via python
  191. Mx2 has joined
  192. marc0s has left
  193. marc0s has joined
  194. lovetox hm altough some examples show it does, maybe i need to investigate this more
  195. lovetox Expat can optionally do XML namespace processing for you, enabled by providing a value for namespace_separator
  196. lovetox oh i did specify that :)
  197. dezant has joined
  198. rom1dep has left
  199. jonas’ lovetox, check that: https://github.com/horazont/aioxmpp/blob/devel/aioxmpp/xml.py#L1106-L1111
  200. lovetox jonas’, i use currently xml.parsers.expat.ParserCreate
  201. lovetox is there any benefit of using the sax module?
  202. jonas’ less boiler plate to write I guess
  203. dezant has left
  204. dezant has joined
  205. jonas’ I strongly suggest to go with the high-level SAX API, it saves you worrying about namespace prefixes and stuff.
  206. malthe has joined
  207. debacle has joined
  208. lovetox ok i look into it
  209. rom1dep has joined
  210. reset has joined
  211. reset n
  212. DebXWoody has joined
  213. nephele has joined
  214. Maranda has left
  215. stpeter has joined
  216. marc0s has left
  217. marc0s has joined
  218. marc0s has left
  219. marc0s has joined
  220. antranigv has left
  221. antranigv has joined
  222. Maranda has joined
  223. marc0s has left
  224. marc0s has joined
  225. raghavgururajan has left
  226. debacle has left
  227. antranigv has left
  228. stpeter has left
  229. malthe has left
  230. inky has joined
  231. Mx2 has left
  232. Mx2 has joined
  233. raghavgururajan has joined
  234. malthe has joined
  235. inky has left
  236. goffi has left
  237. goffi has joined
  238. xecks has joined
  239. malthe has left
  240. selurvedu has left
  241. nephele has left
  242. nephele has joined
  243. goffi has left
  244. goffi has joined
  245. alacer has joined
  246. alacer has left
  247. alacer has joined
  248. goffi has left
  249. goffi has joined
  250. nephele has left
  251. nephele has joined
  252. xecks has left
  253. reset has left
  254. reset has joined
  255. emus has joined
  256. raghavgururajan has left
  257. lovetox and all the prefix stuff is just to save on size? it does not add some new feature to xml? so if a client does not use ns prefixes at all its perfectly fine?
  258. Zash prefix stuff is generally not used in XMPP, apart from for <stream:stream> and Dialback
  259. Zash Does it not add the ability to namespace attributes? I.e how else would you say `<e xmlns:foo="urn:example:ns" foo:bar="blah"/>` ?
  260. Zash (Which is also pretty rare in XMPP)
  261. lovetox yeah it does, forgot about the attribute stuff
  262. lovetox its weird in one example the stream prefix is used
  263. lovetox in others not in the rfc
  264. Zash Hm?
  265. Zash Like `<stream ....` ? Probably just to make the examples more compact
  266. malthe has joined
  267. jgart has joined
  268. lovetox for example here its used
  269. lovetox https://datatracker.ietf.org/doc/html/rfc6120#section-9.1.2
  270. lovetox https://datatracker.ietf.org/doc/html/rfc6120#section-9.2.1
  271. lovetox here than suddenly missing from the features
  272. Zash 🤷️
  273. lovetox i think they want to make a point that it can be used
  274. Zash But doesn't it also say that you should encode the stream as `<stream:stream ...>` ?
  275. Syndace has left
  276. Syndace has joined
  277. Zash https://datatracker.ietf.org/doc/html/rfc6120#section-4.8.5
  278. lovetox oh .. wait
  279. lovetox its not optional
  280. lovetox if we want to define a default namespace of jabber:client in <stream>
  281. lovetox you need a prefix if <stream> should not have jabber:client
  282. marmistrz has joined
  283. antranigv has joined
  284. selurvedu has joined
  285. lovetox is this example not wrong here
  286. lovetox S2: <stream from='example.net' id='hTiXkW+ih9k2SqdGkk/AZi0OJ/Q=' to='im.example.com' version='1.0' xmlns='http://etherx.jabber.org/streams'>
  287. lovetox it does not define a default namespace of jabber:client or server
  288. Zash `<stream xmlns="http://etherx.jabber.org/streams"><message xmlns="jabber:client"/></stream>` == `<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"><message/></stream>`
  289. Zash `<stream xmlns="http://etherx.jabber.org/streams"><message xmlns="jabber:client"/></stream>` == `<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"><message/></stream:stream>`
  290. debacle has joined
  291. lovetox hm yeah
  292. lovetox but without defining it on the stream element, this would indeed be very wasteful
  293. Mx2 has left
  294. Mx2 has joined
  295. Zash So if you could be certain that the other end of the stream understands namespaces and prefixes fully, you could cut down on repeated namespace declaration for common things. Like imagine `<sm:r/>` instead of `<r xmlns="urn:xmpp:sm:3"/>`
  296. malthe has left
  297. reset test
  298. goffi has left
  299. reset hmm
  300. Zash This was a triumph! I'm making a note here: HUGE SUCCESS!
  301. reset has left
  302. Yagizа has left
  303. antranigv has left
  304. PapaTutuWawa has joined
  305. antranigv has joined
  306. pasdesushi has left
  307. pasdesushi has joined
  308. marmistrz has left
  309. xsr has joined
  310. antranigv has left
  311. mac has joined
  312. emus has left
  313. malthe has joined
  314. emus has joined
  315. goffi has joined
  316. Matrix Traveler (bot) has left
  317. homebeach has left
  318. Server Stats Discoverer (traveler bot) has left
  319. Server Stats Discoverer (traveler bot) has joined
  320. Matrix Traveler (bot) has joined
  321. homebeach has joined
  322. malthe has left
  323. emus has left
  324. emus has joined
  325. DebXWoody has left
  326. goffi has left
  327. goffi has joined
  328. emus has left
  329. emus has joined
  330. marc0s has left
  331. marc0s has joined
  332. marc0s has left
  333. marc0s has joined
  334. marc0s has left
  335. marc0s has joined
  336. alacer has left
  337. marmistrz has joined
  338. alacer has joined
  339. marc0s has left
  340. marc0s has joined
  341. alacer has left
  342. marc0s has left
  343. marc0s has joined
  344. bung has joined
  345. marc0s has left
  346. marc0s has joined
  347. xecks has joined
  348. goffi has left
  349. bung has left
  350. stpeter has joined
  351. mac has left
  352. mac has joined
  353. dezant has left
  354. dezant has joined
  355. me9 has joined
  356. Mx2 has left
  357. Mx2 has joined
  358. xecks has left
  359. qrpnxz has left
  360. qrpnxz has joined
  361. xecks has joined
  362. mac has left
  363. marc0s has left
  364. marc0s has joined
  365. huhn has joined
  366. marc0s has left
  367. marc0s has joined
  368. marc0s has left
  369. marc0s has joined
  370. stpeter has left
  371. malthe has joined
  372. Matrix Traveler (bot) has left
  373. homebeach has left
  374. Server Stats Discoverer (traveler bot) has left
  375. Server Stats Discoverer (traveler bot) has joined
  376. Matrix Traveler (bot) has joined
  377. homebeach has joined
  378. bung has joined
  379. pasdesushi has left
  380. pasdesushi has joined
  381. malthe has left
  382. dezant has left
  383. dezant has joined
  384. 9lakes has left
  385. 9lakes has joined
  386. atomicwatch has left
  387. sander has left
  388. marmistrz has left
  389. atomicwatch has joined
  390. malthe has joined
  391. sander has joined
  392. nephele has left
  393. dezant has left
  394. dezant has joined
  395. marc0s has left
  396. marc0s has joined
  397. xecks has left
  398. marc0s has left
  399. marc0s has joined
  400. marc0s has left
  401. marc0s has joined
  402. marc0s has left
  403. marc0s has joined
  404. marc0s has left
  405. marc0s has joined
  406. marc0s has left
  407. marc0s has joined
  408. atomicwatch has left
  409. PapaTutuWawa has left
  410. qrpnxz has left
  411. qrpnxz has joined
  412. me9 has left
  413. malthe has left
  414. qrpnxz has left
  415. qrpnxz has joined
  416. larma has left
  417. qrpnxz has left
  418. qrpnxz has joined
  419. qrpnxz has left
  420. qrpnxz has joined
  421. qrpnxz has left
  422. qrpnxz has joined
  423. qrpnxz has left
  424. qrpnxz has joined
  425. qrpnxz has left
  426. qrpnxz has joined
  427. qrpnxz has left
  428. qrpnxz has joined
  429. qrpnxz has left
  430. qrpnxz has joined
  431. qrpnxz has left
  432. qrpnxz has joined
  433. qrpnxz has left
  434. qrpnxz has joined
  435. antranigv has joined
  436. qrpnxz has left
  437. qrpnxz has joined
  438. debacle has left
  439. mac has joined
  440. pasdesushi has left
  441. Pete has left
  442. Sam has left
  443. jgart has left
  444. marc0s has left
  445. marc0s has joined
  446. Sam has joined
  447. Pete has joined
  448. stpeter has joined
  449. marmistrz has joined
  450. bung has left
  451. bung has joined
  452. emus has left