From: Stephen D. <sd...@us...> - 2005-10-02 22:23:21
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17412/nsd Modified Files: nsd.h adpeval.c adprequest.c connio.c encoding.c fastpath.c form.c mimetypes.c op.c request.c return.c rollfile.c str.c tclrequest.c unix.c nswin32.c url.c urlspace.c Log Message: Untabify, reformat, add CONST declarations and GNUC attributes. Index: encoding.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/encoding.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** encoding.c 10 Jun 2005 17:58:38 -0000 1.2 --- encoding.c 2 Oct 2005 22:23:09 -0000 1.3 *************** *** 31,35 **** * encoding.c -- * ! * Defines standard default charset to encoding mappings. */ --- 31,35 ---- * encoding.c -- * ! * Defines standard default charset to encoding mappings. */ [...1155 lines suppressed...] { ! Conn *connPtr; ! if ( ((connPtr = (Conn *)Ns_GetConn()) != NULL) && ! (connPtr->servPtr != NULL) ) { return connPtr->servPtr->encoding.hackContentTypeP; - } else { - return nsconf.encoding.hackContentTypeP; } } --- 781,789 ---- GetDefaultHackContentTypeP(void) { ! Conn *connPtr = (Conn *) Ns_GetConn(); ! if (connPtr != NULL && connPtr->servPtr != NULL) { return connPtr->servPtr->encoding.hackContentTypeP; } + return nsconf.encoding.hackContentTypeP; } Index: unix.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/unix.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** unix.c 2 Aug 2005 03:51:23 -0000 1.10 --- unix.c 2 Oct 2005 22:23:10 -0000 1.11 *************** *** 242,246 **** int ! NsMemMap(char *path, int size, int mode, FileMap *mapPtr) { /* --- 242,246 ---- int ! NsMemMap(CONST char *path, int size, int mode, FileMap *mapPtr) { /* Index: connio.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/connio.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** connio.c 12 Jul 2005 07:31:39 -0000 1.8 --- connio.c 2 Oct 2005 22:23:09 -0000 1.9 *************** *** 46,52 **** static int ConnSend(Ns_Conn *conn, int nsend, Tcl_Channel chan, ! FILE *fp, int fd); static int ConnCopy(Ns_Conn *conn, size_t ncopy, Tcl_Channel chan, ! FILE *fp, int fd); --- 46,52 ---- static int ConnSend(Ns_Conn *conn, int nsend, Tcl_Channel chan, [...1162 lines suppressed...] { ! int toread, nread, status; ! char buf[IOBUFSZ]; /* --- 835,840 ---- ConnSend(Ns_Conn *conn, int nsend, Tcl_Channel chan, FILE *fp, int fd) { ! int toread, nread, status; ! char buf[IOBUFSZ]; /* *************** *** 829,832 **** --- 842,846 ---- * headers) get flushed. */ + if (nsend == 0) { Ns_WriteConn(conn, NULL, 0); Index: urlspace.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/urlspace.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** urlspace.c 2 Oct 2005 05:27:44 -0000 1.5 --- urlspace.c 2 Oct 2005 22:23:10 -0000 1.6 *************** *** 141,145 **** static void IndexNodeDestroy(Ns_Index *indexPtr); static int CmpBranches(Branch **leftPtrPtr, Branch **rightPtrPtr); ! static int CmpKeyWithBranch(char *key, Branch **branchPtrPtr); static void BranchDestroy(Branch *branchPtr); --- 141,145 ---- static void IndexNodeDestroy(Ns_Index *indexPtr); static int CmpBranches(Branch **leftPtrPtr, Branch **rightPtrPtr); ! static int CmpKeyWithBranch(CONST char *key, Branch **branchPtrPtr); static void BranchDestroy(Branch *branchPtr); *************** *** 148,152 **** */ ! static void MkSeq(Ns_DString *dsPtr, char *server, char *method, char *url); #ifdef DEBUG static void indentspace(int n); --- 148,153 ---- */ ! static void MkSeq(Ns_DString *dsPtr, CONST char *server, CONST char *method, ! CONST char *url); #ifdef DEBUG static void indentspace(int n); *************** *** 162,166 **** static void TrieInit(Trie *triePtr); static void TrieAdd(Trie *triePtr, char *seq, int id, void *data, int flags, ! void (*deletefunc) (void *)); static void TrieTrunc(Trie *triePtr, int id); static void TrieDestroy(Trie *triePtr); --- 163,167 ---- static void TrieInit(Trie *triePtr); static void TrieAdd(Trie *triePtr, char *seq, int id, void *data, int flags, ! void (*deletefunc)(void *)); static void TrieTrunc(Trie *triePtr, int id); static void TrieDestroy(Trie *triePtr); *************** *** 176,184 **** #ifndef __URLSPACE_OPTIMIZE__ static int CmpChannels(Channel **leftPtrPtr, Channel **rightPtrPtr); ! static int CmpKeyWithChannel(char *key, Channel **channelPtrPtr); #endif static int CmpChannelsAsStrings(Channel **leftPtrPtr, Channel **rightPtrPtr); ! static int CmpKeyWithChannelAsStrings(char *key, Channel **channelPtrPtr); /* --- 177,185 ---- #ifndef __URLSPACE_OPTIMIZE__ static int CmpChannels(Channel **leftPtrPtr, Channel **rightPtrPtr); ! static int CmpKeyWithChannel(CONST char *key, Channel **channelPtrPtr); #endif static int CmpChannelsAsStrings(Channel **leftPtrPtr, Channel **rightPtrPtr); ! static int CmpKeyWithChannelAsStrings(CONST char *key, Channel **channelPtrPtr); /* *************** *** 188,196 **** static void JunctionInit(Junction *juncPtr); static void JunctionAdd(Junction *juncPtr, char *seq, int id, void *data, ! int flags, void (*deletefunc) (void *)); static void JunctionBranchTrunc(Junction *juncPtr, char *seq, int id); static void *JunctionFind(Junction *juncPtr, char *seq, int id, int fast); static void *JunctionFindExact(Junction *juncPtr, char *seq, int id, int flags, ! int fast); static void *JunctionDelete(Junction *juncPtr, char *seq, int id, int flags); --- 189,197 ---- static void JunctionInit(Junction *juncPtr); static void JunctionAdd(Junction *juncPtr, char *seq, int id, void *data, ! int flags, void (*deletefunc)(void *)); static void JunctionBranchTrunc(Junction *juncPtr, char *seq, int id); static void *JunctionFind(Junction *juncPtr, char *seq, int id, int fast); static void *JunctionFindExact(Junction *juncPtr, char *seq, int id, int flags, ! int fast); static void *JunctionDelete(Junction *juncPtr, char *seq, int id, int flags); *************** *** 277,282 **** void ! Ns_UrlSpecificSet(char *server, char *method, char *url, int id, void *data, ! int flags, void (*deletefunc) (void *)) { Ns_DString ds; --- 278,283 ---- void ! Ns_UrlSpecificSet(CONST char *server, CONST char *method, CONST char *url, int id, ! void *data, int flags, void (*deletefunc) (void *)) { Ns_DString ds; *************** *** 309,313 **** void * ! Ns_UrlSpecificGet(char *server, char *method, char *url, int id) { Ns_DString ds; --- 310,315 ---- void * ! Ns_UrlSpecificGet(CONST char *server, CONST char *method, CONST char *url, ! int id) { Ns_DString ds; *************** *** 343,347 **** void * ! Ns_UrlSpecificGetFast(char *server, char *method, char *url, int id) { Ns_DString ds; --- 345,350 ---- void * ! Ns_UrlSpecificGetFast(CONST char *server, CONST char *method, CONST char *url, ! int id) { Ns_DString ds; *************** *** 376,381 **** void * ! Ns_UrlSpecificGetExact(char *server, char *method, char *url, int id, ! int flags) { Ns_DString ds; --- 379,384 ---- void * ! Ns_UrlSpecificGetExact(CONST char *server, CONST char *method, CONST char *url, ! int id, int flags) { Ns_DString ds; *************** *** 413,417 **** void * ! Ns_UrlSpecificDestroy(char *server, char *method, char *url, int id, int flags) { Ns_DString ds; --- 416,421 ---- void * ! Ns_UrlSpecificDestroy(CONST char *server, CONST char *method, CONST char *url, ! int id, int flags) { Ns_DString ds; *************** *** 475,479 **** void ! Ns_ServerSpecificSet(char *handle, int id, void *data, int flags, void (*deletefunc) (void *)) { --- 479,483 ---- void ! Ns_ServerSpecificSet(CONST char *handle, int id, void *data, int flags, void (*deletefunc) (void *)) { *************** *** 499,503 **** void * ! Ns_ServerSpecificGet(char *handle, int id) { return Ns_UrlSpecificGet(handle, NULL, NULL, id); --- 503,507 ---- void * ! Ns_ServerSpecificGet(CONST char *handle, int id) { return Ns_UrlSpecificGet(handle, NULL, NULL, id); *************** *** 523,527 **** void * ! Ns_ServerSpecificDestroy(char *handle, int id, int flags) { return Ns_UrlSpecificDestroy(handle, NULL, NULL, id, flags); --- 527,531 ---- void * ! Ns_ServerSpecificDestroy(CONST char *handle, int id, int flags) { return Ns_UrlSpecificDestroy(handle, NULL, NULL, id, flags); *************** *** 716,720 **** static int ! CmpKeyWithBranch(char *key, Branch **branchPtrPtr) { return strcmp(key, (*branchPtrPtr)->word); --- 720,724 ---- static int ! CmpKeyWithBranch(CONST char *key, Branch **branchPtrPtr) { return strcmp(key, (*branchPtrPtr)->word); *************** *** 1299,1303 **** static int ! CmpKeyWithChannel(char *key, Channel **channelPtrPtr) { int lcontainsr, rcontainsl; --- 1303,1307 ---- static int ! CmpKeyWithChannel(CONST char *key, Channel **channelPtrPtr) { int lcontainsr, rcontainsl; *************** *** 1357,1361 **** static int ! CmpKeyWithChannelAsStrings(char *key, Channel **channelPtrPtr) { return strcmp(key, (*channelPtrPtr)->filter); --- 1361,1365 ---- static int ! CmpKeyWithChannelAsStrings(CONST char *key, Channel **channelPtrPtr) { return strcmp(key, (*channelPtrPtr)->filter); *************** *** 1466,1470 **** static void JunctionAdd(Junction *juncPtr, char *seq, int id, void *data, int flags, ! void (*deletefunc) (void *)) { Channel *channelPtr; --- 1470,1474 ---- static void JunctionAdd(Junction *juncPtr, char *seq, int id, void *data, int flags, ! void (*deletefunc)(void *)) { Channel *channelPtr; *************** *** 1786,1790 **** * * Side effects: ! * The node will be deleted if NS_OP_NODELETE isn't set in flags * *---------------------------------------------------------------------- --- 1790,1795 ---- * * Side effects: ! * The node will be deleted if NS_OP_NODELETE isn't set in flags. ! * Seq will be modified. * *---------------------------------------------------------------------- *************** *** 1866,1873 **** static void ! MkSeq(Ns_DString *dsPtr, char *server, char *method, char *url) { ! char *p; ! int done, l; if ((method != NULL) && (url != NULL)) { --- 1871,1878 ---- static void ! MkSeq(Ns_DString *dsPtr, CONST char *server, CONST char *method, CONST char *url) { ! CONST char *p; ! int done, l; if ((method != NULL) && (url != NULL)) { *************** *** 2060,2066 **** static void ! PrintSeq(char *seq) { ! char *p; for (p = seq; *p != '\0'; p += strlen(p) + 1) { --- 2065,2071 ---- static void ! PrintSeq(CONST char *seq) { ! CONST char *p; for (p = seq; *p != '\0'; p += strlen(p) + 1) { *************** *** 2092,2096 **** static void ! WalkTrie(Trie *triePtr, int id, char *server, Ns_ArgProc func, Tcl_DString *dsPtr, char **stack, char *filter) { Branch *branch; --- 2097,2102 ---- static void ! WalkTrie(Trie *triePtr, int id, CONST char *server, Ns_ArgProc func, ! Tcl_DString *dsPtr, char **stack, CONST char *filter) { Branch *branch; *************** *** 2157,2161 **** void ! NsUrlSpecificWalk(int id, char *server, Ns_ArgProc func, Tcl_DString *dsPtr) { int i; --- 2163,2167 ---- void ! NsUrlSpecificWalk(int id, CONST char *server, Ns_ArgProc func, Tcl_DString *dsPtr) { int i; Index: mimetypes.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/mimetypes.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mimetypes.c 10 Jun 2005 17:58:39 -0000 1.3 --- mimetypes.c 2 Oct 2005 22:23:10 -0000 1.4 *************** *** 32,36 **** * mimetypes.c -- * ! * Defines standard default mime types. */ --- 32,36 ---- * mimetypes.c -- * ! * Defines standard default mime types. */ *************** *** 45,50 **** */ ! static void AddType(char *ext, char *type); ! static char *LowerDString(Ns_DString *dsPtr, char *ext); /* --- 45,50 ---- */ ! static void AddType(CONST char *ext, CONST char *type); ! static char *LowerDString(Ns_DString *dsPtr, CONST char *ext); /* *************** *** 61,66 **** static struct exttype { ! char *ext; ! char *type; } typetab[] = { /* --- 61,66 ---- static struct exttype { ! CONST char *ext; ! CONST char *type; } typetab[] = { /* *************** *** 232,243 **** * Ns_GetMimeType -- * ! * Guess the mime type based on filename extension. Case is ! * ignored. * * Results: ! * A mime type. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 232,243 ---- * Ns_GetMimeType -- * ! * Guess the mime type based on filename extension. Case is ! * ignored. * * Results: ! * A mime type. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 245,271 **** char * ! Ns_GetMimeType(char *file) { ! char *start, *ext; Ns_DString ds; ! Tcl_HashEntry *hePtr; start = strrchr(file, '/'); if (start == NULL) { ! start = file; } - ext = strrchr(start, '.'); if (ext == NULL) { ! return noextType; } - Ns_DStringInit(&ds); ext = LowerDString(&ds, ext); ! hePtr = Tcl_FindHashEntry(&types, ext); ! if (hePtr == NULL) { ! return defaultType; } ! return Tcl_GetHashValue(hePtr); } --- 245,271 ---- char * ! Ns_GetMimeType(CONST char *file) { ! CONST char *start, *ext; Ns_DString ds; ! Tcl_HashEntry *hPtr; start = strrchr(file, '/'); if (start == NULL) { ! start = file; } ext = strrchr(start, '.'); if (ext == NULL) { ! return noextType; } Ns_DStringInit(&ds); ext = LowerDString(&ds, ext); ! hPtr = Tcl_FindHashEntry(&types, ext); ! Ns_DStringFree(&ds); ! if (hPtr != NULL) { ! return Tcl_GetHashValue(hPtr); } ! ! return defaultType; } *************** *** 276,286 **** * NsInitMimeTypes -- * ! * Add compiled-in default mime types. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 276,286 ---- * NsInitMimeTypes -- * ! * Add compiled-in default mime types. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 290,294 **** NsInitMimeTypes(void) { ! int i; /* --- 290,294 ---- NsInitMimeTypes(void) { ! int i; /* *************** *** 313,323 **** * NsUpdateMimeTypes -- * ! * Add configured mime types. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 313,323 ---- * NsUpdateMimeTypes -- * ! * Add configured mime types. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 332,346 **** set = Ns_ConfigGetSection("ns/mimetypes"); if (set == NULL) { ! return; } defaultType = Ns_SetIGet(set, "default"); if (defaultType == NULL) { ! defaultType = TYPE_DEFAULT; } noextType = Ns_SetIGet(set, "noextension"); if (noextType == NULL) { ! noextType = defaultType; } --- 332,346 ---- set = Ns_ConfigGetSection("ns/mimetypes"); if (set == NULL) { ! return; } defaultType = Ns_SetIGet(set, "default"); if (defaultType == NULL) { ! defaultType = TYPE_DEFAULT; } noextType = Ns_SetIGet(set, "noextension"); if (noextType == NULL) { ! noextType = defaultType; } *************** *** 356,366 **** * NsTclGuessTypeObjCmd -- * ! * Implements ns_guesstype. * * Results: ! * Tcl result. * * Side effects: ! * See docs. * *---------------------------------------------------------------------- --- 356,366 ---- * NsTclGuessTypeObjCmd -- * ! * Implements ns_guesstype. * * Results: ! * Tcl result. * * Side effects: ! * See docs. * *---------------------------------------------------------------------- *************** *** 370,374 **** NsTclGuessTypeObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ! char *type; if (objc != 2) { --- 370,374 ---- NsTclGuessTypeObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ! CONST char *type; if (objc != 2) { *************** *** 377,382 **** } type = Ns_GetMimeType(Tcl_GetString(objv[1])); ! Tcl_SetResult(interp, type, TCL_VOLATILE); ! return TCL_OK; } --- 377,382 ---- } type = Ns_GetMimeType(Tcl_GetString(objv[1])); ! Tcl_SetStringObj(Tcl_GetObjResult(interp), type, -1); ! return TCL_OK; } *************** *** 388,398 **** * AddType -- * ! * Add a mime type to the global hash table. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 388,398 ---- * AddType -- * ! * Add a mime type to the global hash table. * * Results: ! * None. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 400,404 **** static void ! AddType(char *ext, char *type) { Ns_DString ds; --- 400,404 ---- static void ! AddType(CONST char *ext, CONST char *type) { Ns_DString ds; *************** *** 422,433 **** * LowerDString -- * ! * Append a string to the dstring, converting all alphabetic ! * characeters to lowercase. * * Results: ! * dsPtr->string * * Side effects: ! * Appends to dstring. * *---------------------------------------------------------------------- --- 422,433 ---- * LowerDString -- * ! * Append a string to the dstring, converting all alphabetic ! * characeters to lowercase. * * Results: ! * dsPtr->string * * Side effects: ! * Appends to dstring. * *---------------------------------------------------------------------- *************** *** 435,447 **** static char * ! LowerDString(Ns_DString *dsPtr, char *ext) { Ns_DStringAppend(dsPtr, ext); ! ext = dsPtr->string; ! while (*ext != '\0') { ! if (isupper(UCHAR(*ext))) { ! *ext = tolower(UCHAR(*ext)); } ! ++ext; } --- 435,449 ---- static char * ! LowerDString(Ns_DString *dsPtr, CONST char *ext) { + char *p; + Ns_DStringAppend(dsPtr, ext); ! p = dsPtr->string; ! while (*p != '\0') { ! if (isupper(UCHAR(*p))) { ! *p = tolower(UCHAR(*p)); } ! ++p; } Index: request.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/request.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** request.c 10 Jun 2005 17:58:39 -0000 1.3 --- request.c 2 Oct 2005 22:23:10 -0000 1.4 *************** *** 97,104 **** Ns_Request * ! Ns_ParseRequest(char *line) { ! char *url; ! char *p; Ns_DString ds; Ns_Request *request; --- 97,103 ---- Ns_Request * ! Ns_ParseRequest(CONST char *line) { ! char *url, *l, *p; Ns_DString ds; Ns_Request *request; *************** *** 115,120 **** } Ns_DStringAppend(&ds, line); ! line = Ns_StrTrim(ds.string); ! if (*line == '\0') { goto done; } --- 114,119 ---- } Ns_DStringAppend(&ds, line); ! l = Ns_StrTrim(ds.string); ! if (*l == '\0') { goto done; } *************** *** 124,128 **** */ ! request->line = ns_strdup(line); /* --- 123,127 ---- */ ! request->line = ns_strdup(l); /* *************** *** 130,134 **** */ ! url = line; while (*url != '\0' && !isspace(UCHAR(*url))) { ++url; --- 129,133 ---- */ ! url = l; while (*url != '\0' && !isspace(UCHAR(*url))) { ++url; *************** *** 144,148 **** goto done; } ! request->method = ns_strdup(line); --- 143,147 ---- goto done; } ! request->method = ns_strdup(l); *************** *** 195,199 **** */ ! *p++ = '\0'; request->protocol = ns_strdup(url); url = p; --- 194,198 ---- */ ! *p++ = '\0'; request->protocol = ns_strdup(url); url = p; *************** *** 280,284 **** void ! Ns_SetRequestUrl(Ns_Request * request, char *url) { Ns_DString ds; --- 279,283 ---- void ! Ns_SetRequestUrl(Ns_Request * request, CONST char *url) { Ns_DString ds; Index: rollfile.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/rollfile.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rollfile.c 10 Jun 2005 20:53:13 -0000 1.3 --- rollfile.c 2 Oct 2005 22:23:10 -0000 1.4 *************** *** 31,35 **** * rollfile.c -- * ! * Routines to roll files. */ --- 31,35 ---- * rollfile.c -- * ! * Routines to roll files. */ *************** *** 39,43 **** typedef struct File { ! time_t mtime; char name[4]; } File; --- 39,43 ---- typedef struct File { ! time_t mtime; char name[4]; } File; *************** *** 59,76 **** * Ns_RollFile -- * ! * Roll the log file. When the log is rolled, it gets renamed to ! * filename.xyz, where 000 <= xyz <= 999. Older files have ! * higher numbers. * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * If there were files: filename.000, filename.001, filename.002, ! * the names would end up thusly: ! * filename.002 => filename.003 ! * filename.001 => filename.002 ! * filename.000 => filename.001 ! * with nothing left named filename.000. * *---------------------------------------------------------------------- --- 59,76 ---- * Ns_RollFile -- * ! * Roll the log file. When the log is rolled, it gets renamed to ! * filename.xyz, where 000 <= xyz <= 999. Older files have ! * higher numbers. * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * If there were files: filename.000, filename.001, filename.002, ! * the names would end up thusly: ! * filename.002 => filename.003 ! * filename.001 => filename.002 ! * filename.000 => filename.001 ! * with nothing left named filename.000. * *---------------------------------------------------------------------- *************** *** 86,91 **** if (max < 0 || max > 999) { Ns_Log(Error, "rollfile: invalid max parameter '%d'; " ! "must be > 0 and < 999", max); ! return NS_ERROR; } --- 86,91 ---- if (max < 0 || max > 999) { Ns_Log(Error, "rollfile: invalid max parameter '%d'; " ! "must be > 0 and < 999", max); ! return NS_ERROR; } *************** *** 94,126 **** err = Exists(first); if (err > 0) { ! next = ns_strdup(first); ! num = 0; ! do { dot = strrchr(next, '.') + 1; sprintf(dot, "%03d", num++); ! } while ((err = Exists(next)) == 1 && num < max); ! num--; ! if (err == 1) { ! err = Unlink(next); ! } ! while (err == 0 && num-- > 0) { dot = strrchr(first, '.') + 1; sprintf(dot, "%03d", num); dot = strrchr(next, '.') + 1; sprintf(dot, "%03d", num + 1); ! err = Rename(first, next); ! } ! ns_free(next); } if (err == 0) { ! err = Exists(file); ! if (err > 0) { ! err = Rename(file, first); ! } } ns_free(first); ! if (err != 0) { ! return NS_ERROR; } return NS_OK; --- 94,126 ---- err = Exists(first); if (err > 0) { ! next = ns_strdup(first); ! num = 0; ! do { dot = strrchr(next, '.') + 1; sprintf(dot, "%03d", num++); ! } while ((err = Exists(next)) == 1 && num < max); ! num--; ! if (err == 1) { ! err = Unlink(next); ! } ! while (err == 0 && num-- > 0) { dot = strrchr(first, '.') + 1; sprintf(dot, "%03d", num); dot = strrchr(next, '.') + 1; sprintf(dot, "%03d", num + 1); ! err = Rename(first, next); ! } ! ns_free(next); } if (err == 0) { ! err = Exists(file); ! if (err > 0) { ! err = Rename(file, first); ! } } ns_free(first); ! if (err != 0) { ! return NS_ERROR; } return NS_OK; *************** *** 133,146 **** * Ns_PurgeFiles, Ns_RollFileByDate -- * ! * Purge files by date, keeping max files. The file parameter is ! * used a basename to select files to purge. Ns_RollFileByDate ! * is a poorly named wrapper for historical reasons (rolling ! * implies rotating filenames). * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * May remove (many) files. * *---------------------------------------------------------------------- --- 133,146 ---- * Ns_PurgeFiles, Ns_RollFileByDate -- * ! * Purge files by date, keeping max files. The file parameter is ! * used a basename to select files to purge. Ns_RollFileByDate ! * is a poorly named wrapper for historical reasons (rolling ! * implies rotating filenames). * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * May remove (many) files. * *---------------------------------------------------------------------- *************** *** 162,170 **** int tlen, i, nfiles, status; Ns_DString dir, list; ! status = NS_ERROR; Ns_DStringInit(&dir); Ns_DStringInit(&list); ! /* * Determine the directory component. --- 162,170 ---- int tlen, i, nfiles, status; Ns_DString dir, list; ! status = NS_ERROR; Ns_DStringInit(&dir); Ns_DStringInit(&list); ! /* * Determine the directory component. *************** *** 174,180 **** slash = strrchr (dir.string, '/'); if (slash == NULL || slash[1] == '\0') { ! Ns_Log (Error, "rollfile: failed to purge files: invalid path '%s'", ! file); ! goto err; } *slash = '\0'; --- 174,180 ---- slash = strrchr (dir.string, '/'); if (slash == NULL || slash[1] == '\0') { ! Ns_Log (Error, "rollfile: failed to purge files: invalid path '%s'", ! file); ! goto err; } *slash = '\0'; *************** *** 184,199 **** dp = opendir(dir.string); if (dp == NULL) { ! Ns_Log(Error, "rollfile: failed to purge files:opendir(%s) failed: '%s'", ! dir.string, strerror(errno)); ! goto err; } while ((ent = ns_readdir(dp)) != NULL) { ! if (strncmp(tail, ent->d_name, (size_t)tlen) != 0) { ! continue; ! } ! if (!AppendFile(&list, dir.string, ent->d_name)) { ! closedir(dp); ! goto err; ! } } closedir(dp); --- 184,199 ---- dp = opendir(dir.string); if (dp == NULL) { ! Ns_Log(Error, "rollfile: failed to purge files:opendir(%s) failed: '%s'", ! dir.string, strerror(errno)); ! goto err; } while ((ent = ns_readdir(dp)) != NULL) { ! if (strncmp(tail, ent->d_name, (size_t)tlen) != 0) { ! continue; ! } ! if (!AppendFile(&list, dir.string, ent->d_name)) { ! closedir(dp); ! goto err; ! } } closedir(dp); *************** *** 201,211 **** nfiles = list.length / sizeof(File *); if (nfiles >= max) { ! files = (File **) list.string; ! qsort(files, (size_t)nfiles, sizeof(File *), CmpFile); ! for (i = max; i < nfiles; ++i) { ! if (Unlink(files[i]->name) != 0) { ! goto err; ! } ! } } status = NS_OK; --- 201,211 ---- nfiles = list.length / sizeof(File *); if (nfiles >= max) { ! files = (File **) list.string; ! qsort(files, (size_t)nfiles, sizeof(File *), CmpFile); ! for (i = max; i < nfiles; ++i) { ! if (Unlink(files[i]->name) != 0) { ! goto err; ! } ! } } status = NS_OK; *************** *** 214,224 **** nfiles = list.length / sizeof(File *); if (nfiles > 0) { ! files = (File **) list.string; ! for (i = 0; i < nfiles; ++i) { ! ns_free(files[i]); ! } } Ns_DStringFree(&list); Ns_DStringFree(&dir); return status; } --- 214,225 ---- nfiles = list.length / sizeof(File *); if (nfiles > 0) { ! files = (File **) list.string; ! for (i = 0; i < nfiles; ++i) { ! ns_free(files[i]); ! } } Ns_DStringFree(&list); Ns_DStringFree(&dir); + return status; } *************** *** 230,240 **** * AppendFile -- * ! * Append a file entry with mtime to the list kept in the dstring. * * Results: ! * 1 if file added, 0 otherwise. * * Side effects: ! * Allocates memory for entry. * *---------------------------------------------------------------------- --- 231,241 ---- * AppendFile -- * ! * Append a file entry with mtime to the list kept in the dstring. * * Results: ! * 1 if file added, 0 otherwise. * * Side effects: ! * Allocates memory for entry. * *---------------------------------------------------------------------- *************** *** 246,260 **** File *fPtr; struct stat st; ! fPtr = ns_malloc(sizeof(File) + strlen(dir) + strlen(tail)); sprintf(fPtr->name, "%s/%s", dir, tail); if (stat(fPtr->name, &st) != 0) { ! Ns_Log(Error, "rollfile: failed to append to file '%s': '%s'", ! fPtr->name, strerror(errno)); ! ns_free(fPtr); ! return 0; } fPtr->mtime = st.st_mtime; Ns_DStringNAppend(dsPtr, (char *) &fPtr, sizeof(File *)); return 1; } --- 247,262 ---- File *fPtr; struct stat st; ! fPtr = ns_malloc(sizeof(File) + strlen(dir) + strlen(tail)); sprintf(fPtr->name, "%s/%s", dir, tail); if (stat(fPtr->name, &st) != 0) { ! Ns_Log(Error, "rollfile: failed to append to file '%s': '%s'", ! fPtr->name, strerror(errno)); ! ns_free(fPtr); ! return 0; } fPtr->mtime = st.st_mtime; Ns_DStringNAppend(dsPtr, (char *) &fPtr, sizeof(File *)); + return 1; } *************** *** 266,276 **** * CmpFile -- * ! * qsort() callback to select oldest file. * * Results: ! * Stadard qsort() result. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 268,278 ---- * CmpFile -- * ! * qsort() callback to select oldest file. * * Results: ! * Stadard qsort() result. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 284,290 **** if (f1Ptr->mtime < f2Ptr->mtime) { ! return 1; } else if (f1Ptr->mtime > f2Ptr->mtime) { ! return -1; } return 0; --- 286,292 ---- if (f1Ptr->mtime < f2Ptr->mtime) { ! return 1; } else if (f1Ptr->mtime > f2Ptr->mtime) { ! return -1; } return 0; *************** *** 297,307 **** * Unlink, Rename, Exists -- * ! * Simple wrappers used by Ns_RollFile and Ns_PurgeFiles. * * Results: ! * System call result (except Exists). * * Side effects: ! * May modify filesystem. * *---------------------------------------------------------------------- --- 299,309 ---- * Unlink, Rename, Exists -- * ! * Simple wrappers used by Ns_RollFile and Ns_PurgeFiles. * * Results: ! * System call result (except Exists). * * Side effects: ! * May modify filesystem. * *---------------------------------------------------------------------- *************** *** 312,320 **** { int err; ! err = unlink(file); if (err != 0) { Ns_Log(Error, "rollfile: failed to delete file '%s': '%s'", ! file, strerror(errno)); } return err; --- 314,322 ---- { int err; ! err = unlink(file); if (err != 0) { Ns_Log(Error, "rollfile: failed to delete file '%s': '%s'", ! file, strerror(errno)); } return err; *************** *** 328,333 **** err = rename(from, to); if (err != 0) { ! Ns_Log(Error, "rollfile: failed to rename file '%s' to '%s': '%s'", ! from, to, strerror(errno)); } return err; --- 330,335 ---- err = rename(from, to); if (err != 0) { ! Ns_Log(Error, "rollfile: failed to rename file '%s' to '%s': '%s'", ! from, to, strerror(errno)); } return err; *************** *** 340,350 **** if (access(file, F_OK) == 0) { ! exists = 1; } else if (errno == ENOENT) { ! exists = 0; } else { ! Ns_Log(Error, "rollfile: failed to determine if file '%s' exists: '%s'", ! file, strerror(errno)); ! exists = -1; } return exists; --- 342,352 ---- if (access(file, F_OK) == 0) { ! exists = 1; } else if (errno == ENOENT) { ! exists = 0; } else { ! Ns_Log(Error, "rollfile: failed to determine if file '%s' exists: '%s'", ! file, strerror(errno)); ! exists = -1; } return exists; Index: nswin32.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nswin32.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** nswin32.c 27 Jun 2005 17:46:58 -0000 1.8 --- nswin32.c 2 Oct 2005 22:23:10 -0000 1.9 *************** *** 455,459 **** int ! NsMemMap(char *path, int size, int mode, FileMap *mapPtr) { HANDLE hndl, mobj; --- 455,459 ---- int ! NsMemMap(CONST char *path, int size, int mode, FileMap *mapPtr) { HANDLE hndl, mobj; Index: url.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/url.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** url.c 10 Jun 2005 17:58:41 -0000 1.2 --- url.c 2 Oct 2005 22:23:10 -0000 1.3 *************** *** 32,36 **** * url.c -- * ! * Parse URLs. */ --- 32,36 ---- * url.c -- * ! * Parse URLs. */ *************** *** 45,67 **** * Ns_RelativeUrl -- * ! * If the url passed in is for this server, then the initial ! * part of the URL is stripped off. e.g., on a server whose ! * location is http://www.foo.com, Ns_RelativeUrl of ! * "http://www.foo.com/hello" will return "/hello". * * Results: ! * A pointer to the beginning of the relative url in the ! * passed-in url, or NULL if error. * * Side effects: ! * Will set errno on error. * *---------------------------------------------------------------------- */ ! char * ! Ns_RelativeUrl(char *url, char *location) { ! char *v; if (url == NULL || location == NULL) { --- 45,67 ---- * Ns_RelativeUrl -- * ! * If the url passed in is for this server, then the initial ! * part of the URL is stripped off. e.g., on a server whose ! * location is http://www.foo.com, Ns_RelativeUrl of ! * "http://www.foo.com/hello" will return "/hello". * * Results: ! * A pointer to the beginning of the relative url in the ! * passed-in url, or NULL if error. * * Side effects: ! * Will set errno on error. * *---------------------------------------------------------------------- */ ! CONST char * ! Ns_RelativeUrl(CONST char *url, CONST char *location) { ! CONST char *v; if (url == NULL || location == NULL) { *************** *** 77,81 **** * v="/a/b", or NULL if there's a mismatch. */ ! v = Ns_Match(location, url); if (v != NULL) { --- 77,81 ---- * v="/a/b", or NULL if there's a mismatch. */ ! v = Ns_Match(location, url); if (v != NULL) { *************** *** 94,106 **** * Ns_ParseUrl -- * ! * Parse a URL into its component parts * * Results: ! * NS_OK or NS_ERROR * * Side effects: ! * Pointers to the protocol, host, port, path, and "tail" (last ! * path element) will be set by reference in the passed-in pointers. ! * The passed-in url will be modified. * *---------------------------------------------------------------------- --- 94,106 ---- * Ns_ParseUrl -- * ! * Parse a URL into its component parts * * Results: ! * NS_OK or NS_ERROR * * Side effects: ! * Pointers to the protocol, host, port, path, and "tail" (last ! * path element) will be set by reference in the passed-in pointers. ! * The passed-in url will be modified. * *---------------------------------------------------------------------- *************** *** 109,115 **** int Ns_ParseUrl(char *url, char **pprotocol, char **phost, ! char **pport, char **ppath, char **ptail) { ! char *end; *pprotocol = NULL; --- 109,115 ---- int Ns_ParseUrl(char *url, char **pprotocol, char **phost, ! char **pport, char **ppath, char **ptail) { ! char *end; *pprotocol = NULL; *************** *** 128,180 **** end = strchr(url, ':'); if (end != NULL) { ! /* ! * There is a protocol specified. Clear out the colon. ! * Set pprotocol to the start of the protocol, and url to ! * the first character after the colon. ! * ! * http\0//www.foo.com:8000/baz/blah/spoo.html ! * ^ ^ ^ ! * | | +-- url ! * | +-- end ! * +-------- *pprotocol ! */ ! *end = '\0'; *pprotocol = url; url = end + 1; ! if ((*url == '/') && ! (*(url + 1) == '/')) { - /* - * There are two slashes, which means a host is specified. - * Advance url past that and set *phost. - * - * http\0//www.foo.com:8000/baz/blah/spoo.html - * ^ ^ ^ - * | | +-- url, *phost - * | +-- end - * +-------- *pprotocol - */ - url = url + 2; *phost = url; ! /* ! * Look for a port number, which is optional. ! */ ! end = strchr(url, ':'); if (end != NULL) { ! /* ! * A port was specified. Clear the colon and ! * set *pport to the first digit. ! * ! * http\0//www.foo.com\08000/baz/blah/spoo.html ! * ^ ^ ^ ^ ! * | +-- *phost | +------ url, *pport ! * +----- *pprotocol +--- end ! */ ! *end = '\0'; url = end + 1; --- 128,181 ---- end = strchr(url, ':'); if (end != NULL) { ! ! /* ! * There is a protocol specified. Clear out the colon. ! * Set pprotocol to the start of the protocol, and url to ! * the first character after the colon. ! * ! * http\0//www.foo.com:8000/baz/blah/spoo.html ! * ^ ^ ^ ! * | | +-- url ! * | +-- end ! * +-------- *pprotocol ! */ ! *end = '\0'; *pprotocol = url; url = end + 1; ! if (url[0] == '/' && url[1] == '/') { ! ! /* ! * There are two slashes, which means a host is specified. ! * Advance url past that and set *phost. ! * ! * http\0//www.foo.com:8000/baz/blah/spoo.html ! * ^ ^ ^ ! * | | +-- url, *phost ! * | +-- end ! * +-------- *pprotocol ! */ url = url + 2; *phost = url; ! /* ! * Look for a port number, which is optional. ! */ ! end = strchr(url, ':'); if (end != NULL) { ! ! /* ! * A port was specified. Clear the colon and ! * set *pport to the first digit. ! * ! * http\0//www.foo.com\08000/baz/blah/spoo.html ! * ^ ^ ^ ^ ! * | +-- *phost | +------ url, *pport ! * +----- *pprotocol +--- end ! */ ! *end = '\0'; url = end + 1; *************** *** 182,202 **** } ! /* ! * Move up to the slash which starts the path/tail. ! * Clear out the dividing slash. ! * ! * http\0//www.foo.com\08000\0baz/blah/spoo.html ! * ^ ^ ^ ^ ^ ! * | | | | +-- url ! * | +-- *phost | +-- end ! * +----- *pprotocol +-- *pport ! */ ! end = strchr(url, '/'); if (end == NULL) { ! /* ! * No path or tail specified. Return. ! */ ! *ppath = ""; *ptail = ""; --- 183,204 ---- } ! /* ! * Move up to the slash which starts the path/tail. ! * Clear out the dividing slash. ! * ! * http\0//www.foo.com\08000\0baz/blah/spoo.html ! * ^ ^ ^ ^ ^ ! * | | | | +-- url ! * | +-- *phost | +-- end ! * +----- *pprotocol +-- *pport ! */ ! end = strchr(url, '/'); if (end == NULL) { ! ! /* ! * No path or tail specified. Return. ! */ ! *ppath = ""; *ptail = ""; *************** *** 204,237 **** } *end = '\0'; ! url = end + 1; } else { ! /* ! * The URL must have been an odd one without a hostname. ! * Move the URL up past the dividing slash. ! * ! * http\0/baz/blah/spoo.html ! * ^ ^ ^ ! * | | +-- url ! * | +-- end ! * +-------- *pprotocol ! */ ! url++; } ! /* ! * Set the path to URL and advance to the last slash. ! * Set ptail to the character after that, or if there is none, ! * it becomes path and path becomes an empty string. ! * ! * http\0//www.foo.com\08000\0baz/blah/spoo.html ! * ^ ^ ^ ^ ^ ^^ ! * | | | | | |+-- *ptail ! * | | | | | +-- end ! * | | | | +-- *ppath ! * | +-- *phost | +-- end ! * +----- *pprotocol +-- *pport ! */ ! *ppath = url; end = strrchr(url, '/'); --- 206,240 ---- } *end = '\0'; ! url = end + 1; } else { ! ! /* ! * The URL must have been an odd one without a hostname. ! * Move the URL up past the dividing slash. ! * ! * http\0/baz/blah/spoo.html ! * ^ ^ ^ ! * | | +-- url ! * | +-- end ! * +-------- *pprotocol ! */ ! url++; } ! /* ! * Set the path to URL and advance to the last slash. ! * Set ptail to the character after that, or if there is none, ! * it becomes path and path becomes an empty string. ! * ! * http\0//www.foo.com\08000\0baz/blah/spoo.html ! * ^ ^ ^ ^ ^ ^^ ! * | | | | | |+-- *ptail ! * | | | | | +-- end ! * | | | | +-- *ppath ! * | +-- *phost | +-- end ! * +----- *pprotocol +-- *pport ! */ ! *ppath = url; end = strrchr(url, '/'); *************** *** 244,262 **** } } else { ! /* ! * This URL does not have a colon. If it begins with a slash, then ! * separate the tail from the path, otherwise it's all tail. ! */ ! if (*url == '/') { url++; *ppath = url; ! /* ! * Find the last slash on the right and everything after that ! * becomes tail; if there are no slashes then it's all tail ! * and path is an empty string. ! */ ! end = strrchr(url, '/'); if (end == NULL) { --- 247,266 ---- } } else { ! ! /* ! * This URL does not have a colon. If it begins with a slash, then ! * separate the tail from the path, otherwise it's all tail. ! */ ! if (*url == '/') { url++; *ppath = url; ! /* ! * Find the last slash on the right and everything after that ! * becomes tail; if there are no slashes then it's all tail ! * and path is an empty string. ! */ ! end = strrchr(url, '/'); if (end == NULL) { *************** *** 269,276 **** } else { ! /* ! * Just set the tail, there are no slashes. ! */ ! *ptail = url; } --- 273,280 ---- } else { ! /* ! * Just set the tail, there are no slashes. ! */ ! *ptail = url; } *************** *** 285,296 **** * Ns_AbsoluteUrl -- * ! * Construct an URL based on baseurl but with as many parts of ! * the incomplete url as possible. * * Results: ! * NS_OK or NS_ERROR. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 289,300 ---- * Ns_AbsoluteUrl -- * ! * Construct an URL based on baseurl but with as many parts of ! * the incomplete url as possible. * * Results: ! * NS_OK or NS_ERROR. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 298,306 **** int ! Ns_AbsoluteUrl(Ns_DString *dsPtr, char *url, char *base) { ! char *protocol, *host, *port, *path, *tail, *baseprotocol, ! *basehost, *baseport, *basepath, *basetail; ! int status = NS_OK; /* --- 302,311 ---- int ! Ns_AbsoluteUrl(Ns_DString *dsPtr, CONST char *url, CONST char *base) { ! Ns_DString urlDs, baseDs; ! char *proto, *host, *port, *path, *tail; ! char *bproto, *bhost, *bport, *bpath, *btail; ! int status = NS_OK; /* *************** *** 308,330 **** */ ! url = ns_strdup(url); ! base = ns_strdup(base); ! Ns_ParseUrl(url, &protocol, &host, &port, &path, &tail); ! Ns_ParseUrl(base, &baseprotocol, &basehost, &baseport, &basepath, &basetail); ! if (baseprotocol == NULL || basehost == NULL || basepath == NULL) { status = NS_ERROR; goto done; } ! if (protocol == NULL) { ! protocol = baseprotocol; } if (host == NULL) { ! host = basehost; ! port = baseport; } if (path == NULL) { ! path = basepath; } ! Ns_DStringVarAppend(dsPtr, protocol, "://", host, NULL); if (port != NULL) { Ns_DStringVarAppend(dsPtr, ":", port, NULL); --- 313,339 ---- */ ! Ns_DStringInit(&urlDs); ! Ns_DStringAppend(&urlDs, url); ! Ns_ParseUrl(urlDs.string, &proto, &host, &port, &path, &tail); ! ! Ns_DStringInit(&baseDs); ! Ns_DStringAppend(&baseDs, base); ! Ns_ParseUrl(baseDs.string, &bproto, &bhost, &bport, &bpath, &btail); ! ! if (bproto == NULL || bhost == NULL || bpath == NULL) { status = NS_ERROR; goto done; } ! if (proto == NULL) { ! proto = bproto; } if (host == NULL) { ! host = bhost; ! port = bport; } if (path == NULL) { ! path = bpath; } ! Ns_DStringVarAppend(dsPtr, proto, "://", host, NULL); if (port != NULL) { Ns_DStringVarAppend(dsPtr, ":", port, NULL); *************** *** 336,341 **** } done: ! ns_free(url); ! ns_free(base); return status; } --- 345,351 ---- } done: ! Ns_DStringFree(&urlDs); ! Ns_DStringFree(&baseDs); ! return status; } Index: op.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/op.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** op.c 2 Oct 2005 05:27:44 -0000 1.4 --- op.c 2 Oct 2005 22:23:10 -0000 1.5 *************** *** 110,115 **** void ! Ns_RegisterRequest(char *server, char *method, char *url, Ns_OpProc *proc, ! Ns_Callback *delete, void *arg, int flags) { Req *reqPtr; --- 110,115 ---- void ! Ns_RegisterRequest(CONST char *server, CONST char *method, CONST char *url, ! Ns_OpProc *proc, Ns_Callback *delete, void *arg, int flags) { Req *reqPtr; *************** *** 145,150 **** void ! Ns_GetRequest(char *server, char *method, char *url, Ns_OpProc **procPtr, ! Ns_Callback **deletePtr, void **argPtr, int *flagsPtr) { Req *reqPtr; --- 145,150 ---- void ! Ns_GetRequest(CONST char *server, CONST char *method, CONST char *url, ! Ns_OpProc **procPtr, Ns_Callback **deletePtr, void **argPtr, int *flagsPtr) { Req *reqPtr; *************** *** 185,189 **** void ! Ns_UnRegisterRequest(char *server, char *method, char *url, int inherit) { Ns_MutexLock(&ulock); --- 185,190 ---- void ! Ns_UnRegisterRequest(CONST char *server, CONST char *method, CONST char *url, ! int inherit) { Ns_MutexLock(&ulock); *************** *** 261,265 **** int ! Ns_ConnRedirect(Ns_Conn *conn, char *url) { int status; --- 262,266 ---- int ! Ns_ConnRedirect(Ns_Conn *conn, CONST char *url) { int status; *************** *** 316,320 **** void ! Ns_RegisterProxyRequest(char *server, char *method, char *protocol, Ns_OpProc *proc, Ns_Callback *delete, void *arg) { --- 317,321 ---- void ! Ns_RegisterProxyRequest(CONST char *server, CONST char *method, CONST char *protocol, Ns_OpProc *proc, Ns_Callback *delete, void *arg) { *************** *** 367,371 **** void ! Ns_UnRegisterProxyRequest(char *server, char *method, char *protocol) { NsServer *servPtr; --- 368,373 ---- void ! Ns_UnRegisterProxyRequest(CONST char *server, CONST char *method, ! CONST char *protocol) { NsServer *servPtr; *************** *** 510,514 **** void ! NsGetRequestProcs(Tcl_DString *dsPtr, char *server) { NsServer *servPtr; --- 512,516 ---- void ! NsGetRequestProcs(Tcl_DString *dsPtr, CONST char *server) { NsServer *servPtr; Index: fastpath.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/fastpath.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** fastpath.c 19 Aug 2005 08:20:27 -0000 1.19 --- fastpath.c 2 Oct 2005 22:23:09 -0000 1.20 *************** *** 76,85 **** static Ns_Callback FreeEntry; static void DecrEntry(File *); ! static int UrlIs(char *server, char *url, int dir); ! static int FastStat(char *file, struct stat *stPtr); static int FastReturn(NsServer *servPtr, Ns_Conn *conn, int status, ! char *type, char *file, struct stat *stPtr); static int ParseRange(Ns_Conn *conn, Range *rnPtr); ! static int ReturnRange(Ns_Conn *conn, Range *rnPtr, int fd, char *data, int len, char *type); /* --- 76,87 ---- static Ns_Callback FreeEntry; static void DecrEntry(File *); ! static int UrlIs(CONST char *server, CONST char *url, int dir); ! static int FastStat(CONST char *file, struct stat *stPtr); static int FastReturn(NsServer *servPtr, Ns_Conn *conn, int status, ! CONST char *type, CONST char *file, struct stat *stPtr); ! static int FastGetRestart(Ns_Conn *conn, CONST char *page); static int ParseRange(Ns_Conn *conn, Range *rnPtr); ! static int ReturnRange(Ns_Conn *conn, Range *rnPtr, int fd, CONST char *data, ! int len, CONST char *type); /* *************** *** 99,103 **** Ns_Cache * ! NsFastpathCache(char *server, int size) { Ns_DString ds; --- 101,105 ---- Ns_Cache * ! NsFastpathCache(CONST char *server, int size) { Ns_DString ds; *************** *** 136,140 **** int ! Ns_ConnReturnFile(Ns_Conn *conn, int status, char *type, char *file) { struct stat st; --- 138,142 ---- int ! Ns_ConnReturnFile(Ns_Conn *conn, int status, CONST char *type, CONST char *file) { struct stat st; *************** *** 169,174 **** */ ! char * ! Ns_PageRoot(char *server) { NsServer *servPtr = NsGetServer(server); --- 171,176 ---- */ ! CONST char * ! Ns_PageRoot(CONST char *server) { NsServer *servPtr = NsGetServer(server); *************** *** 198,202 **** void ! Ns_SetUrlToFileProc(char *server, Ns_UrlToFileProc *procPtr) { NsServer *servPtr = NsGetServer(server); --- 200,204 ---- void ! Ns_SetUrlToFileProc(CONST char *server, Ns_UrlToFileProc *procPtr) { NsServer *servPtr = NsGetServer(server); *************** *** 223,227 **** int ! Ns_UrlToFile(Ns_DString *dsPtr, char *server, char *url) { NsServer *servPtr = NsGetServer(server); --- 225,229 ---- int ! Ns_UrlToFile(Ns_DString *dsPtr, CONST char *server, CONST char *url) { NsServer *servPtr = NsGetServer(server); *************** *** 247,251 **** int ! Ns_UrlIsFile(char *server, char *url) { return UrlIs(server, url, 0); --- 249,253 ---- int ! Ns_UrlIsFile(CONST char *server, CONST char *url) { return UrlIs(server, url, 0); *************** *** 253,257 **** int ! Ns_UrlIsDir(char *server, char *url) { return UrlIs(server, url, 1); --- 255,259 ---- int ! Ns_UrlIsDir(CONST char *server, CONST char *url) { return UrlIs(server, url, 1); *************** *** 259,263 **** static int ! UrlIs(char *server, char *url, int dir) { Ns_DString ds; --- 261,265 ---- static int ! UrlIs(CONST char *server, CONST char *url, int dir) { Ns_DString ds; *************** *** 294,298 **** static int ! FastGetRestart(Ns_Conn *conn, char *page) { int status; --- 296,300 ---- static int ! FastGetRestart(Ns_Conn *conn, CONST char *page) { int status; *************** *** 458,462 **** static int ! FastStat(char *file, struct stat *stPtr) { if (stat(file, stPtr) != 0) { --- 460,464 ---- static int ! FastStat(CONST char *file, struct stat *stPtr) { if (stat(file, stPtr) != 0) { *************** *** 490,494 **** static int FastReturn(NsServer *servPtr, Ns_Conn *conn, int status, ! char *type, char *file, struct stat *stPtr) { int fd, new, nread; --- 492,496 ---- static int FastReturn(NsServer *servPtr, Ns_Conn *conn, int status, ! CONST char *type, CONST char *file, struct stat *stPtr) { int fd, new, nread; *************** *** 663,667 **** int ! NsUrlToFile(Ns_DString *dsPtr, NsServer *servPtr, char *url) { int status; --- 665,669 ---- int ! NsUrlToFile(Ns_DString *dsPtr, NsServer *servPtr, CONST char *url) { int status; *************** *** 852,856 **** static int ! ReturnRange(Ns_Conn *conn, Range *rnPtr, int fd, char *data, int len, char *type) { struct iovec bufs[MAX_RANGES*3], *iovPtr = bufs; --- 854,859 ---- static int ! ReturnRange(Ns_Conn *conn, Range *rnPtr, int fd, CONST char *data, int len, ! CONST char *type) { struct iovec bufs[MAX_RANGES*3], *iovPtr = bufs; *************** *** 882,886 **** Ns_ConnSetRequiredHeaders(conn, type, rnPtr->offsets[0].size); Ns_ConnQueueHeaders(conn, rnPtr->status); ! iovPtr->iov_base = data + rnPtr->offsets[0].start; iovPtr->iov_len = rnPtr->offsets[0].size; result = Ns_ConnSend(conn, iovPtr, 1); --- 885,889 ---- Ns_ConnSetRequiredHeaders(conn, type, rnPtr->offsets[0].size); Ns_ConnQueueHeaders(conn, rnPtr->status); ! iovPtr->iov_base = (char *) data + rnPtr->offsets[0].start; iovPtr->iov_len = rnPtr->offsets[0].size; result = Ns_ConnSend(conn, iovPtr, 1); *************** *** 922,926 **** iovPtr++; ! iovPtr->iov_base = data + rnPtr->offsets[i].start; iovPtr->iov_len = rnPtr->offsets[i].size; rnPtr->size += iovPtr->iov_len; --- 925,929 ---- iovPtr++; ! iovPtr->iov_base = (char *) data + rnPtr->offsets[i].start; iovPtr->iov_len = rnPtr->offsets[i].size; rnPtr->size += iovPtr->iov_len; Index: return.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/return.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** return.c 2 Oct 2005 05:27:44 -0000 1.15 --- return.c 2 Oct 2005 22:23:10 -0000 1.16 *************** *** 50,57 **** static int ReturnRedirect(Ns_Conn *conn, int status, int *resultPtr); ! static int ReturnOpen(Ns_Conn *conn, int status, char *type, Tcl_Channel chan, FILE *fp, int fd, int len); ! static int ReturnCharData(Ns_Conn *conn, int status, char *data, int len, ! char *type, int sendRaw); /* --- 50,57 ---- static int ReturnRedirect(Ns_Conn *conn, int status, int *resultPtr); ! static int ReturnOpen(Ns_Conn *conn, int status, CONST char *type, Tcl_Channel chan, FILE *fp, int fd, int len); ! static int ReturnCharData(Ns_Conn *conn, int status, CONST char *data, int len, ! CONST char *type, int sendRaw); /* *************** *** 60,65 **** static struct { ! int status; ! char *reason; } reasons[] = { {100, "Continue"}, --- 60,65 ---- static struct { ! int status; ! CONST char... [truncated message content] |