From: gustafn <gne...@us...> - 2011-07-05 18:37:49
|
Update of /cvsroot/aolserver/aolserver/nsd In directory vz-cvs-4.sog:/tmp/cvs-serv24128 Modified Files: queue.c server.c tclcache.c tclmisc.c uuencode.c Log Message: - reverting escaped commit Index: tclmisc.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/tclmisc.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tclmisc.c 5 Jul 2011 18:24:40 -0000 1.33 --- tclmisc.c 5 Jul 2011 18:37:47 -0000 1.34 *************** *** 366,374 **** return TCL_ERROR; } ! string = Tcl_GetString(objv[1]); ! nbytes = objv[1]->length; ! fprintf(stderr, "STRANGE %d %d\n",(unsigned char)string[0],(unsigned char)string[1]); ! /* string = Tcl_GetStringFromObj(objv[1], &nbytes);*/ ! if (nbytes > 48) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid string \"", --- 366,370 ---- return TCL_ERROR; } ! string = Tcl_GetStringFromObj(objv[1], &nbytes); if (nbytes > 48) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "invalid string \"", Index: tclcache.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/tclcache.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tclcache.c 5 Jul 2011 18:24:40 -0000 1.4 --- tclcache.c 5 Jul 2011 18:37:47 -0000 1.5 *************** *** 189,194 **** cachePtr = objv[2]->internalRep.otherValuePtr; - //fprintf(stderr,"CACHE %s %s\n",Tcl_GetString(objv[1]),Tcl_GetString(objv[2])); - Ns_GetTime(&now); err = 0; --- 189,192 ---- *************** *** 505,511 **** } cache = Tcl_GetString(objv[2]); - - //fprintf(stderr,"CACHE create %s\n",cache); - wait.sec = 2; ttl.sec = 60; --- 503,506 ---- Index: queue.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/queue.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** queue.c 5 Jul 2011 18:24:40 -0000 1.48 --- queue.c 5 Jul 2011 18:37:47 -0000 1.49 *************** *** 556,639 **** */ - /* - *---------------------------------------------------------------------- - * - * ConnAuthorize -- - * - * Try to authorize a connection. - * - * Results: - * NS_OK on successful authorization, - * NS_FILTER_RETURN on authorization failure, or - * NS_ERROR on error. - * - * Side effects: - * Connection request is authorized. On failure an alternative - * response may be sent to the client. - * - *---------------------------------------------------------------------- - */ - - static int - ConnAuthorize(Conn *connPtr) - { - Ns_Conn *conn = (Ns_Conn *) connPtr; - NsServer *servPtr = connPtr->servPtr; - int status; - - status = Ns_AuthorizeRequest(servPtr->server, - connPtr->request->method, connPtr->request->url, - connPtr->authUser, connPtr->authPasswd, connPtr->peer); - - switch (status) { - case NS_OK: - break; - case NS_FORBIDDEN: - /* - * NS_OK indicates that a response was sent to the client - * a this point, we must fast-forward to traces, - * so we convert the NS_OK to NS_FILTER_RETURN. - */ - if ((status = Ns_ConnReturnForbidden(conn)) == NS_OK) { - status = NS_FILTER_RETURN; - } - break; - case NS_UNAUTHORIZED: - /* - * NS_OK indicates that a response was sent to the client - * a this point, we must fast-forward to traces, - * so we convert the NS_OK to NS_FILTER_RETURN. - */ - if ((status = Ns_ConnReturnUnauthorized(conn)) == NS_OK) { - status = NS_FILTER_RETURN; - } - break; - case NS_ERROR: - default: - status = NS_ERROR; - break; - } - - return status; - } - - - /* - *---------------------------------------------------------------------- - * - * ConnRun -- - * - * Run a valid connection. - * - * Results: - * None. - * - * Side effects: - * Connection request is read and parsed and the cooresponding - * service routine is called. - * - *---------------------------------------------------------------------- - */ - static void ConnRun(Conn *connPtr) --- 556,559 ---- *************** *** 670,749 **** */ ! while (1) { ! ! /* ! * Proxy requests replace request logic ! */ ! ! if (connPtr->request->protocol != NULL ! && connPtr->request->host != NULL) { ! ! status = NsConnRunProxyRequest((Ns_Conn *) connPtr); ! break; ! } ! ! /* ! * Each stage of request processing can return one of three ! * possible results: ! * NS_OK means continue to next stage ! * NS_FILTER_RETURN means skip to traces ! * NS_ERROR means skip to 500 response attempt ! */ ! status = NsRunFilters(conn, NS_FILTER_PRE_AUTH); ! if (status != NS_OK) { ! break; ! } ! status = ConnAuthorize(connPtr); ! if (status != NS_OK) { ! break; ! } ! status = NsRunFilters(conn, NS_FILTER_POST_AUTH); ! if (status != NS_OK) { ! break; } - - status = Ns_ConnRunRequest(conn); - break; } - - if (status == NS_ERROR) { - status = Ns_ConnReturnInternalError(conn); - } - - /* - * Closing connection also runs code registered with - * ns_atclose. - */ - Ns_ConnClose(conn); - - /* - * Trace filters, void filter traces and server traces - * run a response was sent to the client - * Note that a successful response includes sending - * an internal server error response. - */ - if (status == NS_OK || status == NS_FILTER_RETURN) { ! /* ! * Filter Traces are registered with ns_register_filter ! * Ignore the return code? We need to do NsRunTraces based ! * upon status before trace filters ran. Question is if we ! * should skip void trace filters. We could wrap them in another ! * status check, then move on to NsRunTraces. ! */ ! NsRunFilters(conn, NS_FILTER_TRACE); ! /* ! * Filters registered outside the context of a particular server ! */ ! (void) NsRunFilters(conn, NS_FILTER_VOID_TRACE); ! /* ! * Server traces registered with Ns_RegisterServerTrace ! * Access logging is handled at this point. ! */ ! NsRunTraces(conn); } --- 590,639 ---- */ ! if (connPtr->request->protocol != NULL && connPtr->request->host != NULL) { ! status = NsConnRunProxyRequest((Ns_Conn *) connPtr); ! } else { ! status = NsRunFilters(conn, NS_FILTER_PRE_AUTH); ! if (status == NS_OK) { ! status = Ns_AuthorizeRequest(servPtr->server, ! connPtr->request->method, connPtr->request->url, ! connPtr->authUser, connPtr->authPasswd, connPtr->peer); ! switch (status) { ! case NS_OK: ! status = NsRunFilters(conn, NS_FILTER_POST_AUTH); ! if (status == NS_OK) { ! status = Ns_ConnRunRequest(conn); ! } ! break; ! case NS_FORBIDDEN: ! Ns_ConnReturnForbidden(conn); ! break; ! case NS_UNAUTHORIZED: ! Ns_ConnReturnUnauthorized(conn); ! break; ! case NS_ERROR: ! default: ! Ns_ConnReturnInternalError(conn); ! break; ! } ! } else if (status != NS_FILTER_RETURN) { ! /* if not ok or filter_return, then the pre-auth filter coughed ! * an error. We are not going to proceed, but also we ! * can't count on the filter to have sent a response ! * back to the client. So, send an error response. ! */ ! Ns_ConnReturnInternalError(conn); ! status = NS_FILTER_RETURN; /* to allow tracing to happen */ } } Ns_ConnClose(conn); if (status == NS_OK || status == NS_FILTER_RETURN) { ! status = NsRunFilters(conn, NS_FILTER_TRACE); ! if (status == NS_OK) { ! (void) NsRunFilters(conn, NS_FILTER_VOID_TRACE); ! NsRunTraces(conn); ! } } *************** *** 752,770 **** * followed by free the connection interp if it was used. */ - - /* - * Cleanups are registered with either: - * Ns_RegisterConnCleanup: same signature as Ns_RegisterServerTrace - * Ns_RegisterCleanup: runs for all servers - */ NsRunCleanups(conn); - - /* Finished with conn */ - NsFreeConnInterp(connPtr); } - /* --- 642,650 ---- Index: server.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/server.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** server.c 5 Jul 2011 18:24:40 -0000 1.48 --- server.c 5 Jul 2011 18:37:47 -0000 1.49 *************** *** 298,301 **** --- 298,302 ---- * is no encoding, i.e., assume UTF-8. */ + GetCharsetEncoding(path, "urlcharset", NULL, &servPtr->urlEncoding); Index: uuencode.c =================================================================== RCS file: /cvsroot/aolserver/aolserver/nsd/uuencode.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** uuencode.c 5 Jul 2011 18:24:40 -0000 1.3 --- uuencode.c 5 Jul 2011 18:37:47 -0000 1.4 *************** *** 111,130 **** p = input; ! q = (unsigned char*)output; for (n = len / 3; n > 0; --n) { *q++ = ENC(p[0] >> 2); - fprintf(stderr,"1 (%d) %d\n",p[0] >> 2, p[0]); - *q++ = ENC(((p[0] & 0x03) << 4) | ((p[1] & 0xf0) >> 4)); - fprintf(stderr,"2 (%d) %d %d\n",(((p[0] & 0x03) << 4) | ((p[1] & 0xf0) >> 4)), p[0], p[1]); - *q++ = ENC(((p[1] & 0x0f) << 2) | ((p[2] & 0xc0) >> 6)); - fprintf(stderr,"3 (%d) %d %d\n",(((p[1] & 0x0f) << 2) | ((p[2] & 0xc0) >> 6)), p[1], p[2]); - *q++ = ENC(p[2] & 0x3f); - fprintf(stderr,"4 (%d) %d\n",(p[2] & 0x3f),p[2]); - - /* *q++ = ENC(((p[0] << 4) & 060) | ((p[1] >> 4) & 017)); *q++ = ENC(((p[1] << 2) & 074) | ((p[2] >> 6) & 03)); *q++ = ENC(p[2] & 077); - */ p += 3; } --- 111,120 ---- p = input; ! q = output; for (n = len / 3; n > 0; --n) { *q++ = ENC(p[0] >> 2); *q++ = ENC(((p[0] << 4) & 060) | ((p[1] >> 4) & 017)); *q++ = ENC(((p[1] << 2) & 074) | ((p[2] >> 6) & 03)); *q++ = ENC(p[2] & 077); p += 3; } *************** *** 138,146 **** *q++ = ENC(p[0] >> 2); if (n == 1) { ! *q++ = ENC(((p[0] & 0x03) << 4)); *q++ = '='; } else { ! *q++ = ENC(((p[0] & 0x03) << 4) | ((p[1] & 0xf0) >> 4)); ! *q++ = ENC(((p[1] & 0x0f) << 2)); } *q++ = '='; --- 128,136 ---- *q++ = ENC(p[0] >> 2); if (n == 1) { ! *q++ = ENC((p[0] << 4) & 060); *q++ = '='; } else { ! *q++ = ENC(((p[0] << 4) & 060) | ((p[1] >> 4) & 017)); ! *q++ = ENC((p[1] << 2) & 074); } *q++ = '='; |