The microblog: 2020.04.08 22:14:59

2020.04.08 22:14:59 (1247981284481052672) from Daniel J. Bernstein, replying to "Samuel Clay (@samuelclay)" (1247627735129821192):

Thanks for the report. A syscall trace of wget -N (which works fine) vs. this Python script (which doesn't) shows pretty much the same HTTP request and reply, but after Python sees 'recvfrom(3, "", 8192, 0, NULL, NULL) = 0' (server EOF) it sits there for a minute and then chokes.

2020.04.08 22:35:08 (1247986357420449794) from Daniel J. Bernstein:

I've dug a bit into Python's urllib3/ now, and I don't see where it has the "304 response cannot contain a message-body" logic required by RFC 7232 (and by previous 304 specs). It interprets 304 as saying 0 body bytes remain to transfer, but that's not the same thing!

2020.04.08 22:42:33 (1247988224930099206) from Daniel J. Bernstein:

With HTTP's chunked encoding, a zero-length body is encoded as a nonzero-length string (so the receiver can see it's complete). For a 304 response, there's no body in the first place, and no encoded body. Unless I'm missing something, Python's urllib3 is violating the HTTP spec.


2020.04.07 22:50:06 (1247627735129821192) from "Samuel Clay (@samuelclay)":

Hey, weird thing happening when fetching your blog and including the If-Modified-Since header. Here's a python example of what's breaking