Update of /cvsroot/naviserver/naviserver/nsd
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27805/nsd
Modified Files:
conn.c
Log Message:
Prevent truncation of content already in dstring when location is
appended. Use nstest_http in tests.
Index: conn.c
===================================================================
RCS file: /cvsroot/naviserver/naviserver/nsd/conn.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** conn.c 17 Apr 2005 08:10:05 -0000 1.10
--- conn.c 18 Apr 2005 12:57:15 -0000 1.11
***************
*** 481,488 ****
Ns_ConnLocationAppend(Ns_Conn *conn, Ns_DString *dest)
{
! Conn *connPtr = (Conn *) conn;
! NsServer *servPtr = connPtr->servPtr;
! Ns_Set *headers;
! char *location, *host, *p;
if (servPtr->vhost.connLocationProc != NULL) {
--- 481,489 ----
Ns_ConnLocationAppend(Ns_Conn *conn, Ns_DString *dest)
{
! Conn *connPtr = (Conn *) conn;
! NsServer *servPtr = connPtr->servPtr;
! Ns_Set *headers;
! Ns_DString ds;
! char *location, *host, *p;
if (servPtr->vhost.connLocationProc != NULL) {
***************
*** 531,542 ****
}
! Ns_DStringAppend(dest, connPtr->location);
! location = strstr(dest->string, "://");
if (location != NULL) {
! Ns_DStringTrunc(dest, (location - dest->string) + 3);
} else {
/* server missconfiguration, should begin: SCHEME:// */
Ns_DStringAppend(dest, "http://");
}
location = Ns_DStringAppend(dest, host);
--- 532,550 ----
}
! /*
! * Get the scheme from the driver location, default to http://.
! */
!
! Ns_DStringInit(&ds);
! Ns_DStringAppend(&ds, connPtr->location);
! location = strstr(ds.string, "://");
if (location != NULL) {
! Ns_DStringTrunc(&ds, (location - ds.string) + 3);
! Ns_DStringNAppend(dest, ds.string, ds.length);
} else {
/* server missconfiguration, should begin: SCHEME:// */
Ns_DStringAppend(dest, "http://");
}
+ Ns_DStringFree(&ds);
location = Ns_DStringAppend(dest, host);
***************
*** 837,863 ****
*----------------------------------------------------------------------
*
- * NsIsIdConn --
- *
- * Given an conn ID, could this be a conn ID?
- *
- * Results:
- * Boolean
- *
- * Side effects:
- * None
- *
- *----------------------------------------------------------------------
- */
-
- int
- NsIsIdConn(char *connId)
- {
- return (connId && *connId == 'c') ? NS_TRUE : NS_FALSE;
- }
-
-
- /*
- *----------------------------------------------------------------------
- *
* Ns_ConnGetWriteEncodedFlag --
*
--- 845,848 ----
***************
*** 994,998 ****
case CUrlvIdx:
! if (objc == 2 || (objc == 3 && NsIsIdConn(Tcl_GetString(objv[2])))) {
for (idx = 0; idx < request->urlc; idx++) {
Tcl_AppendElement(interp, request->urlv[idx]);
--- 979,983 ----
case CUrlvIdx:
! if (objc == 2) {
for (idx = 0; idx < request->urlc; idx++) {
Tcl_AppendElement(interp, request->urlv[idx]);
|