From: Stephen D. <sd...@us...> - 2005-06-13 01:58:28
|
Update of /cvsroot/naviserver/naviserver/nscgi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28355/nscgi Modified Files: nscgi.c Log Message: Use non-depreciated functions. Index: nscgi.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nscgi/nscgi.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nscgi.c 10 Jun 2005 17:58:37 -0000 1.2 --- nscgi.c 13 Jun 2005 01:58:16 -0000 1.3 *************** *** 774,778 **** Ns_DString tmp; ! if (Ns_DecodeUrl(dsPtr, cgiPtr->pathinfo) != NULL) { SetUpdate(cgiPtr->env, "PATH_INFO", dsPtr->string); } else { --- 774,778 ---- Ns_DString tmp; ! if (Ns_UrlPathDecode(dsPtr, cgiPtr->pathinfo, NULL) != NULL) { SetUpdate(cgiPtr->env, "PATH_INFO", dsPtr->string); } else { *************** *** 782,786 **** Ns_DStringInit(&tmp); Ns_UrlToFile(dsPtr, modPtr->server, cgiPtr->pathinfo); ! if (Ns_DecodeUrl(&tmp, dsPtr->string) != NULL) { SetUpdate(cgiPtr->env, "PATH_TRANSLATED", tmp.string); } else { --- 782,786 ---- Ns_DStringInit(&tmp); Ns_UrlToFile(dsPtr, modPtr->server, cgiPtr->pathinfo); ! if (Ns_UrlPathDecode(&tmp, dsPtr->string, NULL) != NULL) { SetUpdate(cgiPtr->env, "PATH_TRANSLATED", tmp.string); } else { *************** *** 801,854 **** /* ! * Determine SERVER_NAME from the conn location. */ ! s = Ns_ConnLocation(conn); ! p = NULL; ! if (s != NULL) { ! if (strstr(s, "://") == NULL) { ! Ns_Log(Warning, "nscgi: location does not contain '://'"); ! s = NULL; ! } else { ! s = strchr(s, ':'); /* Get past the http */ ! if (s != NULL) { ! s += 3; /* Get past the // */ ! p = strchr(s, ':'); /* Get to the port number */ ! } } } ! if (s == NULL) { ! s = Ns_ConnHost(conn); ! SetUpdate(cgiPtr->env, "SERVER_NAME", s); ! } else { ! if (p == NULL) { ! Ns_DStringAppend(dsPtr, s); /* No port number */ ! } else { ! Ns_DStringNAppend(dsPtr, s, (p - s)); /* Port number exists */ ! } ! s = Ns_DStringExport(dsPtr); ! SetUpdate(cgiPtr->env, "SERVER_NAME", s); ! ns_free(s); } - /* - * Determine SERVER_PORT from the conn location. - */ - - s = Ns_ConnLocation(conn); - if (s != NULL) { - s = strchr(s, ':'); /* Skip past http. */ - if (s != NULL) { - ++s; - s = strchr(s, ':'); /* Skip past hostname. */ - if (s != NULL) { - ++s; - } - } - } - if (s == NULL) { - s = "80"; - } - SetUpdate(cgiPtr->env, "SERVER_PORT", s); SetUpdate(cgiPtr->env, "AUTH_TYPE", "Basic"); SetUpdate(cgiPtr->env, "REMOTE_USER", conn->authUser); --- 801,826 ---- /* ! * Determine SERVER_NAME and SERVER_PORT from the conn location. */ ! s = Ns_ConnLocationAppend(conn, dsPtr); ! s = strchr(s, ':'); ! s += 3; /* Get past the protocol:// */ ! p = strchr(s, ':'); /* Get to the port number */ ! if (p != NULL) { ! SetUpdate(cgiPtr->env, "SERVER_PORT", p); ! for (i = 0; p != '\0'; ++p) { ! ++i; } + Ns_DStringTrunc(dsPtr, i); } ! SetUpdate(cgiPtr->env, "SERVER_NAME", dsPtr->string); ! Ns_DStringTrunc(dsPtr, 0); ! if (p == NULL) { ! Ns_DStringPrintf(dsPtr, "%d", Ns_ConnPort(conn)); ! SetUpdate(cgiPtr->env, "SERVER_PORT", dsPtr->string); ! Ns_DStringTrunc(dsPtr, 0); } SetUpdate(cgiPtr->env, "AUTH_TYPE", "Basic"); SetUpdate(cgiPtr->env, "REMOTE_USER", conn->authUser); *************** *** 932,936 **** *e = '\0'; } ! Ns_UrlDecode(dsPtr, s); Ns_DStringNAppend(dsPtr, "", 1); if (e != NULL) { --- 904,908 ---- *e = '\0'; } ! Ns_UrlQueryDecode(dsPtr, s, NULL); Ns_DStringNAppend(dsPtr, "", 1); if (e != NULL) { *************** *** 1107,1111 **** if (*value == '/') { Ns_DStringInit(&redir); ! Ns_DStringVarAppend(&redir, Ns_ConnLocation(conn), value, NULL); last = Ns_SetPut(hdrs, ds.string, redir.string); Ns_DStringFree(&redir); --- 1079,1084 ---- if (*value == '/') { Ns_DStringInit(&redir); ! Ns_ConnLocationAppend(conn, &redir); ! Ns_DStringAppend(&redir, value); last = Ns_SetPut(hdrs, ds.string, redir.string); Ns_DStringFree(&redir); |