Live data from Hacker News

The curious case of the missing period

tjaart.substack.com

31–40 of 201 posts

Re: The curious case of the missing period

#31
post #17

I see two huge bad habits here. The first is the obvious one, as pointed out by many commenters here: Don’t implement standards haphazardly, if you even should do so yourself. Either give the implementations the necessary care and attention, or use a pre-made library. But the other thing is: Don’t vendor your dependencies. Those libraries you use need to be updated regularly and timely, and absolutely not “only as ne…

> Don’t vendor your dependencies. The alternative seems worse: your own application's stability is now at risk against upstream changes that could break your code. Sure, you might not get a fix immediately, but I'd rather know I'm making a change because I need a fix than introducing instability and additional risk that I don't want to subject myself to. "If it ain't broke, don't fix it."

I like Go's approach, which ensures that all upgrades happen when you choose to do some upgrades.

(For apps, a lock file will do it too.)

Re: The curious case of the missing period

#32
But the line "We are happy to welcome you to our family." is not anywhere near the line limit. There is something else going on here, like perhaps the whole thing actually being an HTML MIME attachment, perhaps? IN which it is like

  ... lots of text ... 
We are happy to welcome you to our family.
or whatever. But if you blindly split HTML into lines, it will break tags.

Re: The curious case of the missing period

#34
Why would a cron job that sends e-mails need to implement its own SMTP client???

You just use the mail program from mailutils or whatever.

Just from a point of view of deliverability, developing bare bones SMTP interaction over a socket is a nonstarter. You can't just connect to random mail exchange hosts directly and send mail these days. A solution has to be capable of connecting to a specific SMTP forwarding host (e.g. provided by your ISP). For that, you need to implement connections over TLS, with authentication and all.

Also, a slightly ironic thing is that cron already knows how to send mail. The output of a cron job is mailed to the owner. Some crons let that mail address be overriden with a MAILTO variable in the crontab or some such thing.

Re: The curious case of the missing period

#35
post #5

> A portion of this code implemented a SMTP client. If I wanted to root cause this, the real problem is right there. Implementing protocols correctly is hard and bugs like in the post are common. A properly implemented SMTP client library, like one you would pull off the shelf, would accept text and encode it properly per the SMTP protocol, regardless of where the periods were in the input. The templating layer shoul…

> Implementing protocols correctly is hard That's why it's a best practice to specify protocols at a very high level (e.g. using cap'n'proto) instead of expecting every random sleep-deprived SDE2 to correctly implement a network exchange in terms of read() and write().

[deleted]

Re: The curious case of the missing period

#36
post #28

Earlier quoted context omitted.

Everything that is normally annoying with IPv6 literals, plus the fact that it's encapsulated as [IPV6: ] and the address could take a dumb form such as ::1.2.3.4. But I mentioned it because it might initially seem to a neophyte in this field that the thing to the right of the rightmost @ sign is a name you can pass to your resolver. It might not be.

The IPv6 notation claims : for separating digits. But that's already an established notation for port numbers: 10.1.2.3:456. Oops! The square brackets allow us to stick a port number on it: [ffff::0123:4567]:6301

Yes, but the RFCs permit 6v4 addresses such as ff:ee::aa:1.2.3.4

Re: The curious case of the missing period

#38
post #28

Earlier quoted context omitted.

Whats the issue with ipv6 literals?

Everything that is normally annoying with IPv6 literals, plus the fact that it's encapsulated as [IPV6: ] and the address could take a dumb form such as ::1.2.3.4. But I mentioned it because it might initially seem to a neophyte in this field that the thing to the right of the rightmost @ sign is a name you can pass to your resolver. It might not be.

Note that IPv4 address literals are encoded in square brackets (e.g., user@[127.0.0.1]), so it's really all IP address literals that could be a problem rather than specifically IPv6 literals.

Re: The curious case of the missing period

#39

Earlier quoted context omitted.

Hmmmm, html doesn't ignore line breaks, it just treats them as any other whitespace, where a consecutive sequence is folded into a single space. 27 00 would still be quite confusing, of course

I think the space character in the comment above is representing a new line on the wire.

Yep, I didn't add enough newlines. Fixed

Re: The curious case of the missing period

#40
post #15

Earlier quoted context omitted.

How so? Quoted printable doesn't require the dot to be encoded. Maybe you're thinking of base64 encoding?

Doesn't require , but comfortably allows you to do.

Agreed.

But this is SMTP, I have no doubt there are gateways out there that will reencode the mail and put the dot back in the wrong place, eg in the name of wrapping all URLs behind a phishing-warning-page

Post reply on HN