On 9/29/07, Vasiljevic Zoran <[EMAIL PROTECTED]> wrote: > > On 29.09.2007, at 15:32, Stephen Deasey wrote: > > > > As far as I can tell, we already support streaming binary data, both > > to HTTP 1.0 and 1.1 clients (and also to non-HTTP custom clients). > > > > Can you show some example code? What did you expect would happen, what > > actually happened? > > OK. Very simple. I must generate/send headers with > ns_headers but without Content-Length element. > Later, I get [bs_conn channel] and use it to pump > the data to remote from custom C-code writing to the > connection channel. The length of data is not known > in advance, hence I cannot have Content-Length set > in output headers. At the moment there is no way to > do that. It was before. Some later chnage(s) disabled > it. So I changed ns_headers to allow -1 for optional > length argument in which case Content-Length is removed > from output headers before flushing them.
This was really a problem with the underlying Ns_ConnWrite* code distinguishing between no length and zero length, and mainly because the last place in the server that flushes headers is the 'ns_conn channel' command, which must do the flush because subsequent writes won't go through the Ns_ConnWrite* stack where usually the headers are sent along with the first data write. Actually it's quite complicated (which is a bad sign...) with many corner cases. Now however it's perfect :-) > Then I saw the ChangeLog entry about "-binary" flag to > ns_headers but I could not find it in the code. > Hence the question.... (still not answered) I think what happened here is after I added the -binary switch, basically for mime-type header handling, it occurred to me that it only makes sense to supply an explicit length when you were sending binary data. If you specify a length for character data you've already got it wrong -- you can't tell what the final length will be after encoding, compression etc. So, I guessed binaryness from the presence of the length arg. Unfortunately that doesn't allow binary streaming, for example via ns_conn channel (which seems more likely than ns_write). So, ns_headers -binary is back. > > ns_startcontent > > Why don't we declare it deprecated? It just confuses people > (at least it confused me). > I'm pretty sure it's unneeded, but I've really only touched the encoding stuff as needed for the IO changes, and some minor cleanups. There's some more to do and encoding is a real headache... Still, it's missing from the man pages and I added a note in the source. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel