From: Zoran V. <vas...@us...> - 2005-04-16 14:05:45
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27421 Modified Files: conn.c Log Message: Added "ns_conn flush" as per RFE #1184271 and improved "ns_conn status" argument checking. Index: conn.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/conn.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** conn.c 12 Apr 2005 06:21:23 -0000 1.7 --- conn.c 16 Apr 2005 14:05:25 -0000 1.8 *************** *** 1,7 **** /* ! * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://www.mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" *************** *** 235,238 **** --- 235,239 ---- } + /* *---------------------------------------------------------------------- *************** *** 293,297 **** * * Results: ! * integer, number of bytes to send * * Side effects: --- 294,298 ---- * * Results: ! * Integer, number of bytes to send * * Side effects: *************** *** 946,967 **** static CONST char *opts[] = { "authpassword", "authuser", "close", "content", "contentlength", ! "copy", "driver", "encoding", "files", "fileoffset", ! "filelength", "fileheaders", "flags", "form", "headers", "host", "id", "isconnected", "location", "method", "outputheaders", "peeraddr", "peerport", "port", "protocol", "query", "request", "server", "sock", "start", "status", ! "url", "urlc", "urlencoding", "urlv", "version", "write_encoded", ! "channel", NULL }; enum ISubCmdIdx { CAuthPasswordIdx, CAuthUserIdx, CCloseIdx, CContentIdx, ! CContentLengthIdx, CCopyIdx, CDriverIdx, CEncodingIdx, CFilesIdx, CFileOffIdx, CFileLenIdx, CFileHdrIdx, CFlagsIdx, ! CFormIdx, CHeadersIdx, CHostIdx, CIdIdx, CIsConnectedIdx, CLocationIdx, CMethodIdx, COutputHeadersIdx, CPeerAddrIdx, CPeerPortIdx, CPortIdx, CProtocolIdx, CQueryIdx, CRequestIdx, CServerIdx, CSockIdx, CStartIdx, CStatusIdx, CUrlIdx, ! CUrlcIdx, CUrlEncodingIdx, CUrlvIdx, CVersionIdx, CWriteEncodedIdx, ! CChannelIdx } opt; --- 947,966 ---- static CONST char *opts[] = { "authpassword", "authuser", "close", "content", "contentlength", ! "copy", "channel", "driver", "encoding", "files", "fileoffset", ! "filelength", "fileheaders", "flags", "form", "flush", "headers", "host", "id", "isconnected", "location", "method", "outputheaders", "peeraddr", "peerport", "port", "protocol", "query", "request", "server", "sock", "start", "status", ! "url", "urlc", "urlencoding", "urlv", "version", "write_encoded", NULL }; enum ISubCmdIdx { CAuthPasswordIdx, CAuthUserIdx, CCloseIdx, CContentIdx, ! CContentLengthIdx, CCopyIdx, CChannelIdx, CDriverIdx, CEncodingIdx, CFilesIdx, CFileOffIdx, CFileLenIdx, CFileHdrIdx, CFlagsIdx, ! CFormIdx, CFlushIdx, CHeadersIdx, CHostIdx, CIdIdx, CIsConnectedIdx, CLocationIdx, CMethodIdx, COutputHeadersIdx, CPeerAddrIdx, CPeerPortIdx, CPortIdx, CProtocolIdx, CQueryIdx, CRequestIdx, CServerIdx, CSockIdx, CStartIdx, CStatusIdx, CUrlIdx, ! CUrlcIdx, CUrlEncodingIdx, CUrlvIdx, CVersionIdx, CWriteEncodedIdx } opt; *************** *** 1157,1160 **** --- 1156,1166 ---- break; + case CFlushIdx: { + Tcl_SetIntObj(result, + Ns_ConnFlushHeaders(conn, + Ns_ConnResponseStatus(conn))); + break; + } + case CCopyIdx: if (objc != 5) { *************** *** 1167,1173 **** } if (Tcl_Write(chan, connPtr->reqPtr->content + off, len) != len) { ! Tcl_AppendResult(interp, "could not write ", Tcl_GetString(objv[3]), " bytes to ", ! Tcl_GetString(objv[4]), ": ", Tcl_PosixError(interp), NULL); ! return TCL_ERROR; } break; --- 1173,1181 ---- } if (Tcl_Write(chan, connPtr->reqPtr->content + off, len) != len) { ! Tcl_AppendResult(interp, "could not write ", ! Tcl_GetString(objv[3]), " bytes to ", ! Tcl_GetString(objv[4]), ": ", ! Tcl_PosixError(interp), NULL); ! return TCL_ERROR; } break; *************** *** 1240,1254 **** break; ! case CStatusIdx: ! if (objc > 2) { ! int new_status; ! if (Tcl_GetIntFromObj(interp, objv[2], &new_status) != TCL_OK) { ! Tcl_AppendResult(interp, "Invalid response status code", NULL ); ! return TCL_ERROR; ! } ! Ns_ConnSetResponseStatus(conn, new_status); } ! Tcl_SetIntObj(result, Ns_ConnResponseStatus(conn)); ! break; case CSockIdx: --- 1248,1264 ---- break; ! case CStatusIdx: ! if (objc < 2 || objc > 3) { ! Tcl_WrongNumArgs(interp, 2, objv, "?status?"); ! return TCL_ERROR; ! } else if (objc == 3) { ! int status; ! if (Tcl_GetIntFromObj(interp, objv[2], &status) != TCL_OK) { ! return TCL_ERROR; } ! Ns_ConnSetResponseStatus(conn, status); ! } ! Tcl_SetIntObj(result, Ns_ConnResponseStatus(conn)); ! break; case CSockIdx: |