[naviserver-devel] Ns_ConnFlushHeaders() deprecated: why?

2010-05-04 Thread Vasiljevic Zoran
Hi all!

Tcl_WideInt
Ns_ConnFlushHeaders(Ns_Conn *conn, int status)
{
 Conn *connPtr = (Conn *) conn;

 Ns_ConnSetResponseStatus(conn, status);
 Ns_ConnWriteData(conn, NULL, 0, 0);

 return connPtr->nContentSent;
}

This function is set as deprecated. It returns number of bytes sent.
I cannot see that connPtr->nContentSent is exposed from outside
so how am I to obtain the original Ns_ConnFlushHeaders functionality
w/o accessing internal connection state?

Cheers
Zoran


--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


[naviserver-devel] Ns_ConnWriteData needs Ns_ConnFlushData ?

2010-05-04 Thread Vasiljevic Zoran
Hi!

Quite often I see:

Ns_ConnWriteData(conn, NULL, 0, 0);

This is OK but not very readable. Can we add something like

Ns_ConnFlushData(conn, flags)

convenience wrapper that would supply the NULL buffer and
zero bytes to the Ns_ConnWriteData() ?

This would add zero functionality but would make the
programmers intention more clear.

Cheers,
Zoran


--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Ns_ConnFlushHeaders() deprecated: why?

2010-05-04 Thread Stephen Deasey
On Tue, May 4, 2010 at 4:50 PM, Vasiljevic Zoran  wrote:
> Hi all!
>
> Tcl_WideInt
> Ns_ConnFlushHeaders(Ns_Conn *conn, int status)
> {
>     Conn *connPtr = (Conn *) conn;
>
>     Ns_ConnSetResponseStatus(conn, status);
>     Ns_ConnWriteData(conn, NULL, 0, 0);
>
>     return connPtr->nContentSent;
> }
>
> This function is set as deprecated. It returns number of bytes sent.
> I cannot see that connPtr->nContentSent is exposed from outside
> so how am I to obtain the original Ns_ConnFlushHeaders functionality
> w/o accessing internal connection state?


Flushing headers is discouraged because it isn't needed for HTTP, it's
slow, and often extra headers need to be added depending on which
Write* calls you use.

I guess you could give access to nContentSent in a new public API.
What are you using it for? How are you writing the data?

--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


Re: [naviserver-devel] Ns_ConnWriteData needs Ns_ConnFlushData ?

2010-05-04 Thread Stephen Deasey
On Tue, May 4, 2010 at 4:58 PM, Vasiljevic Zoran  wrote:
> Hi!
>
> Quite often I see:
>
>    Ns_ConnWriteData(conn, NULL, 0, 0);
>
> This is OK but not very readable. Can we add something like
>
>    Ns_ConnFlushData(conn, flags)
>
> convenience wrapper that would supply the NULL buffer and
> zero bytes to the Ns_ConnWriteData() ?
>
> This would add zero functionality but would make the
> programmers intention more clear.


Hmm... well it's not *too* often that you see it. Some of the places
where it's currently done is probably a mistake, and sometimes it's
because the api doesn't quite let you do what you need.

For example, return.c:ReturnRange() flushes the headers by calling
Ns_ConnWriteData with a null buffer before calling
Ns_ConnSendFileVec() because the latter is low level enough, for
flexibility, that it completely ignores headers, for alternate
protocols etc. But the vector sending code can actually handle memory
buffers as well as files, so ideally you'd want to dump the headers to
a string buffer then pass them on to SendVec. Or something...

What is being buffered that you're trying to flush?

--
___
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel