The major difference between previous version and current that in the previous version we always closed connection, even in 1.1, PHP streaming was not using chunked encoding explicitly and the server never auto-assigned it. In current version the server decided and because we always keep-alive and in chunked, Firefox after 3 request hangs because reply is not correct. This is strange because in telnet session it looks fine but my eye may not be protocol-demanding like Firefox.
Vlad Seryakov wrote: >> Does this actually need to flush? >> >> It depends when php calls it. In the case where there's no body, eg. a >> 302 redirect, then maybe this signals 'all done' and you're to write >> the headers. In the case where there is a body it's not needed because >> naviserver will construct and dump the headers when you try to write >> the first data, and it will send both with a single syscall (and >> packet, if it fits), which is more efficient. >> >> So you should try not to flush. You might try to do nothing in this >> call, and detect when you've finished sending in the case of a >> zero-length body some other way. When php returns control to your >> Ns_Op function you could check to see if any bytes were sent and if >> not, flush the headers. > > I tried it, with code before senfile implementation where we had flush > function it worked perfectly, so PHP is calling this only when it needs > to actually send headers. Not sure i can find out about body coming, > even in 302 case there can be body but may be not. Will try again > >> But anyway, you're checking for ctx->conn != NULL before setting the >> response code, then using it unconditionally when you write the data. >> >> Ns_ConnWriteData can fail but you're ignoring the return code and >> returning success > > It is mostly possible that the problem is in nsphp :-(( > >> >> Does php try to set a length header? You may need to check for it in >> here and call Ns_ConnSetLengthHeader. >> > > This i checked, no length > > >> Whether the write succeeds or fails, you're returning the original >> buffer length, which I guess signals success to php. It might be hard >> to figure out exactly how much did get sent, because >> conn->nContentSent includes the headers bytes. But maybe php doesn't >> care? You'll have to check if you can return -1 or 0 or something. > > when abort is called, i do not return str_length, it might be logjmp > inside php > > >> You might also want to check if php exposes it's buffering. If you can >> figure out that your ub_write call is being called with all the data >> that's going to be sent (the script has finished executing) or the >> last piece of data, you shouldn't pass the flag NS_CONN_STREAM. >> Otherwise, you should. > > No buffering, PHP calls it with all pieces separately > >> >>> I tried that but could not get it to work, it generates configure but >>> when i run it i never could make it finish, there are always some errors. >> >> >> Do you need to buy into the full build process? Maybe you can just >> pull in the header and link against the library..? > > The problem with PHP that it can support only one SAPI implementation > and nsphp is not just extesion but SAPI handler, so just compiling it as > extension will not work > > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > naviserver-devel mailing list > naviserver-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel