rem: if (itPtr->nsconn.flags & CONN_TCLHDRS) {
add: if (itPtr->nsconn.flags & CONN_TCLOUTHDRS) {
context: NsTclConnCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv){    NsInterp   *itPtr = arg;    Ns_Conn    *conn = itPtr->conn;    Conn       *connPtr = (Conn *) conn;    Ns_Set     *form;    Ns_Request *request;    Tcl_Encoding encoding;    char	buf[50];    int		idx;    if (argc < 2) {        Tcl_AppendResult(interp, "wrong # of args: should be \"",                         argv[0], " cmd ", NULL);        return TCL_ERROR;    }    /*     * Only the "isconnected" command operates without a conn.     */    if (STREQ(argv[1], "isconnected")) {	Tcl_SetResult(interp, (connPtr == NULL) ? "0" : "1", TCL_STATIC);	return TCL_OK;    } else if (connPtr == NULL) {        Tcl_AppendResult(interp, "no current connection", NULL);        return TCL_ERROR;    }    request = connPtr->request;    if (STREQ(argv[1], "urlv")) {	if (argc == 2 || (argc == 3 && NsIsIdConn(argv[2]))) {	    for (idx = 0; idx < request->urlc; idx++) {	        Tcl_AppendElement(interp, request->urlv[idx]);	    }	} else if (Tcl_GetInt(interp, argv[2], &idx) != TCL_OK) {	    return TCL_ERROR;	} else if (idx >= 0 && idx < request->urlc) {	    Tcl_SetResult(interp, request->urlv[idx], TCL_VOLATILE);	}    } else if (STREQ(argv[1], "authuser")) {        Tcl_SetResult(interp, connPtr->authUser, TCL_STATIC);    } else if (STREQ(argv[1], "authpassword")) {        Tcl_SetResult(interp, connPtr->authPasswd, TCL_STATIC);    } else if (STREQ(argv[1], "content")) {	Tcl_SetResult(interp, Ns_ConnContent(conn), TCL_VOLATILE);    } else if (STREQ(argv[1], "contentlength")) {        sprintf(buf, "%u", (unsigned) conn->contentLength);	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "encoding")) {	if (argc > 2) {	    encoding = Ns_GetEncoding(argv[2]);	    if (encoding == NULL) {		Tcl_AppendResult(interp, "no such encoding: ",		    argv[2], NULL);		return TCL_ERROR;	    }	    connPtr->encoding = encoding;	}	if (connPtr->encoding != NULL) {	    Tcl_SetResult(interp, Tcl_GetEncodingName(connPtr->encoding), TCL_VOLATILE);	}    } else if (STREQ(argv[1], "peeraddr")) {        Tcl_SetResult(interp, Ns_ConnPeer(conn), TCL_STATIC);    } else if (STREQ(argv[1], "peerport")) {	sprintf(buf, "%d", Ns_ConnPeerPort(conn));	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "headers")) {	if (itPtr->nsconn.flags & CONN_TCLHDRS) {            Tcl_SetResult(interp, itPtr->nsconn.hdrs, TCL_STATIC);	} else {            Ns_TclEnterSet(interp, connPtr->headers, NS_TCL_SET_STATIC);	    strcpy(itPtr->nsconn.hdrs, interp->result);	    itPtr->nsconn.flags |= CONN_TCLHDRS;	}    } else if (STREQ(argv[1], "outputheaders")) {	if (itPtr->nsconn.flags & CONN_TCLHDRS) {            Tcl_SetResult(interp, itPtr->nsconn.outhdrs, TCL_STATIC);	} else {            Ns_TclEnterSet(interp, connPtr->outputheaders, NS_TCL_SET_STATIC);	    strcpy(itPtr->nsconn.outhdrs, interp->result);	    itPtr->nsconn.flags |= CONN_TCLOUTHDRS;	}    } else if (STREQ(argv[1], "form")) {	if (itPtr->nsconn.flags & CONN_TCLFORM) {            Tcl_SetResult(interp, itPtr->nsconn.form, TCL_STATIC);	} else {            form = Ns_ConnGetQuery(conn);            if (form == NULL) {        	itPtr->nsconn.form[0] = '\0';	    } else {                Ns_TclEnterSet(interp, form, NS_TCL_SET_STATIC);        	strcpy(itPtr->nsconn.form, interp->result);	    }	    itPtr->nsconn.flags |= CONN_TCLFORM;	}    } else if (STREQ(argv[1], "files")) {	Tcl_SetResult(interp, connPtr->files.string, TCL_VOLATILE);    } else if (STREQ(argv[1], "copy")) {	Tcl_Channel chan;	int off, len;	if (argc != 5) {	    Tcl_AppendResult(interp, "wrong # of args: should be: \"",		argv[0], " copy off len chan\"", NULL);	    return TCL_ERROR;	}	if (Tcl_GetInt(interp, argv[2], &off) != TCL_OK ||	    Tcl_GetInt(interp, argv[3], &len) != TCL_OK ||	    GetChan(interp, argv[4], &chan) != TCL_OK) {	    return TCL_ERROR;	}	if (off < 0 || off > connPtr->reqPtr->length) {	    Tcl_AppendResult(interp, "invalid offset: ", argv[2], NULL);	    return TCL_ERROR;	}	if (len < 0 || len > (connPtr->reqPtr->length - off)) {	    Tcl_AppendResult(interp, "invalid length: ", argv[3], NULL);	    return TCL_ERROR;	}	if (Tcl_WriteChars(chan, connPtr->reqPtr->content + off, len) != len) {	    Tcl_AppendResult(interp, "could not write ", argv[3], " bytes to ",		argv[4], ": ", Tcl_PosixError(interp), NULL);	    return TCL_ERROR;	}    } else if (STREQ(argv[1], "request")) {        Tcl_SetResult(interp, request->line, TCL_STATIC);    } else if (STREQ(argv[1], "method")) {        Tcl_SetResult(interp, request->method, TCL_STATIC);    } else if (STREQ(argv[1], "protocol")) {        Tcl_SetResult(interp, request->protocol, TCL_STATIC);    } else if (STREQ(argv[1], "host")) {        Tcl_SetResult(interp, request->host, TCL_STATIC);    } else if (STREQ(argv[1], "port")) {        sprintf(buf, "%d", request->port);	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "url")) {        Tcl_SetResult(interp, request->url, TCL_STATIC);    } else if (STREQ(argv[1], "query")) {        Tcl_SetResult(interp, request->query, TCL_STATIC);    } else if (STREQ(argv[1], "urlc")) {        sprintf(buf, "%d", request->urlc);	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "version")) {        sprintf(buf, "%1.1f", request->version);	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "location")) {        Tcl_SetResult(interp, Ns_ConnLocation(conn), TCL_STATIC);    } else if (STREQ(argv[1], "driver")) {	Tcl_AppendResult(interp, Ns_ConnDriverName(conn), NULL);    } else if (STREQ(argv[1], "server")) {        Tcl_SetResult(interp, Ns_ConnServer(conn), TCL_STATIC);    } else if (STREQ(argv[1], "status")) {        sprintf(buf, "%d", Ns_ConnResponseStatus(conn));	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "sock")) {	sprintf(buf, "%d", Ns_ConnSock(conn));	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "id")) {	sprintf(buf, "%d", Ns_ConnId(conn));	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "flags")) {	sprintf(buf, "%d", connPtr->flags);	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "start")) {	sprintf(buf, "%d", (int) connPtr->startTime);	Tcl_SetResult(interp, buf, TCL_VOLATILE);    } else if (STREQ(argv[1], "close")) {        if (Ns_ConnClose(conn) != NS_OK) {            Tcl_SetResult(interp, "could not close connection", TCL_STATIC);            return TCL_ERROR;        }    } else {        Tcl_AppendResult(interp, "unknown command \"", argv[1],			 "\":  should be "                         "authpassword, "                         "authuser, "                         "close, "                         "content, "                         "contentlength, "                         "driver, "                         "encoding, "                         "flags, "                         "files, "                         "form, "                         "headers, "                         "host, "                         "isconnected, "                         "location, "                         "method, "                         "outputheaders, "                         "peeraddr, "			 "peerport, "                         "port, "                         "protocol, "                         "url, "                         "query, "                         "server, "			 "sock, "                         "start, "                         "status, "                         "urlc, "                         "urlv, "                         "or version", NULL);        return TCL_ERROR;    }    return TCL_OK;}