SWI-Prolog / packages-http

The SWI-Prolog HTTP server and client libraries
23 stars 23 forks source link

http_reply(stream) and http_reply(cgi_stream) transfer more data than specified #10

Open triska opened 9 years ago

triska commented 9 years ago

In the final 2 clauses of http_reply_data/4, the goals of the form:

copy_stream(Out, In, Header, 0, end).

should read:

copy_stream(Out, In, Header, 0, Len).

so that only the intended content is actually transmitted.

JanWielemaker commented 9 years ago

It is unclear to me. The last relevant was be200e2914fb115c587880f3f1e95af1220fc74d, which introduced byte-ranges for files. Before that, the last clauses accepted a length, but did send the complete stream data. A quick search doesn't really tell me what this is used for and I've forgotten.

Surely, using Len is in general wrong as well, as the input (or output) stream might not be binary. I don't really know what to do with this right now.