httpstream: fix off-by-one error which might result in a segfault.