You can subscribe to this list here.
2005 |
Jan
|
Feb
(32) |
Mar
(56) |
Apr
(92) |
May
(39) |
Jun
(226) |
Jul
(98) |
Aug
(66) |
Sep
|
Oct
(153) |
Nov
(43) |
Dec
(42) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(97) |
Feb
(141) |
Mar
(147) |
Apr
(80) |
May
(51) |
Jun
(93) |
Jul
(88) |
Aug
(50) |
Sep
(179) |
Oct
(48) |
Nov
(82) |
Dec
(71) |
2007 |
Jan
(42) |
Feb
(46) |
Mar
(123) |
Apr
(21) |
May
(139) |
Jun
(59) |
Jul
(34) |
Aug
(57) |
Sep
(47) |
Oct
(137) |
Nov
(49) |
Dec
(12) |
2008 |
Jan
(10) |
Feb
(8) |
Mar
(63) |
Apr
(17) |
May
(34) |
Jun
(38) |
Jul
(16) |
Aug
(62) |
Sep
(9) |
Oct
(121) |
Nov
(38) |
Dec
(4) |
2009 |
Jan
|
Feb
(11) |
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(4) |
Apr
(10) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(12) |
2012 |
Jan
(26) |
Feb
(1) |
Mar
(15) |
Apr
(1) |
May
(1) |
Jun
(7) |
Jul
(2) |
Aug
|
Sep
(1) |
Oct
(52) |
Nov
(8) |
Dec
(25) |
2013 |
Jan
(35) |
Feb
(14) |
Mar
(10) |
Apr
(10) |
May
(29) |
Jun
(16) |
Jul
(5) |
Aug
(8) |
Sep
(8) |
Oct
(6) |
Nov
(1) |
Dec
(3) |
2014 |
Jan
(16) |
Feb
(13) |
Mar
(5) |
Apr
(9) |
May
(21) |
Jun
(6) |
Jul
(5) |
Aug
(2) |
Sep
(59) |
Oct
(115) |
Nov
(122) |
Dec
(45) |
2015 |
Jan
(31) |
Feb
(32) |
Mar
(19) |
Apr
(25) |
May
(3) |
Jun
(4) |
Jul
(18) |
Aug
(3) |
Sep
(23) |
Oct
(11) |
Nov
(17) |
Dec
(12) |
2016 |
Jan
(20) |
Feb
(27) |
Mar
(20) |
Apr
(40) |
May
(35) |
Jun
(48) |
Jul
(44) |
Aug
(51) |
Sep
(18) |
Oct
(42) |
Nov
(39) |
Dec
(29) |
2017 |
Jan
(37) |
Feb
(34) |
Mar
(20) |
Apr
(37) |
May
(10) |
Jun
(2) |
Jul
(14) |
Aug
(15) |
Sep
(25) |
Oct
(29) |
Nov
(15) |
Dec
(29) |
2018 |
Jan
(5) |
Feb
(15) |
Mar
(6) |
Apr
(20) |
May
(39) |
Jun
(39) |
Jul
(17) |
Aug
(20) |
Sep
(10) |
Oct
(17) |
Nov
(20) |
Dec
(8) |
2019 |
Jan
(28) |
Feb
(21) |
Mar
(13) |
Apr
(44) |
May
(44) |
Jun
(28) |
Jul
(51) |
Aug
(30) |
Sep
(7) |
Oct
(20) |
Nov
(8) |
Dec
(21) |
2020 |
Jan
(27) |
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vlad S. <ser...@us...> - 2005-03-05 23:28:35
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1286/nsd Modified Files: conn.c Log Message: Add Ns_ConnSetResponseStatus command to be able to se response status without touching headers. Also ns_conn status has been extended with ability to set response status if third argument is provided. ns_conn status ?newStatus? Index: conn.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/conn.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** conn.c 16 Feb 2005 08:39:44 -0000 1.1.1.1 --- conn.c 5 Mar 2005 23:28:25 -0000 1.2 *************** *** 234,237 **** --- 234,262 ---- } + /* + *---------------------------------------------------------------------- + * + * Ns_ConnSetResponseStatus -- + * + * Set the HTTP reponse code that will be sent + * + * Results: + * Previous response status as an integer response code (e.g., 200 for OK) + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + int + Ns_ConnSetResponseStatus(Ns_Conn *conn, int new_status) + { + Conn *connPtr = (Conn *) conn; + + connPtr->responseStatus = new_status; + return new_status; + } + /* *************** *** 809,813 **** FormFile *filePtr; int idx, off, len; - int write_encoded_flag; static CONST char *opts[] = { --- 834,837 ---- *************** *** 1040,1044 **** case CWriteEncodedIdx: if (objc > 2) { ! if (Tcl_GetIntFromObj(interp, objv[2], &write_encoded_flag) != TCL_OK) { Tcl_AppendResult(interp, "Invalid write-encoded flag", NULL ); --- 1064,1069 ---- case CWriteEncodedIdx: if (objc > 2) { ! int write_encoded_flag; ! if (Tcl_GetIntFromObj(interp, objv[2], &write_encoded_flag) != TCL_OK) { Tcl_AppendResult(interp, "Invalid write-encoded flag", NULL ); *************** *** 1103,1106 **** --- 1128,1139 ---- case CStatusIdx: + if (objc > 2) { + int new_status; + if (Tcl_GetIntFromObj(interp, objv[2], &new_status) != TCL_OK) { + Tcl_AppendResult(interp, "Invalid response status code", NULL ); + return TCL_ERROR; + } + Ns_ConnSetResponseStatus(conn, new_status); + } Tcl_SetIntObj(result, Ns_ConnResponseStatus(conn)); break; |
From: Vlad S. <ser...@us...> - 2005-03-05 23:28:35
|
Update of /cvsroot/naviserver/naviserver/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1286/doc Modified Files: Ns_Conn.3 Log Message: Add Ns_ConnSetResponseStatus command to be able to se response status without touching headers. Also ns_conn status has been extended with ability to set response status if third argument is provided. ns_conn status ?newStatus? Index: Ns_Conn.3 =================================================================== RCS file: /cvsroot/naviserver/naviserver/doc/Ns_Conn.3,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Ns_Conn.3 16 Feb 2005 08:39:18 -0000 1.1.1.1 --- Ns_Conn.3 5 Mar 2005 23:28:24 -0000 1.2 *************** *** 81,84 **** --- 81,86 ---- \fBNs_ConnResponseStatus\fR(\fIarg, arg\fR) .sp + \fBNs_ConnSetResponseStatus\fR(\fIarg, arg\fR) + .sp \fBNs_ConnServer\fR(\fIarg, arg\fR) .sp |
From: Vlad S. <ser...@us...> - 2005-03-05 23:28:35
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1286/include Modified Files: ns.h Log Message: Add Ns_ConnSetResponseStatus command to be able to se response status without touching headers. Also ns_conn status has been extended with ability to set response status if third argument is provided. ns_conn status ?newStatus? Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ns.h 28 Feb 2005 05:04:16 -0000 1.6 --- ns.h 5 Mar 2005 23:28:24 -0000 1.7 *************** *** 626,629 **** --- 626,630 ---- NS_EXTERN char *Ns_ConnServer(Ns_Conn *conn); NS_EXTERN int Ns_ConnResponseStatus(Ns_Conn *conn); + NS_EXTERN int Ns_ConnSetResponseStatus(Ns_Conn *conn, int new_status); NS_EXTERN int Ns_ConnContentSent(Ns_Conn *conn); NS_EXTERN int Ns_ConnResponseLength(Ns_Conn *conn); |
From: Vlad S. <ser...@us...> - 2005-03-05 23:28:33
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1286 Modified Files: ChangeLog Log Message: Add Ns_ConnSetResponseStatus command to be able to se response status without touching headers. Also ns_conn status has been extended with ability to set response status if third argument is provided. ns_conn status ?newStatus? Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ChangeLog 4 Mar 2005 09:24:14 -0000 1.12 --- ChangeLog 5 Mar 2005 23:28:23 -0000 1.13 *************** *** 1,2 **** --- 1,12 ---- + 2005-03-05 Vlad Seryakov <vl...@cr...> + + * nsd/conn.c include/ns.h Add Ns_ConnSetResponseStatus command to + be able to se response status without touching headers. Also + ns_conn status has been extended with ability to set response + status if third argument is provided. ns_conn status ?newStatus? + + * nslog/nslog.c: changed syntax to conform naviserver style, + no functional modifications + 2005-03-04 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-03-04 09:24:29
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1903/nsd Modified Files: tclobjv.c Log Message: Add support for boolean options which take no argument. Truth is determined by presence of the option alone. Index: tclobjv.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclobjv.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tclobjv.c 28 Feb 2005 07:15:06 -0000 1.2 --- tclobjv.c 4 Mar 2005 09:24:14 -0000 1.3 *************** *** 83,87 **** remain = specPtr->proc(specPtr->dest, interp, objc, objv + objvIndex, specPtr->arg); ! if (remain == objc) { break; } --- 83,87 ---- remain = specPtr->proc(specPtr->dest, interp, objc, objv + objvIndex, specPtr->arg); ! if (remain == 0) { break; } *************** *** 132,137 **** *---------------------------------------------------------------------- * ! * Ns_ObjvBool, Ns_ObjvInt, Ns_ObjvLong, Ns_ObjvWideInt, ! * Ns_ObjvDouble -- * * Consume exactly one argument, returning it's value into dest. --- 132,136 ---- *---------------------------------------------------------------------- * ! * Ns_ObjvInt, Ns_ObjvLong, Ns_ObjvWideInt, Ns_ObjvDouble -- * * Consume exactly one argument, returning it's value into dest. *************** *** 148,163 **** int - Ns_ObjvBool(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], - void *arg) - { - if (objc > 0 - && Tcl_GetBooleanFromObj(interp, objv[0], (int *) dest) == TCL_OK) { - return --objc; - } - - return -1; - } - - int Ns_ObjvInt(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) --- 147,150 ---- *************** *** 212,215 **** --- 199,237 ---- *---------------------------------------------------------------------- * + * Ns_ObjvBool -- + * + * If no argument is given, consume the next objv object and attempt + * conversion to a boolean value. If an argument is given it is + * expected to be an int and is placed into dest. + * + * Results: + * -1 on error. Exactly objc if an arg was given, objc-1 otherwise. + * + * Side effects: + * Next Tcl object maybe converted to type specific internal rep. + * + *---------------------------------------------------------------------- + */ + + int + Ns_ObjvBool(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], + void *arg) + { + if (arg) { + *((int *) dest) = ((int) arg); + return objc; + } + if (objc > 0 + && Tcl_GetBooleanFromObj(interp, objv[0], (int *) dest) == TCL_OK) { + return --objc; + } + + return -1; + } + + + /* + *---------------------------------------------------------------------- + * * Ns_ObjvString -- * *************** *** 379,383 **** * * Results: ! * Exactly objc. * * Side effects: --- 401,405 ---- * * Results: ! * Always 0 (zero). * * Side effects: *************** *** 392,396 **** void *arg) { ! return objc; } --- 414,418 ---- void *arg) { ! return 0; } *************** *** 449,452 **** --- 471,476 ---- if (STREQ(specPtr->key, "--")) { Ns_DStringAppend(&ds, "?--? "); + } else if (specPtr->proc == &Ns_ObjvBool && specPtr->arg != NULL) { + Ns_DStringPrintf(&ds, "?%s? ", specPtr->key); } else { p = specPtr->key; |
From: Stephen D. <sd...@us...> - 2005-03-04 09:24:28
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1903 Modified Files: ChangeLog Log Message: Add support for boolean options which take no argument. Truth is determined by presence of the option alone. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ChangeLog 1 Mar 2005 21:39:57 -0000 1.11 --- ChangeLog 4 Mar 2005 09:24:14 -0000 1.12 *************** *** 1,2 **** --- 1,7 ---- + 2005-03-04 Stephen Deasey <sd...@us...> + + * nsd/tclobjv.c: Add support for boolean options which take no + argument. Truth is determined by presence of the option alone. + 2005-03-01 Vlad Seryakov <vl...@cr...> |
From: Vlad S. <ser...@us...> - 2005-03-01 21:40:26
|
Update of /cvsroot/naviserver/naviserver/nslog In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2963/nslog Modified Files: nslog.c Log Message: Added more options to the module and to the command ns_accesslog Index: nslog.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nslog/nslog.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** nslog.c 16 Feb 2005 08:41:00 -0000 1.1.1.1 --- nslog.c 1 Mar 2005 21:39:57 -0000 1.2 *************** *** 1,10 **** /* ! * The contents of this file are subject to the AOLserver Public License ! * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" ! * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. [...1216 lines suppressed...] ! logPtr->extheaders = ns_calloc((size_t)(i + 1), sizeof *logPtr->extheaders); ! ! logPtr->extheaders[0] = config; ! ! for (i = 1, p = config; *p; p++) { ! if (*p == ',') { ! *p = '\000'; ! logPtr->extheaders[i++] = p + 1; ! } ! } ! ! logPtr->extheaders[i] = NULL; ! } - --- 736,739 ---- LogRollCallback(void *arg) { ! LogCallback(LogRoll,arg,"roll"); } |
From: Vlad S. <ser...@us...> - 2005-03-01 21:40:26
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2963 Modified Files: ChangeLog Log Message: Added more options to the module and to the command ns_accesslog Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ChangeLog 28 Feb 2005 07:15:05 -0000 1.10 --- ChangeLog 1 Mar 2005 21:39:57 -0000 1.11 *************** *** 1,2 **** --- 1,8 ---- + 2005-03-01 Vlad Seryakov <vl...@cr...> + + * nslog/nslog.c: redone options support for the module + using flags, added commands to ns_accesslog to change flags and/or + extended headers on the fly + 2005-02-27 Stephen Deasey <sd...@us...> |
From: Stephen D. <sd...@us...> - 2005-02-28 07:15:18
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29567 Modified Files: ChangeLog Log Message: Short circuit option processing when "--" is found. Accurately describe optional arguments as optional in error messages. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ChangeLog 28 Feb 2005 05:04:15 -0000 1.9 --- ChangeLog 28 Feb 2005 07:15:05 -0000 1.10 *************** *** 1,4 **** --- 1,7 ---- 2005-02-27 Stephen Deasey <sd...@us...> + * nsd/tclobjv.c: Short circuit option processing when "--" is found. + Accurately describe optional arguments as optional in error messages. + * include/ns.h: * nsd/form.c: |
From: Stephen D. <sd...@us...> - 2005-02-28 07:15:17
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29567/nsd Modified Files: tclobjv.c Log Message: Short circuit option processing when "--" is found. Accurately describe optional arguments as optional in error messages. Index: tclobjv.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclobjv.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tclobjv.c 26 Feb 2005 17:15:52 -0000 1.1 --- tclobjv.c 28 Feb 2005 07:15:06 -0000 1.2 *************** *** 83,86 **** --- 83,89 ---- remain = specPtr->proc(specPtr->dest, interp, objc, objv + objvIndex, specPtr->arg); + if (remain == objc) { + break; + } if (remain < 0 || remain > objc) { return NS_ERROR; *************** *** 455,459 **** } for (specPtr = argSpec; specPtr->key != NULL; ++specPtr) { ! Ns_DStringVarAppend(&ds, specPtr->key, " ", NULL); } Tcl_WrongNumArgs(interp, objc, objv, ds.string); --- 458,463 ---- } for (specPtr = argSpec; specPtr->key != NULL; ++specPtr) { ! Ns_DStringPrintf(&ds, "%s%s ", specPtr->key, ! (*specPtr->key == '?') ? "?" : ""); } Tcl_WrongNumArgs(interp, objc, objv, ds.string); |
From: Stephen D. <sd...@us...> - 2005-02-28 05:04:27
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31361/nsd Modified Files: form.c request.c urlencode.c Log Message: Decode + and other characters in URL paths correctly. Fixes bug #1145277. Index: request.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/request.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** request.c 16 Feb 2005 08:39:55 -0000 1.1.1.1 --- request.c 28 Feb 2005 05:04:17 -0000 1.2 *************** *** 365,369 **** */ ! p = Ns_DecodeUrlCharset(&ds1, url, NULL); if (p == NULL) { p = url; --- 365,369 ---- */ ! p = Ns_UrlPathDecode(&ds1, url, Ns_GetUrlEncoding(NULL)); if (p == NULL) { p = url; Index: form.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/form.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** form.c 16 Feb 2005 08:39:52 -0000 1.1.1.1 --- form.c 28 Feb 2005 05:04:16 -0000 1.2 *************** *** 251,258 **** } Ns_DStringTrunc(&kds, 0); ! k = Ns_DecodeUrlWithEncoding(&kds, k, encoding); if (v != NULL) { Ns_DStringTrunc(&vds, 0); ! Ns_DecodeUrlWithEncoding(&vds, v+1, encoding); *v = '='; v = vds.string; --- 251,258 ---- } Ns_DStringTrunc(&kds, 0); ! k = Ns_UrlQueryDecode(&kds, k, encoding); if (v != NULL) { Ns_DStringTrunc(&vds, 0); ! Ns_UrlQueryDecode(&vds, v+1, encoding); *v = '='; v = vds.string; Index: urlencode.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/urlencode.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** urlencode.c 16 Feb 2005 08:40:02 -0000 1.1.1.1 --- urlencode.c 28 Feb 2005 05:04:17 -0000 1.2 *************** *** 32,36 **** * urlencode.c -- * ! * Encode and decode URLs, as described in RFC 1738. */ --- 32,36 ---- * urlencode.c -- * ! * Encode and decode URLs, as described in RFC 1738. */ *************** *** 41,57 **** ! ! static Tcl_Encoding GetUrlEncoding(char *charset); /* ! * The following table is used for URL encoding and decoding ! * all 256 characters. */ ! struct { int hex; /* Valid hex value or -1. */ int len; /* Length required to encode string. */ char *str; /* String for multibyte encoded character. */ ! } enc[] = { {-1, 3, "00"}, {-1, 3, "01"}, {-1, 3, "02"}, {-1, 3, "03"}, {-1, 3, "04"}, {-1, 3, "05"}, {-1, 3, "06"}, {-1, 3, "07"}, --- 41,78 ---- ! static char *UrlEncode(Ns_DString *dsPtr, char *string, ! Tcl_Encoding encoding, int part); ! static char *UrlDecode(Ns_DString *dsPtr, char *string, ! Tcl_Encoding encoding, int part); /* ! * The following structure defines the encoding attributes ! * of a byte. */ ! typedef struct ByteKey { int hex; /* Valid hex value or -1. */ int len; /* Length required to encode string. */ char *str; /* String for multibyte encoded character. */ ! } ByteKey; ! ! /* ! * The following table is used for encoding and decoding the ! * segments of a URI query component. ! * ! * All ASCII control characters (00-1f and 7f) and the URI ! * 'delim' and 'unwise' characters are encoded. In addition, the ! * following URI query component reserved characters are also ! * encoded: ! * ! * $ & + , / : ; = ? @ ! * ! * The ASCII space character receives special treatment and is ! * encoded as +. This is handled by the encoding/decoding ! * routines and is not represented in the table below. ! * ! */ ! ! static ByteKey queryenc[] = { {-1, 3, "00"}, {-1, 3, "01"}, {-1, 3, "02"}, {-1, 3, "03"}, {-1, 3, "04"}, {-1, 3, "05"}, {-1, 3, "06"}, {-1, 3, "07"}, *************** *** 62,69 **** {-1, 3, "18"}, {-1, 3, "19"}, {-1, 3, "1a"}, {-1, 3, "1b"}, {-1, 3, "1c"}, {-1, 3, "1d"}, {-1, 3, "1e"}, {-1, 3, "1f"}, ! {-1, 1, NULL}, {-1, 3, "21"}, {-1, 3, "22"}, {-1, 3, "23"}, ! {-1, 3, "24"}, {-1, 3, "25"}, {-1, 3, "26"}, {-1, 3, "27"}, ! {-1, 3, "28"}, {-1, 3, "29"}, {-1, 3, "2a"}, {-1, 3, "2b"}, ! {-1, 3, "2c"}, {-1, 3, "2d"}, {-1, 3, "2e"}, {-1, 3, "2f"}, { 0, 1, NULL}, { 1, 1, NULL}, { 2, 1, NULL}, { 3, 1, NULL}, { 4, 1, NULL}, { 5, 1, NULL}, { 6, 1, NULL}, { 7, 1, NULL}, --- 83,90 ---- {-1, 3, "18"}, {-1, 3, "19"}, {-1, 3, "1a"}, {-1, 3, "1b"}, {-1, 3, "1c"}, {-1, 3, "1d"}, {-1, 3, "1e"}, {-1, 3, "1f"}, ! {-1, 1, "20"}, {-1, 1, NULL}, {-1, 3, "22"}, {-1, 3, "23"}, ! {-1, 3, "24"}, {-1, 3, "25"}, {-1, 3, "26"}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 3, "2b"}, ! {-1, 3, "2c"}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 3, "2f"}, { 0, 1, NULL}, { 1, 1, NULL}, { 2, 1, NULL}, { 3, 1, NULL}, { 4, 1, NULL}, { 5, 1, NULL}, { 6, 1, NULL}, { 7, 1, NULL}, *************** *** 77,81 **** {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 3, "5b"}, ! {-1, 3, "5c"}, {-1, 3, "5d"}, {-1, 3, "5e"}, {-1, 3, "5f"}, {-1, 3, "60"}, {10, 1, NULL}, {11, 1, NULL}, {12, 1, NULL}, {13, 1, NULL}, {14, 1, NULL}, {15, 1, NULL}, {-1, 1, NULL}, --- 98,102 ---- {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 3, "5b"}, ! {-1, 3, "5c"}, {-1, 3, "5d"}, {-1, 3, "5e"}, {-1, 1, NULL}, {-1, 3, "60"}, {10, 1, NULL}, {11, 1, NULL}, {12, 1, NULL}, {13, 1, NULL}, {14, 1, NULL}, {15, 1, NULL}, {-1, 1, NULL}, *************** *** 85,89 **** {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 3, "7b"}, ! {-1, 3, "7c"}, {-1, 3, "7d"}, {-1, 3, "7e"}, {-1, 3, "7f"}, {-1, 3, "80"}, {-1, 3, "81"}, {-1, 3, "82"}, {-1, 3, "83"}, {-1, 3, "84"}, {-1, 3, "85"}, {-1, 3, "86"}, {-1, 3, "87"}, --- 106,189 ---- {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 3, "7b"}, ! {-1, 3, "7c"}, {-1, 3, "7d"}, {-1, 1, NULL}, {-1, 3, "7f"}, ! {-1, 3, "80"}, {-1, 3, "81"}, {-1, 3, "82"}, {-1, 3, "83"}, ! {-1, 3, "84"}, {-1, 3, "85"}, {-1, 3, "86"}, {-1, 3, "87"}, ! {-1, 3, "88"}, {-1, 3, "89"}, {-1, 3, "8a"}, {-1, 3, "8b"}, ! {-1, 3, "8c"}, {-1, 3, "8d"}, {-1, 3, "8e"}, {-1, 3, "8f"}, ! {-1, 3, "90"}, {-1, 3, "91"}, {-1, 3, "92"}, {-1, 3, "93"}, ! {-1, 3, "94"}, {-1, 3, "95"}, {-1, 3, "96"}, {-1, 3, "97"}, ! {-1, 3, "98"}, {-1, 3, "99"}, {-1, 3, "9a"}, {-1, 3, "9b"}, ! {-1, 3, "9c"}, {-1, 3, "9d"}, {-1, 3, "9e"}, {-1, 3, "9f"}, ! {-1, 3, "a0"}, {-1, 3, "a1"}, {-1, 3, "a2"}, {-1, 3, "a3"}, ! {-1, 3, "a4"}, {-1, 3, "a5"}, {-1, 3, "a6"}, {-1, 3, "a7"}, ! {-1, 3, "a8"}, {-1, 3, "a9"}, {-1, 3, "aa"}, {-1, 3, "ab"}, ! {-1, 3, "ac"}, {-1, 3, "ad"}, {-1, 3, "ae"}, {-1, 3, "af"}, ! {-1, 3, "b0"}, {-1, 3, "b1"}, {-1, 3, "b2"}, {-1, 3, "b3"}, ! {-1, 3, "b4"}, {-1, 3, "b5"}, {-1, 3, "b6"}, {-1, 3, "b7"}, ! {-1, 3, "b8"}, {-1, 3, "b9"}, {-1, 3, "ba"}, {-1, 3, "bb"}, ! {-1, 3, "bc"}, {-1, 3, "bd"}, {-1, 3, "be"}, {-1, 3, "bf"}, ! {-1, 3, "c0"}, {-1, 3, "c1"}, {-1, 3, "c2"}, {-1, 3, "c3"}, ! {-1, 3, "c4"}, {-1, 3, "c5"}, {-1, 3, "c6"}, {-1, 3, "c7"}, ! {-1, 3, "c8"}, {-1, 3, "c9"}, {-1, 3, "ca"}, {-1, 3, "cb"}, ! {-1, 3, "cc"}, {-1, 3, "cd"}, {-1, 3, "ce"}, {-1, 3, "cf"}, ! {-1, 3, "d0"}, {-1, 3, "d1"}, {-1, 3, "d2"}, {-1, 3, "d3"}, ! {-1, 3, "d4"}, {-1, 3, "d5"}, {-1, 3, "d6"}, {-1, 3, "d7"}, ! {-1, 3, "d8"}, {-1, 3, "d9"}, {-1, 3, "da"}, {-1, 3, "db"}, ! {-1, 3, "dc"}, {-1, 3, "dd"}, {-1, 3, "de"}, {-1, 3, "df"}, ! {-1, 3, "e0"}, {-1, 3, "e1"}, {-1, 3, "e2"}, {-1, 3, "e3"}, ! {-1, 3, "e4"}, {-1, 3, "e5"}, {-1, 3, "e6"}, {-1, 3, "e7"}, ! {-1, 3, "e8"}, {-1, 3, "e9"}, {-1, 3, "ea"}, {-1, 3, "eb"}, ! {-1, 3, "ec"}, {-1, 3, "ed"}, {-1, 3, "ee"}, {-1, 3, "ef"}, ! {-1, 3, "f0"}, {-1, 3, "f1"}, {-1, 3, "f2"}, {-1, 3, "f3"}, ! {-1, 3, "f4"}, {-1, 3, "f5"}, {-1, 3, "f6"}, {-1, 3, "f7"}, ! {-1, 3, "f8"}, {-1, 3, "f9"}, {-1, 3, "fa"}, {-1, 3, "fb"}, ! {-1, 3, "fc"}, {-1, 3, "fd"}, {-1, 3, "fe"}, {-1, 3, "ff"} ! }; ! ! /* ! * The following table is used for encoding and decoding the ! * segments of a URI path component. ! * ! * All ASCII control characters (00-1f and 7f) and the URI 'delim' ! * and 'unwise' characters are encoded. In addition, the following ! * URI path component reserved characters are also encoded: ! * ! * / ; = ? ! * ! */ ! ! static ByteKey pathenc[] = { ! {-1, 3, "00"}, {-1, 3, "01"}, {-1, 3, "02"}, {-1, 3, "03"}, ! {-1, 3, "04"}, {-1, 3, "05"}, {-1, 3, "06"}, {-1, 3, "07"}, ! {-1, 3, "08"}, {-1, 3, "09"}, {-1, 3, "0a"}, {-1, 3, "0b"}, ! {-1, 3, "0c"}, {-1, 3, "0d"}, {-1, 3, "0e"}, {-1, 3, "0f"}, ! {-1, 3, "10"}, {-1, 3, "11"}, {-1, 3, "12"}, {-1, 3, "13"}, ! {-1, 3, "14"}, {-1, 3, "15"}, {-1, 3, "16"}, {-1, 3, "17"}, ! {-1, 3, "18"}, {-1, 3, "19"}, {-1, 3, "1a"}, {-1, 3, "1b"}, ! {-1, 3, "1c"}, {-1, 3, "1d"}, {-1, 3, "1e"}, {-1, 3, "1f"}, ! {-1, 3, "20"}, {-1, 1, NULL}, {-1, 3, "22"}, {-1, 3, "23"}, ! {-1, 1, NULL}, {-1, 3, "25"}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 3, "2f"}, ! { 0, 1, NULL}, { 1, 1, NULL}, { 2, 1, NULL}, { 3, 1, NULL}, ! { 4, 1, NULL}, { 5, 1, NULL}, { 6, 1, NULL}, { 7, 1, NULL}, ! { 8, 1, NULL}, { 9, 1, NULL}, {-1, 1, NULL}, {-1, 3, "3b"}, ! {-1, 3, "3c"}, {-1, 3, "3d"}, {-1, 3, "3e"}, {-1, 3, "3f"}, ! {-1, 1, NULL}, {10, 1, NULL}, {11, 1, NULL}, {12, 1, NULL}, ! {13, 1, NULL}, {14, 1, NULL}, {15, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 3, "5b"}, ! {-1, 3, "5c"}, {-1, 3, "5d"}, {-1, 3, "5e"}, {-1, 1, NULL}, ! {-1, 3, "60"}, {10, 1, NULL}, {11, 1, NULL}, {12, 1, NULL}, ! {13, 1, NULL}, {14, 1, NULL}, {15, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, ! {-1, 1, NULL}, {-1, 1, NULL}, {-1, 1, NULL}, {-1, 3, "7b"}, ! {-1, 3, "7c"}, {-1, 3, "7d"}, {-1, 1, NULL}, {-1, 3, "7f"}, {-1, 3, "80"}, {-1, 3, "81"}, {-1, 3, "82"}, {-1, 3, "83"}, {-1, 3, "84"}, {-1, 3, "85"}, {-1, 3, "86"}, {-1, 3, "87"}, *************** *** 124,210 **** *---------------------------------------------------------------------- * ! * Ns_EncodeUrlWithEncoding -- * ! * Take a URL and encode any non-alphanumeric characters into ! * %hexcode * * Results: ! * A pointer to the encoded string (which is part of the ! * passed-in DString's memory) * * Side effects: ! * Encoded URL will be copied to given dstring. * *---------------------------------------------------------------------- */ ! char * ! Ns_EncodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding) { ! register int i, n; ! register char *p, *q; ! Tcl_DString ds; ! ! if (encoding != NULL) { ! ! string = Tcl_UtfToExternalDString(encoding, string, -1, &ds); ! ! } ! ! /* ! * Determine and set the requried dstring length. ! */ ! p = string; ! n = 0; ! while ((i = UCHAR(*p)) != 0) { ! n += enc[i].len; ! ++p; } - i = dsPtr->length; - Ns_DStringSetLength(dsPtr, dsPtr->length + n); /* ! * Copy the result directly to the pre-sized dstring. */ ! q = dsPtr->string + i; ! p = string; ! while ((i = UCHAR(*p)) != 0) { ! if (UCHAR(*p) == ' ') { ! *q++ = '+'; ! } else if (enc[i].str == NULL) { ! *q++ = *p; ! } else { ! *q++ = '%'; ! *q++ = enc[i].str[0]; ! *q++ = enc[i].str[1]; ! } ! ++p; ! } ! ! if (encoding != NULL) { ! Tcl_DStringFree(&ds); } ! return dsPtr->string; } - /* *---------------------------------------------------------------------- * ! * Ns_EncodeUrlCharset -- * ! * Take a URL and encode any non-alphanumeric characters into ! * %hexcode * * Results: ! * A pointer to the encoded string (which is part of the ! * passed-in DString's memory) * * Side effects: ! * Encoded URL will be copied to given dstring. * *---------------------------------------------------------------------- --- 224,289 ---- *---------------------------------------------------------------------- * ! * Ns_GetUrlEncoding -- * ! * Get the encoding to use for Ns_UrlQueryDecode and related ! * routines. The encoding is determined by the following sequence: ! * ! * charset parameter ! * connection->urlEncoding ! * config parameter urlEncoding ! * static default * * Results: ! * A Tcl_Encoding. * * Side effects: ! * None. * *---------------------------------------------------------------------- */ ! Tcl_Encoding ! Ns_GetUrlEncoding(char *charset) { ! Tcl_Encoding encoding = NULL; ! if (charset != NULL) { ! encoding = Ns_GetCharsetEncoding(charset); ! if (encoding == NULL) { ! Ns_Log(Warning, "no encoding found for charset \"%s\"", charset); ! } } /* ! * The conn urlEncoding field is initialized from the config default ! * url encoding. This implements the fallback described above in ! * a single step. */ ! if (encoding == NULL) { ! Conn *connPtr = (Conn *) Ns_GetConn(); ! if (connPtr != NULL) { ! encoding = connPtr->urlEncoding; ! } } ! return encoding; } /* *---------------------------------------------------------------------- * ! * Ns_UrlPathEncode, Ns_UrlPathDecode -- * ! * Encode/decode the given segment of URI path component. ! * If encoding is NULL, UTF8 is assumed. * * Results: ! * A pointer to the dstring's value, containing the transformed ! * path component. * * Side effects: ! * Transformed path component will be copied to given dstring. * *---------------------------------------------------------------------- *************** *** 212,236 **** char * ! Ns_EncodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset) { ! Tcl_Encoding encoding = GetUrlEncoding(charset); ! ! return Ns_EncodeUrlWithEncoding(dsPtr, string, encoding); } /* *---------------------------------------------------------------------- * ! * Ns_DecodeUrlCharset -- * ! * Decode an encoded URL (with %hexcode, etc.). * * Results: ! * A pointer to the dstring's value, containing the decoded ! * URL. * * Side effects: ! * Decoded URL will be copied to given dstring. * *---------------------------------------------------------------------- --- 291,321 ---- char * ! Ns_UrlPathEncode(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding) { ! return UrlEncode(dsPtr, string, encoding, 'p'); ! } + char * + Ns_UrlPathDecode(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding) + { + return UrlDecode(dsPtr, string, encoding, 'p'); } + /* *---------------------------------------------------------------------- * ! * Ns_UrlQueryEncode, Ns_UrlQueryDecode -- * ! * Encode/decode the given segment of URI query component. ! * If encoding is NULL, UTF8 is assumed. * * Results: ! * A pointer to the dstring's value, containing the transformed ! * query string component. * * Side effects: ! * Transformed query string component will be copied to given ! * dstring. * *---------------------------------------------------------------------- *************** *** 238,248 **** char * ! Ns_DecodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset) { ! Tcl_Encoding encoding = GetUrlEncoding(charset); ! ! return Ns_DecodeUrlWithEncoding( dsPtr, string, encoding ); } --- 323,336 ---- char * ! Ns_UrlQueryEncode(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding) { ! return UrlEncode(dsPtr, string, encoding, 'q'); } + char * + Ns_UrlQueryDecode(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding) + { + return UrlDecode(dsPtr, string, encoding, 'q'); + } *************** *** 250,263 **** *---------------------------------------------------------------------- * ! * Ns_DecodeUrlWithEncoding -- * ! * Decode an encoded URL (with %hexcode, etc.). * * Results: ! * A pointer to the dstring's value, containing the decoded ! * URL. * * Side effects: ! * Decoded URL will be copied to given dstring. * *---------------------------------------------------------------------- --- 338,352 ---- *---------------------------------------------------------------------- * ! * Ns_EncodeUrlWithEncoding, Ns_EncodeUrlCharset, ! * Ns_DecodeUrlWithEncoding, Ns_DecodeUrlCharset -- * ! * Deprecated. * * Results: ! * A pointer to the transformed string (which is part of the ! * passed-in DString's memory) * * Side effects: ! * transformed input will be copied to given dstring. * *---------------------------------------------------------------------- *************** *** 265,338 **** char * ! Ns_DecodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding) { ! register int i, j, n; ! register char *p, *q; ! char *copy = NULL; ! int length; ! Tcl_DString ds; ! ! /* ! * Copy the decoded characters directly to the dstring, ! * unless we need to do encoding. ! */ ! length = strlen(string); ! if (encoding != NULL) { ! ! copy = ns_malloc((size_t)(length+1)); ! q = copy; ! ! } else { ! ! /* ! * Expand the dstring to the length of the input ! * string which will be the largest size required. ! */ ! ! i = dsPtr->length; ! Ns_DStringSetLength(dsPtr, i + length); ! q = dsPtr->string + i; ! ! } ! ! p = string; ! n = 0; ! while (UCHAR(*p) != '\0') { ! if (UCHAR(p[0]) == '%' && ! (i = enc[UCHAR(p[1])].hex) >= 0 && ! (j = enc[UCHAR(p[2])].hex) >= 0) { ! *q++ = (unsigned char) ((i << 4) + j); ! p += 3; ! } else if (UCHAR(*p) == '+') { ! *q++ = ' '; ! ++p; ! } else { ! *q++ = *p++; ! } ! ++n; ! } ! /* Ensure our new string is terminated */ ! *q = '\0'; ! if (encoding != NULL) { ! Tcl_ExternalToUtfDString(encoding, copy, n, &ds); ! Ns_DStringAppend(dsPtr, Tcl_DStringValue(&ds)); ! Tcl_DStringFree(&ds); ! if (copy) { ! ns_free(copy); ! } ! } else { ! /* ! * Set the dstring length to the actual size required. ! */ ! Ns_DStringSetLength(dsPtr, n); ! } ! return dsPtr->string; } /* --- 354,385 ---- char * ! Ns_EncodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding) { ! return Ns_UrlQueryEncode(dsPtr, string, encoding); ! } ! char * ! Ns_EncodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset) ! { ! Tcl_Encoding encoding = Ns_GetUrlEncoding(charset); ! return Ns_UrlQueryEncode(dsPtr, string, encoding); ! } ! char * ! Ns_DecodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding) ! { ! return Ns_UrlQueryDecode(dsPtr, string, encoding); ! } ! char * ! Ns_DecodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset) ! { ! Tcl_Encoding encoding = Ns_GetUrlEncoding(charset); ! return Ns_UrlQueryDecode(dsPtr, string, encoding); } + /* *************** *** 341,351 **** * NsUpdateUrlEncode * ! * Initialize UrlEncode structures from config. * * Results: ! * Tcl result. * * Side effects: ! * See docs. * *---------------------------------------------------------------------- --- 388,398 ---- * NsUpdateUrlEncode * ! * Initialize UrlEncode structures from config. * * Results: ! * Tcl result. * * Side effects: ! * See docs. * *---------------------------------------------------------------------- *************** *** 361,365 **** nsconf.encoding.urlEncoding = Ns_GetCharsetEncoding(nsconf.encoding.urlCharset); ! if( nsconf.encoding.urlEncoding == NULL ) { Ns_Log(Warning, "no encoding found for charset \"%s\" from config", --- 408,412 ---- nsconf.encoding.urlEncoding = Ns_GetCharsetEncoding(nsconf.encoding.urlCharset); ! if (nsconf.encoding.urlEncoding == NULL ) { Ns_Log(Warning, "no encoding found for charset \"%s\" from config", *************** *** 375,480 **** *---------------------------------------------------------------------- * ! * NsTclUrlEncodeObjCmd, NsTclUrlDecodeObjCmd -- * ! * Implements ns_urlencode and ns_urldecode. * * Results: ! * Tcl result. * * Side effects: ! * See docs. * *---------------------------------------------------------------------- */ ! static int ! EncodeObjCmd(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int encode) { ! Tcl_DString ds; ! char *charset; ! char *data; ! if (objc == 2) { ! charset = NULL; ! data = Tcl_GetString(objv[1]); ! } else if (objc == 4 && STREQ(Tcl_GetString(objv[1]), "-charset")) { ! charset = Tcl_GetString(objv[2]); ! data = Tcl_GetString(objv[3]); ! } else { ! Tcl_AppendResult(interp, "bad usage: should be \"", ! Tcl_GetString(objv[0]), " ?-charset charset? data\"", ! NULL); return TCL_ERROR; } ! Tcl_DStringInit(&ds); ! if (encode) { ! Ns_EncodeUrlCharset(&ds, data, charset); ! } else { ! Ns_DecodeUrlCharset(&ds, data, charset); } Tcl_DStringResult(interp, &ds); ! Tcl_DStringFree(&ds); return TCL_OK; } int NsTclUrlDecodeObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ! return EncodeObjCmd(interp, objc, objv, 0); } ! int ! NsTclUrlEncodeObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ! return EncodeObjCmd(interp, objc, objv, 1); } /* *---------------------------------------------------------------------- * ! * GetUrlEncoding -- * ! * Get the encoding to use in Ns_EncodeUrl/Ns_DecodeUrl. ! * This function implements a sequence of fallbacks, as follows: ! * actual parameter ! * connection->urlEncoding ! * config parameter urlEncoding ! * static default * * Results: ! * A Tcl_Encoding. * * Side effects: ! * None. * *---------------------------------------------------------------------- */ ! static Tcl_Encoding ! GetUrlEncoding(char *charset) { ! Tcl_Encoding encoding = NULL; - if (charset != NULL) { - encoding = Ns_GetCharsetEncoding(charset); - if (encoding == NULL) { - Ns_Log(Warning, "no encoding found for charset \"%s\"", - charset); - } - } /* ! * The conn urlEncoding field is initialized from the config default ! * url encoding. This implements the fallback described above in ! * a single step. */ ! if (encoding == NULL) { ! Conn *connPtr = (Conn *) Ns_GetConn(); ! if (connPtr != NULL) { ! encoding = connPtr->urlEncoding; ! } } ! return encoding; } --- 422,685 ---- *---------------------------------------------------------------------- * ! * NsTclUrlEncodeObjCmd -- * ! * Encode 1 or more segments of a either a URI path or query ! * component part. If the part is not specified, query is assumed. ! * Segments are joined with a separator according to part. ! * ! * NB: Path component param sections are not supported -- the ';' ! * and '=' characters are encoded. This is a relatively little used ! * feature. * * Results: ! * Tcl result. * * Side effects: ! * None. * *---------------------------------------------------------------------- */ ! int ! NsTclUrlEncodeObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ! Ns_DString ds; ! int i, nargs, part = 'q'; ! Ns_ObjvTable parts[] = { ! {"query", 'q'}, ! {"path", 'p'}, ! {NULL, 0} ! }; ! Ns_ObjvSpec opts[] = { ! {"-part", Ns_ObjvIndex, &part, &parts}, ! {"--", Ns_ObjvBreak, NULL, NULL}, ! {NULL, NULL, NULL, NULL} ! }; ! Ns_ObjvSpec args[] = { ! {"component", Ns_ObjvArgs, &nargs, NULL}, ! {NULL, NULL, NULL, NULL} ! }; ! if (Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) { return TCL_ERROR; } ! Ns_DStringInit(&ds); ! for (i = objc - nargs; i < objc; ++i) { ! UrlEncode(&ds, Tcl_GetString(objv[i]), NULL, part); ! if (i + 1 < objc) { ! if (part == 'q') { ! Ns_DStringNAppend(&ds, "&", 1); ! } else { ! Ns_DStringNAppend(&ds, "/", 1); ! } ! } } Tcl_DStringResult(interp, &ds); ! return TCL_OK; } + + /* + *---------------------------------------------------------------------- + * + * NsTclUrlDecodeObjCmd -- + * + * Decode a component of either a URL path or query. If the part + * is not specified, query is assumed. + * + * Results: + * Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + int NsTclUrlDecodeObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { ! Ns_DString ds; ! char *string; ! int part = 'q'; ! ! Ns_ObjvTable parts[] = { ! {"query", 'q'}, ! {"path", 'p'}, ! {NULL, 0} ! }; ! Ns_ObjvSpec opts[] = { ! {"-part", Ns_ObjvIndex, &part, &parts}, ! {"--", Ns_ObjvBreak, NULL, NULL}, ! {NULL, NULL, NULL, NULL} ! }; ! Ns_ObjvSpec args[] = { ! {"component", Ns_ObjvString, &string, NULL}, ! {NULL, NULL, NULL, NULL} ! }; ! if (Ns_ParseObjv(opts, args, interp, 1, objc, objv) != NS_OK) { ! return TCL_ERROR; ! } ! ! Ns_DStringInit(&ds); ! UrlDecode(&ds, string, NULL, part); ! Tcl_DStringResult(interp, &ds); ! ! return TCL_OK; } ! ! /* ! *---------------------------------------------------------------------- ! * ! * UrlEncode -- ! * ! * Encode the given URL component according to part. ! * ! * Results: ! * A pointer to the encoded string (which is part of the ! * passed-in DString's memory) ! * ! * Side effects: ! * Encoded URL component will be copied to given dstring. ! * ! *---------------------------------------------------------------------- ! */ ! ! static char * ! UrlEncode(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding, int part) { ! register int i, n; ! register char *p, *q; ! Tcl_DString ds; ! ByteKey *enc; ! ! if (encoding != NULL) { ! string = Tcl_UtfToExternalDString(encoding, string, -1, &ds); ! } ! ! /* ! * Determine and set the requried dstring length. ! */ ! ! enc = (part == 'q') ? queryenc : pathenc; ! p = string; ! n = 0; ! while ((i = UCHAR(*p)) != 0) { ! n += enc[i].len; ! ++p; ! } ! i = dsPtr->length; ! Ns_DStringSetLength(dsPtr, dsPtr->length + n); ! ! /* ! * Copy the result directly to the pre-sized dstring. ! */ ! ! q = dsPtr->string + i; ! p = string; ! while ((i = UCHAR(*p)) != 0) { ! if (enc[i].str == NULL) { ! *q++ = *p; ! } else if (*p == ' ' && part == 'q') { ! *q++ = '+'; ! } else { ! *q++ = '%'; ! *q++ = enc[i].str[0]; ! *q++ = enc[i].str[1]; ! } ! ++p; ! } ! ! if (encoding != NULL) { ! Tcl_DStringFree(&ds); ! } ! ! return dsPtr->string; } + /* *---------------------------------------------------------------------- * ! * UrlDecode -- * ! * Decode the given URL component according to part. * * Results: ! * A pointer to the dstring's value, containing the decoded ! * URL. * * Side effects: ! * Decoded URL will be copied to given dstring. * *---------------------------------------------------------------------- */ ! char * ! UrlDecode(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding, int part) { ! register int i, j, n; ! register char *p, *q; ! char *copy = NULL; ! int length; ! Tcl_DString ds; ! ByteKey *enc; /* ! * Copy the decoded characters directly to the dstring, ! * unless we need to do encoding. */ ! length = strlen(string); ! if (encoding != NULL) { ! copy = ns_malloc((size_t)(length+1)); ! q = copy; ! } else { ! /* ! * Expand the dstring to the length of the input ! * string which will be the largest size required. ! */ ! i = dsPtr->length; ! Ns_DStringSetLength(dsPtr, i + length); ! q = dsPtr->string + i; ! } ! ! enc = (part == 'q') ? queryenc : pathenc; ! p = string; ! n = 0; ! while (UCHAR(*p) != '\0') { ! if (UCHAR(p[0]) == '%' && ! (i = enc[UCHAR(p[1])].hex) >= 0 && ! (j = enc[UCHAR(p[2])].hex) >= 0) { ! *q++ = (unsigned char) ((i << 4) + j); ! p += 3; ! } else if (UCHAR(p[0]) == '+' && part == 'q') { ! *q++ = ' '; ! ++p; ! } else { ! *q++ = *p++; ! } ! ++n; ! } ! /* Ensure our new string is terminated */ ! *q = '\0'; + if (encoding != NULL) { + Tcl_ExternalToUtfDString(encoding, copy, n, &ds); + Ns_DStringAppend(dsPtr, Tcl_DStringValue(&ds)); + Tcl_DStringFree(&ds); + if (copy) { + ns_free(copy); + } + } else { + /* + * Set the dstring length to the actual size required. + */ + + Ns_DStringSetLength(dsPtr, n); } ! return dsPtr->string; } |
From: Stephen D. <sd...@us...> - 2005-02-28 05:04:25
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31361/include Modified Files: ns.h Log Message: Decode + and other characters in URL paths correctly. Fixes bug #1145277. Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ns.h 26 Feb 2005 17:18:08 -0000 1.5 --- ns.h 28 Feb 2005 05:04:16 -0000 1.6 *************** *** 1216,1226 **** */ ! NS_EXTERN char *Ns_EncodeUrlWithEncoding(Ns_DString *pds, char *string, Tcl_Encoding encoding); ! NS_EXTERN char *Ns_DecodeUrlWithEncoding(Ns_DString *pds, char *string, Tcl_Encoding encoding); ! NS_EXTERN char *Ns_EncodeUrlCharset(Ns_DString *pds, char *string, char *charset); ! NS_EXTERN char *Ns_DecodeUrlCharset(Ns_DString *pds, char *string, char *charset); --- 1216,1231 ---- */ ! NS_EXTERN Tcl_Encoding Ns_GetUrlEncoding(char *charset); ! NS_EXTERN char *Ns_UrlPathEncode(Ns_DString *dsPtr, char *str, Tcl_Encoding enc); ! NS_EXTERN char *Ns_UrlPathDecode(Ns_DString *dsPtr, char *str, Tcl_Encoding enc); ! NS_EXTERN char *Ns_UrlQueryEncode(Ns_DString *dsPtr, char *str, Tcl_Encoding enc); ! NS_EXTERN char *Ns_UrlQueryDecode(Ns_DString *dsPtr, char *str, Tcl_Encoding enc); ! NS_EXTERN char *Ns_EncodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding); ! NS_EXTERN char *Ns_DecodeUrlWithEncoding(Ns_DString *dsPtr, char *string, Tcl_Encoding encoding); ! NS_EXTERN char *Ns_EncodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset); ! NS_EXTERN char *Ns_DecodeUrlCharset(Ns_DString *dsPtr, char *string, char *charset); |
From: Stephen D. <sd...@us...> - 2005-02-28 05:04:25
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31361 Modified Files: ChangeLog Log Message: Decode + and other characters in URL paths correctly. Fixes bug #1145277. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ChangeLog 28 Feb 2005 04:34:19 -0000 1.8 --- ChangeLog 28 Feb 2005 05:04:15 -0000 1.9 *************** *** 1,4 **** --- 1,10 ---- 2005-02-27 Stephen Deasey <sd...@us...> + * include/ns.h: + * nsd/form.c: + * nsd/request.c: + * nsd/urlencode: Decode + and other characters in URL paths + correctly. Fixes bug #1145277. + * nsd/mimetypes.c: XML mime types changed to application/xml from text/xml, fixes bug #1145927. Added a handful of new mime |
From: Stephen D. <sd...@us...> - 2005-02-28 04:34:32
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24187/nsd Modified Files: mimetypes.c Log Message: XML mime types changed to application/xml from text/xml, fixes bug #1145927. Added a handful of new mime mappings. Index: mimetypes.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/mimetypes.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** mimetypes.c 16 Feb 2005 08:39:35 -0000 1.1.1.1 --- mimetypes.c 28 Feb 2005 04:34:20 -0000 1.2 *************** *** 78,81 **** --- 78,82 ---- */ + { ".323", "text/h323" }, { ".ai", "application/postscript" }, { ".aif", "audio/aiff" }, *************** *** 84,105 **** { ".ani", "application/x-navi-animation" }, { ".art", "image/x-art" }, { ".au", "audio/basic" }, { ".avi", "video/x-msvideo" }, { ".bin", "application/x-macbinary" }, { ".bmp", "image/bmp" }, { ".css", "text/css" }, ! { ".csv", "application/csv" }, { ".dcr", "application/x-director" }, { ".dir", "application/x-director" }, { ".dp", "application/commonground" }, { ".dxr", "application/x-director" }, { ".elm", "text/plain" }, { ".eml", "text/plain" }, { ".exe", "application/octet-stream" }, { ".gbt", "text/plain" }, { ".gif", "image/gif" }, { ".gz", "application/x-compressed" }, { ".hqx", "application/mac-binhex40" }, { ".jfif", "image/jpeg" }, { ".jpe", "image/jpeg" }, { ".jpg", "image/jpeg" }, --- 85,126 ---- { ".ani", "application/x-navi-animation" }, { ".art", "image/x-art" }, + { ".asf", "video/x-ms-asf" }, + { ".asr", "video/x-ms-asf" }, + { ".asx", "video/x-ms-asf" }, + { ".atom", "application/atom+xml" }, { ".au", "audio/basic" }, { ".avi", "video/x-msvideo" }, { ".bin", "application/x-macbinary" }, { ".bmp", "image/bmp" }, + { ".cer", "application/x-x509-ca-cert" }, + { ".class", "application/octet-stream" }, + { ".cpio", "application/x-cpio" }, { ".css", "text/css" }, ! { ".csv", "text/csv" }, { ".dcr", "application/x-director" }, + { ".der", "application/x-x509-ca-cert" }, + { ".dia", "application/x-dia" }, { ".dir", "application/x-director" }, + { ".doc", "application/msword" }, + { ".dot", "application/msword" }, { ".dp", "application/commonground" }, + { ".dtd", "application/xml-dtd" }, { ".dxr", "application/x-director" }, { ".elm", "text/plain" }, { ".eml", "text/plain" }, + { ".eps", "application/postscript" }, { ".exe", "application/octet-stream" }, { ".gbt", "text/plain" }, { ".gif", "image/gif" }, { ".gz", "application/x-compressed" }, + { ".h", "text/plain" }, { ".hqx", "application/mac-binhex40" }, + { ".ico", "image/x-icon" }, + { ".ica", "application/x-ica" }, + { ".ics", "text/calendar" }, + { ".ifb", "text/calendar" }, + { ".jar", "application/x-java-archive" }, { ".jfif", "image/jpeg" }, + { ".jng", "image/x-jng" }, { ".jpe", "image/jpeg" }, { ".jpg", "image/jpeg" }, *************** *** 107,120 **** --- 128,154 ---- { ".js", "application/x-javascript" }, { ".ls", "application/x-javascript" }, + { ".m3u", "audio/x-mpegurl" }, + { ".m4a", "audio/mp4" }, + { ".m4p", "audio/mp4" }, + { ".man", "application/x-troff-man" }, { ".map", "application/x-navimap" }, + { ".mdb", "application/x-msaccess" }, { ".mid", "audio/x-midi" }, { ".midi", "audio/x-midi" }, + { ".mng", "image/x-mng" }, { ".mocha", "application/x-javascript" }, { ".mov", "video/quicktime" }, + { ".mp2", "audio/mpeg" }, + { ".mp3", "audio/mpeg" }, + { ".mp4", "audio/mp4" }, { ".mpe", "video/mpeg" }, { ".mpeg", "video/mpeg" }, { ".mpg", "video/mpeg" }, + { ".mpga", "video/mpeg" }, + { ".mpv2", "video/mpeg" }, + { ".mxu", "video/vnd.mpegurl" }, { ".nvd", "application/x-navidoc" }, { ".nvm", "application/x-navimap" }, + { ".ogg", "application/ogg" }, { ".pbm", "image/x-portable-bitmap" }, { ".pdf", "application/pdf" }, *************** *** 124,138 **** { ".pnm", "image/x-portable-anymap" }, { ".png", "image/png" }, { ".ps", "application/postscript" }, { ".qt", "video/quicktime" }, { ".ra", "audio/x-pn-realaudio" }, { ".ram", "audio/x-pn-realaudio" }, { ".ras", "image/x-cmu-raster" }, { ".rgb", "image/x-rgb" }, ! { ".rtf", "application/rtf" }, { ".sit", "application/x-stuffit" }, { ".snd", "audio/basic" }, { ".sql", "application/x-sql" }, { ".stl", "application/x-navistyle" }, { ".tar", "application/x-tar" }, { ".tcl", "text/plain" }, --- 158,196 ---- { ".pnm", "image/x-portable-anymap" }, { ".png", "image/png" }, + { ".pot", "application/vnd.ms-powerpoint"}, + { ".pps", "application/vnd.ms-powerpoint"}, + { ".ppt", "application/vnd.ms-powerpoint"}, { ".ps", "application/postscript" }, + { ".pub", "application/x-mspubllisher" }, { ".qt", "video/quicktime" }, { ".ra", "audio/x-pn-realaudio" }, { ".ram", "audio/x-pn-realaudio" }, { ".ras", "image/x-cmu-raster" }, + { ".rdf", "application/rdf+xml" }, { ".rgb", "image/x-rgb" }, ! { ".rtf", "text/rtf" }, ! { ".rtx", "text/richtext" }, ! { ".rss", "application/rss+xml" }, { ".sit", "application/x-stuffit" }, + { ".smi", "application/smil" }, + { ".smil", "application/smil" }, { ".snd", "audio/basic" }, + { ".spx", "application/ogg" }, { ".sql", "application/x-sql" }, + { ".stc", "application/vnd.sun.xml.calc.template" }, + { ".std", "application/vnd.sun.xml.draw.template" }, + { ".sti", "application/vnd.sun.xml.impress.template" }, { ".stl", "application/x-navistyle" }, + { ".stm", "text/html" }, + { ".stw", "application/vnd.sun.xml.writer.template" }, + { ".svg", "image/svg+xml" }, + { ".svgz", "image/x-svgz" }, + { ".swf", "application/x-shockwave-flash" }, + { ".sxc", "application/vnd.sun.xml.calc" }, + { ".sxd", "application/vnd.sun.xml.draw" }, + { ".sxg", "application/vnd.sun.xml.writer.global" }, + { ".sxi", "application/vnd.sun.xml.impress" }, + { ".sxm", "application/vnd.sun.xml.math" }, + { ".sxw", "application/vnd.sun.xml.writer" }, { ".tar", "application/x-tar" }, { ".tcl", "text/plain" }, *************** *** 141,151 **** { ".tif", "image/tiff" }, { ".tiff", "image/tiff" }, { ".txt", "text/plain" }, { ".xbm", "image/x-xbitmap" }, { ".xpm", "image/x-xpixmap" }, { ".xht", "application/xhtml+xml"}, { ".xhtml", "application/xhtml+xml"}, ! { ".xml", "text/xml"}, ! { ".xsl", "text/xml"}, { ".vrml", "x-world/x-vrml" }, { ".wav", "audio/x-wav" }, --- 199,220 ---- { ".tif", "image/tiff" }, { ".tiff", "image/tiff" }, + { ".torrent", "application/x-bittorrent" }, + { ".tsv", "text/tab-separated-values" }, { ".txt", "text/plain" }, + { ".vcf", "text/x-vcard" }, { ".xbm", "image/x-xbitmap" }, { ".xpm", "image/x-xpixmap" }, { ".xht", "application/xhtml+xml"}, { ".xhtml", "application/xhtml+xml"}, ! { ".xla", "application/vnd.ms-excel"}, ! { ".xlc", "application/vnd.ms-excel"}, ! { ".xlm", "application/vnd.ms-excel"}, ! { ".xls", "application/vnd.ms-excel"}, ! { ".xlt", "application/vnd.ms-excel"}, ! { ".xlw", "application/vnd.ms-excel"}, ! { ".xml", "application/xml"}, ! { ".xsl", "application/xml"}, ! { ".xslt", "application/xslt+xml"}, ! { ".xul", "application/vnd.mozilla.xul+xml"}, { ".vrml", "x-world/x-vrml" }, { ".wav", "audio/x-wav" }, |
From: Stephen D. <sd...@us...> - 2005-02-28 04:34:31
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24187 Modified Files: ChangeLog Log Message: XML mime types changed to application/xml from text/xml, fixes bug #1145927. Added a handful of new mime mappings. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ChangeLog 26 Feb 2005 17:18:33 -0000 1.7 --- ChangeLog 28 Feb 2005 04:34:19 -0000 1.8 *************** *** 1,2 **** --- 1,8 ---- + 2005-02-27 Stephen Deasey <sd...@us...> + + * nsd/mimetypes.c: XML mime types changed to application/xml from + text/xml, fixes bug #1145927. Added a handful of new mime + mappings. + 2005-02-26 Zoran Vasiljevic <vas...@us...> |
From: Zoran V. <vas...@us...> - 2005-02-26 17:19:09
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28914 Modified Files: ChangeLog Log Message: See file Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ChangeLog 26 Feb 2005 15:44:18 -0000 1.6 --- ChangeLog 26 Feb 2005 17:18:33 -0000 1.7 *************** *** 1,11 **** 2005-02-26 Zoran Vasiljevic <vas...@us...> ! * generic/unix.c: * include/ns.h: added Ns_GetNameForUid(), Ns_GetNameForGid() ! * generic/nsmain.c: allows server to be started as uid == 0 if both of the following are true: o. the caller process is running as root (getuid() == 0) ! o "-u root" or "-u 0" was given on the command line Also, improved and tightented verification of passed user and/or group information. --- 1,36 ---- 2005-02-26 Zoran Vasiljevic <vas...@us...> ! * nsd/tclobjv.c: New file with objv argument parsing code ! ! * nsd/Makefile: Added compliation directive for nsd/tclobjv.c ! ! * include/ns.h: Added declarations... ! for following structs: ! o. Ns_ObjvSpec ! o. Ns_ObjvTable ! and following calls: ! o. Ns_ParseObjv ! o. Ns_ObjvBool ! o. Ns_ObjvInt ! o. Ns_ObjvLong ! o. Ns_ObjvWideInt ! o. Ns_ObjvDouble ! o. Ns_ObjvString ! o. Ns_ObjvObj ! o. Ns_ObjvIndex ! o. Ns_ObjvFlags ! o. Ns_ObjvBreak ! o. Ns_ObjvArgs ! This all implements new argument parsing code from Stephen. ! ! 2005-02-26 Zoran Vasiljevic <vas...@us...> ! ! * nsd/unix.c: * include/ns.h: added Ns_GetNameForUid(), Ns_GetNameForGid() ! * nsd/nsmain.c: allows server to be started as uid == 0 if both of the following are true: o. the caller process is running as root (getuid() == 0) ! o. "-u root" or "-u 0" was given on the command line Also, improved and tightented verification of passed user and/or group information. |
From: Zoran V. <vas...@us...> - 2005-02-26 17:18:17
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28493/include Modified Files: ns.h Log Message: Added declarations for following structs: o. Ns_ObjvSpec o. Ns_ObjvTable and following calls: o. Ns_ParseObjv o. Ns_ObjvBool o. Ns_ObjvInt o. Ns_ObjvLong o. Ns_ObjvWideInt o. Ns_ObjvDouble o. Ns_ObjvString o. Ns_ObjvObj o. Ns_ObjvIndex o. Ns_ObjvFlags o. Ns_ObjvBreak o. Ns_ObjvArgs This all implements new argument parsing code from Stephen. Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ns.h 26 Feb 2005 13:21:23 -0000 1.4 --- ns.h 26 Feb 2005 17:18:08 -0000 1.5 *************** *** 286,289 **** --- 286,291 ---- typedef int (Ns_LogFlushProc) (char *msg, size_t len); typedef int (Ns_LogProc) (Ns_DString *dsPtr, Ns_LogSeverity severity, char *fmt, va_list ap); + typedef int (Ns_ObjvProc) (void *dest, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[], void *arg); /* *************** *** 362,365 **** --- 364,389 ---- /* + * The following struct describes how to process an option + * or argument passed to a Tcl command. + */ + + typedef struct Ns_ObjvSpec { + char *key; + Ns_ObjvProc *proc; + void *dest; + void *arg; + } Ns_ObjvSpec; + + /* + * The following struct is used to validate options from + * a choice of values. + */ + + typedef struct Ns_ObjvTable { + char *key; + int value; + } Ns_ObjvTable; + + /* * The following structure defines an I/O * scatter/gather buffer for WIN32. *************** *** 766,769 **** --- 790,811 ---- /* + * tclobjv.c + */ + + NS_EXTERN int Ns_ParseObjv(Ns_ObjvSpec *optSpec, Ns_ObjvSpec *argSpec, + Tcl_Interp *interp, int offset, int objc, Tcl_Obj *CONST objv[]); + NS_EXTERN Ns_ObjvProc Ns_ObjvBool; + NS_EXTERN Ns_ObjvProc Ns_ObjvInt; + NS_EXTERN Ns_ObjvProc Ns_ObjvLong; + NS_EXTERN Ns_ObjvProc Ns_ObjvWideInt; + NS_EXTERN Ns_ObjvProc Ns_ObjvDouble; + NS_EXTERN Ns_ObjvProc Ns_ObjvString; + NS_EXTERN Ns_ObjvProc Ns_ObjvObj; + NS_EXTERN Ns_ObjvProc Ns_ObjvIndex; + NS_EXTERN Ns_ObjvProc Ns_ObjvFlags; + NS_EXTERN Ns_ObjvProc Ns_ObjvBreak; + NS_EXTERN Ns_ObjvProc Ns_ObjvArgs; + + /* * tclthread.c: */ |
From: Zoran V. <vas...@us...> - 2005-02-26 17:16:41
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28357/nsd Modified Files: Makefile Log Message: Added compliation directive for nsd/tclobjv.c Index: Makefile =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Makefile 16 Feb 2005 08:39:22 -0000 1.1.1.1 --- Makefile 26 Feb 2005 17:16:32 -0000 1.2 *************** *** 47,51 **** server.o set.o sock.o sockcallback.o str.o tclatclose.o \ tclcmds.o tclconf.o tclenv.o tclfile.o tclhttp.o tclimg.o \ ! tclinit.o tcljob.o tclmisc.o tclobj.o tclrequest.o tclresp.o \ tclsched.o tclset.o tclshare.o tclsock.o tclthread.o tclvar.o \ tclxkeylist.o unix.o url.o urlencode.o urlopen.o urlspace.o \ --- 47,51 ---- server.o set.o sock.o sockcallback.o str.o tclatclose.o \ tclcmds.o tclconf.o tclenv.o tclfile.o tclhttp.o tclimg.o \ ! tclinit.o tcljob.o tclmisc.o tclobj.o tclobjv.o tclrequest.o tclresp.o \ tclsched.o tclset.o tclshare.o tclsock.o tclthread.o tclvar.o \ tclxkeylist.o unix.o url.o urlencode.o urlopen.o urlspace.o \ |
From: Zoran V. <vas...@us...> - 2005-02-26 17:16:03
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28094/nsd Added Files: tclobjv.c Log Message: New file with objv argument parsing code from Stephen --- NEW FILE: tclobjv.c --- /* * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * Alternatively, the contents of this file may be used under the terms * of the GNU General Public License (the "GPL"), in which case the * provisions of GPL are applicable instead of those above. If you wish * to allow use of your version of this file only under the terms of the * GPL and not to allow others to use your version of this file under the * License, indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the GPL. * If you do not delete the provisions above, a recipient may use your * version of this file under either the License or the GPL. */ /* * tclobjv.c -- * * Routines for parsing the options and arguments passed to Tcl commands. * */ static const char *RCSID = "@(#) $Header: /cvsroot/naviserver/naviserver/nsd/tclobjv.c,v 1.1 2005/02/26 17:15:52 vasiljevic Exp $, compiled: " __DATE__ " " __TIME__; #include "ns.h" /* * Static functions defined in this file. */ static void WrongNumArgs(Ns_ObjvSpec *optSpec, Ns_ObjvSpec *argSpec, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); /* *---------------------------------------------------------------------- * * Ns_ParseObjv -- * * Process objv acording to given option and arg specs. * * Results: * NS_OK or NS_ERROR. * * Side effects: * Depends on the Ns_ObjvTypeProcs which run. * *---------------------------------------------------------------------- */ int Ns_ParseObjv(Ns_ObjvSpec *optSpec, Ns_ObjvSpec *argSpec, Tcl_Interp *interp, int offset, int objc, Tcl_Obj *CONST objv[]) { Ns_ObjvSpec *specPtr; int optIndex, objvIndex, remain; objvIndex = offset; objc -= offset; if (optSpec != NULL) { while (objc > 0) { if (Tcl_GetIndexFromObjStruct(NULL, objv[objvIndex], optSpec, sizeof(Ns_ObjvSpec), "option", TCL_EXACT, &optIndex) != TCL_OK) { break; } specPtr = &optSpec[optIndex]; ++objvIndex, --objc; remain = specPtr->proc(specPtr->dest, interp, objc, objv + objvIndex, specPtr->arg); if (remain < 0 || remain > objc) { return NS_ERROR; } objvIndex += (objc - remain); objc = remain; } } for (specPtr = argSpec; specPtr->key != NULL; ++specPtr) { /* are there more required arguments than were supplied? */ if (objc == 0) { if (*specPtr->key != '?') { WrongNumArgs(optSpec, argSpec, interp, offset, objv); return NS_ERROR; } return NS_OK; } remain = specPtr->proc(specPtr->dest, interp, objc, objv + objvIndex, specPtr->arg); if (remain < 0 || remain > objc) { return NS_ERROR; } objvIndex += (objc - remain); objc = remain; } /* are there more supplied args than formal arguments? */ if (specPtr->key == NULL) { if (objc > 0) { WrongNumArgs(optSpec, argSpec, interp, offset, objv); return NS_ERROR; } } else if (*specPtr->key != '?' && objc == 0) { WrongNumArgs(optSpec, argSpec, interp, offset, objv); return NS_ERROR; } return NS_OK; } /* *---------------------------------------------------------------------- * * Ns_ObjvBool, Ns_ObjvInt, Ns_ObjvLong, Ns_ObjvWideInt, * Ns_ObjvDouble -- * * Consume exactly one argument, returning it's value into dest. * * Results: * On success (objc - 1) and dest will contain the value matched * On error (or no arguments supplied; objc = 0) -1 will be returned * * Side effects: * Argument maybe converted to type specific internal rep. * *---------------------------------------------------------------------- */ int Ns_ObjvBool(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { if (objc > 0 && Tcl_GetBooleanFromObj(interp, objv[0], (int *) dest) == TCL_OK) { return --objc; } return -1; } int Ns_ObjvInt(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { if (objc > 0 && Tcl_GetIntFromObj(interp, objv[0], (int *) dest) == TCL_OK) { return --objc; } return -1; } int Ns_ObjvLong(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { if (objc > 0 && Tcl_GetLongFromObj(interp, objv[0], (long *) dest) == TCL_OK) { return --objc; } return -1; } int Ns_ObjvWideInt(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { if (objc > 0 && Tcl_GetWideIntFromObj(interp, objv[0], (Tcl_WideInt *) dest) == TCL_OK) { return --objc; } return -1; } int Ns_ObjvDouble(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { if (objc > 0 && Tcl_GetDoubleFromObj(interp, objv[0], (double *) dest) == TCL_OK) { return --objc; } return -1; } /* *---------------------------------------------------------------------- * * Ns_ObjvString -- * * Consume exactly one argument, returning a pointer to it's * cstring into dest. * * If the "arg" element is != NULL it is assumed to be a pointer * to an int and the returned string length will be left in it. * * Results: * On success (objc - 1) and dest will contain the value matched * On error (or no arguments supplied; objc = 0) -1 will be returned * * Side effects: * None. * *---------------------------------------------------------------------- */ int Ns_ObjvString(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { if (objc > 0) { if (arg == NULL) { *((char **) dest) = Tcl_GetString(objv[0]); } else { *((char **) dest) = Tcl_GetStringFromObj(objv[0], (int*)arg); } return --objc; } return -1; } /* *---------------------------------------------------------------------- * * Ns_ObjvObj -- * * Consume exactly one argument, returning it's pointer into dest * with no conversion. * * Results: * On success (objc - 1) and dest will contain the value matched * On error (or no arguments supplied; objc = 0) -1 will be returned * * Side effects: * None. * *---------------------------------------------------------------------- */ int Ns_ObjvObj(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { if (objc > 0) { *((Tcl_Obj **) dest) = objv[0]; return --objc; } return -1; } /* *---------------------------------------------------------------------- * * Ns_ObjvIndex -- * * Match the current argument against the keys in the specified * table, returning the value at the index of the first match into * dest. It is an error for the argument to contain anything but * one of the table keys. * * Results: * On success (objc - 1) and dest will contain the value matched * On error (or no arguments supplied; objc = 0) -1 will be returned * * Side effects: * None. * *---------------------------------------------------------------------- */ int Ns_ObjvIndex(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { Ns_ObjvTable *tablePtr = arg; int tableIdx; if (objc > 0) { if (Tcl_GetIndexFromObjStruct(interp, objv[0], tablePtr, sizeof(Ns_ObjvTable), "option", TCL_EXACT, &tableIdx) != TCL_OK) { return -1; } *((int *) dest) = tablePtr[tableIdx].value; return --objc; } return -1; } /* *---------------------------------------------------------------------- * * Ns_ObjvFlags -- * * Treat the current argument as a list of flags and compare them * all with the keys in the specified table. As flags are matched * the values are ORed togethter and the result is returned in dest. * An unknown flag causes an error. * * Results: * On success (objc - 1) and dest will contain the value matched * On error (or no arguments supplied; objc = 0) -1 will be returned * * Side effects: * Arg may be converted to list representation. * *---------------------------------------------------------------------- */ int Ns_ObjvFlags(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { Ns_ObjvTable *tablePtr = arg; int tableIdx, i, flagc; Tcl_Obj **flagv; if (objc < 1) { return -1; } if (Tcl_ListObjGetElements(interp, objv[0], &flagc, &flagv) != TCL_OK) { return -1; } if (flagc == 0) { Tcl_SetStringObj(Tcl_GetObjResult(interp), "blank flag specification", -1); return -1; } for (i = 0; i < flagc; ++i) { if (Tcl_GetIndexFromObjStruct(interp, flagv[i], tablePtr, sizeof(Ns_ObjvTable), "flag", TCL_EXACT, &tableIdx) != TCL_OK) { return -1; } *((int *) dest) |= tablePtr[tableIdx].value; } return --objc; } /* *---------------------------------------------------------------------- * * Ns_ObjvBreak -- * * Handle '--' option/argument separator. * * Results: * Exactly objc. * * Side effects: * Option processing will end successfully, argument processing * will begin. * *---------------------------------------------------------------------- */ int Ns_ObjvBreak(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { return objc; } /* *---------------------------------------------------------------------- * * Ns_ObjvArgs -- * * Count all remaining arguments, returning zero left unprocessed. * * Results: * Exactly 0 (zero). * * Side effects: * Arguments processing will end sucessfully. * *---------------------------------------------------------------------- */ int Ns_ObjvArgs(void *dest, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *arg) { *((int *) dest) = objc; return 0; } /* *---------------------------------------------------------------------- * * WrongNumArgs -- * * Leave a usage message in the interpreters result. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void WrongNumArgs(Ns_ObjvSpec *optSpec, Ns_ObjvSpec *argSpec, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { Ns_ObjvSpec *specPtr; Ns_DString ds; char *p; Ns_DStringInit(&ds); for (specPtr = optSpec; specPtr->key != NULL; ++specPtr) { if (STREQ(specPtr->key, "--")) { Ns_DStringAppend(&ds, "?--? "); } else { p = specPtr->key; if (*specPtr->key == '-') { ++p; } Ns_DStringPrintf(&ds, "?%s %s? ", specPtr->key, p); } } for (specPtr = argSpec; specPtr->key != NULL; ++specPtr) { Ns_DStringVarAppend(&ds, specPtr->key, " ", NULL); } Tcl_WrongNumArgs(interp, objc, objv, ds.string); Ns_DStringFree(&ds); } |
From: Zoran V. <vas...@us...> - 2005-02-26 15:44:29
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4974 Modified Files: ChangeLog Log Message: See file. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ChangeLog 24 Feb 2005 17:24:52 -0000 1.5 --- ChangeLog 26 Feb 2005 15:44:18 -0000 1.6 *************** *** 1,6 **** 2005-02-24 Vlad Seryakov <vl...@cr...> * include/ns.h nsd/nsd.h nsd/binder.c: changed server name ! from AOLserver to NaviServer in ns_info command. New ListenXXX family functions declared in the ns.h file. --- 1,18 ---- + 2005-02-26 Zoran Vasiljevic <vas...@us...> + + * generic/unix.c: + * include/ns.h: added Ns_GetNameForUid(), Ns_GetNameForGid() + + * generic/nsmain.c: allows server to be started as uid == 0 + if both of the following are true: + o. the caller process is running as root (getuid() == 0) + o "-u root" or "-u 0" was given on the command line + Also, improved and tightented verification of passed user + and/or group information. + 2005-02-24 Vlad Seryakov <vl...@cr...> * include/ns.h nsd/nsd.h nsd/binder.c: changed server name ! from AOLserver to NaviServer in ns_info command. New ListenXXX family functions declared in the ns.h file. *************** *** 15,25 **** * nsd/tclfile.c: fixed broken NsTclChanObjCmd command which caused server crashes when trasporting channels between ! threads when linked against Tcl 8.4+ library. 2005-02-16 Vlad Seryakov <vl...@cr...> ! * Makefile configure configure.in sample-config.tcl include/Makefile.build ! include/Makefile.global.in include/Makefile.module.in include/ns.h ! include/nsdb.h include/nsextmsg.h include/nspd.h include/nsthread.h tcl/charsets.tcl tcl/compat.tcl tcl/debug.tcl tcl/fastpath.tcl tcl/file.tcl tcl/form.tcl tcl/http.tcl tcl/init.tcl --- 27,38 ---- * nsd/tclfile.c: fixed broken NsTclChanObjCmd command which caused server crashes when trasporting channels between ! threads when linked against Tcl 8.4+ library (Bug #1143586) 2005-02-16 Vlad Seryakov <vl...@cr...> ! * Makefile configure configure.in sample-config.tcl ! include/Makefile.build include/Makefile.global.in ! include/Makefile.module.in include/ns.h include/nsdb.h ! include/nsextmsg.h include/nspd.h include/nsthread.h tcl/charsets.tcl tcl/compat.tcl tcl/debug.tcl tcl/fastpath.tcl tcl/file.tcl tcl/form.tcl tcl/http.tcl tcl/init.tcl *************** *** 27,43 **** * tcl/sendmail.tcl: added erro notification flag to smtp_recv proc, ! when receiving last QUIT response, do not fire exception if ! remote server just drops the connection on QUIT * nsd/binder.c: added UDP/UNIX/RAW protocols to the sockets, ! * nsd/init.c: call InitLog before dns resolver will try to resolve local ! host, this prevents server crash ! * nsd/tclsock.c: back ported from CVS 4.1, added -localhost/-localport to ! ns_scokopen ! * nsdb/dbdrv.c: if driver set exception in select, do to rewrite it in the ! server 2005-02-15 Zoran Vasiljevic <vas...@us...> --- 40,56 ---- * tcl/sendmail.tcl: added erro notification flag to smtp_recv proc, ! when receiving last QUIT response, do not fire exception if ! remote server just drops the connection on QUIT * nsd/binder.c: added UDP/UNIX/RAW protocols to the sockets, ! * nsd/init.c: call InitLog before dns resolver will try to resolve ! local host, this prevents server crash ! * nsd/tclsock.c: back ported from CVS 4.1, added -localhost/-localport ! to ns_scokopen ! * nsdb/dbdrv.c: if driver set exception in select, do to rewrite it ! in the server 2005-02-15 Zoran Vasiljevic <vas...@us...> |
From: Zoran V. <vas...@us...> - 2005-02-26 13:22:37
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3171/nsd Modified Files: nsmain.c Log Message: Allows server to be started as uid == 0 if both of the following are true: o. the caller process is running as root (getuid() == 0) o "-u root" or "-u 0" was given on the command line Also, improved and tightented verification of passed user and/or group information. Index: nsmain.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nsmain.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** nsmain.c 16 Feb 2005 08:40:11 -0000 1.1.1.1 --- nsmain.c 26 Feb 2005 13:22:17 -0000 1.2 *************** *** 31,35 **** * nsmain.c -- * ! * AOLserver Ns_Main() startup routine. */ --- 31,35 ---- * nsmain.c -- * ! * AOLserver Ns_Main() startup routine. */ [...1223 lines suppressed...] * Results: ! * ns_malloc'ed string with clean path. * * Side effects: ! * Config path is "normalized". * *---------------------------------------------------------------------- *************** *** 918,922 **** Ns_DStringInit(&ds2); if (!Ns_PathIsAbsolute(config) && getcwd(cwd, sizeof(cwd)) != NULL) { ! Ns_MakePath(&ds2, cwd, config, NULL); config = ds2.string; } --- 942,946 ---- Ns_DStringInit(&ds2); if (!Ns_PathIsAbsolute(config) && getcwd(cwd, sizeof(cwd)) != NULL) { ! Ns_MakePath(&ds2, cwd, config, NULL); config = ds2.string; } |
From: Zoran V. <vas...@us...> - 2005-02-26 13:21:41
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2925/nsd Modified Files: unix.c Log Message: Added Ns_GetNameForUid(), Ns_GetNameForGid() Index: unix.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/unix.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** unix.c 16 Feb 2005 08:40:15 -0000 1.1.1.1 --- unix.c 26 Feb 2005 13:21:22 -0000 1.2 *************** *** 1,7 **** /* ! * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" *************** *** 32,36 **** * unix.c -- * ! * Unix specific routines. */ --- 32,36 ---- * unix.c -- * ! * Unix specific routines. */ *************** *** 50,61 **** * FatalSignalHandler -- * ! * Ensure that we drop core on fatal signals like SIGBUS and ! * SIGSEGV. * * Results: ! * None. * * Side effects: ! * A core file will be left wherever the server was running. * *---------------------------------------------------------------------- --- 50,61 ---- * FatalSignalHandler -- * ! * Ensure that we drop core on fatal signals like SIGBUS and ! * SIGSEGV. * * Results: ! * None. * * Side effects: ! * A core file will be left wherever the server was running. * *---------------------------------------------------------------------- *************** *** 85,95 **** * NsBlockSignals -- * ! * Block signals at startup. * * Results: ! * None. * * Side effects: ! * Signals will be pending until NsHandleSignals. * *---------------------------------------------------------------------- --- 85,95 ---- * NsBlockSignals -- * ! * Block signals at startup. * * Results: ! * None. * * Side effects: ! * Signals will be pending until NsHandleSignals. * *---------------------------------------------------------------------- *************** *** 139,143 **** * NsRestoreSignals -- * ! * Restore all signals to their default value. * * Results: --- 139,143 ---- * NsRestoreSignals -- * ! * Restore all signals to their default value. * * Results: *************** *** 153,158 **** NsRestoreSignals(void) { ! sigset_t set; ! int sig; for (sig = 1; sig < NSIG; ++sig) { --- 153,158 ---- NsRestoreSignals(void) { ! sigset_t set; ! int sig; for (sig = 1; sig < NSIG; ++sig) { *************** *** 169,180 **** * NsHandleSignals -- * ! * Loop forever processing signals until a term signal ! * is received. * * Results: ! * None. * * Side effects: ! * HUP callbacks may be called. * *---------------------------------------------------------------------- --- 169,180 ---- * NsHandleSignals -- * ! * Loop forever processing signals until a term signal ! * is received. * * Results: ! * None. * * Side effects: ! * HUP callbacks may be called. * *---------------------------------------------------------------------- *************** *** 198,210 **** } do { ! do { ! err = ns_sigwait(&set, &sig); ! } while (err == EINTR); ! if (err != 0) { ! Ns_Fatal("signal: ns_sigwait failed: %s", strerror(errno)); ! } ! if (sig == SIGHUP) { ! NsRunSignalProcs(); ! } } while (sig == SIGHUP); --- 198,210 ---- } do { ! do { ! err = ns_sigwait(&set, &sig); ! } while (err == EINTR); ! if (err != 0) { ! Ns_Fatal("signal: ns_sigwait failed: %s", strerror(errno)); ! } ! if (sig == SIGHUP) { ! NsRunSignalProcs(); ! } } while (sig == SIGHUP); *************** *** 222,232 **** * NsSendSignal -- * ! * Send a signal to the main thread. * * Results: ! * None. * * Side effects: ! * Main thread in NsHandleSignals will wakeup. * *---------------------------------------------------------------------- --- 222,232 ---- * NsSendSignal -- * ! * Send a signal to the main thread. * * Results: ! * None. * * Side effects: ! * Main thread in NsHandleSignals will wakeup. * *---------------------------------------------------------------------- *************** *** 236,241 **** NsSendSignal(int sig) { ! if (kill(Ns_InfoPid(), sig) != 0) { ! Ns_Fatal("unix: kill() failed: '%s'", strerror(errno)); } } --- 236,241 ---- NsSendSignal(int sig) { ! if (kill(Ns_InfoPid(), sig) != 0) { ! Ns_Fatal("unix: kill() failed: '%s'", strerror(errno)); } } *************** *** 263,273 **** if (sockpair) { ! err = socketpair(AF_UNIX, SOCK_STREAM, 0, fds); } else { ! err = pipe(fds); } if (!err) { ! fcntl(fds[0], F_SETFD, 1); ! fcntl(fds[1], F_SETFD, 1); } return err; --- 263,273 ---- if (sockpair) { ! err = socketpair(AF_UNIX, SOCK_STREAM, 0, fds); } else { ! err = pipe(fds); } if (!err) { ! fcntl(fds[0], F_SETFD, 1); ! fcntl(fds[1], F_SETFD, 1); } return err; *************** *** 289,302 **** /* *---------------------------------------------------------------------- ! * Ns_GetUserHome -- * ! * Get the home directory name for a user name * * Results: ! * Return NS_TRUE if user name is found in /etc/passwd file and ! * NS_FALSE otherwise. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 289,301 ---- /* *---------------------------------------------------------------------- ! * Ns_GetNameForUid -- * ! * Get the user name given the id * * Results: ! * NS_TRUE if id is found; NS_FALSE otherwise. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 304,322 **** int ! Ns_GetUserHome(Ns_DString *pds, char *user) { ! struct passwd *pw; ! int retcode; Ns_MutexLock(&lock); ! pw = getpwnam(user); ! if (pw == NULL) { ! retcode = NS_FALSE; ! } else { ! Ns_DStringAppend(pds, pw->pw_dir); ! retcode = NS_TRUE; } Ns_MutexUnlock(&lock); ! return retcode; } --- 303,317 ---- int ! Ns_GetNameForUid(Ns_DString *dsPtr, int uid) { ! struct passwd *pw = NULL; Ns_MutexLock(&lock); ! pw = getpwuid((uid_t)uid); ! if (pw != NULL && dsPtr) { ! Ns_DStringAppend(dsPtr, pw->pw_name); } Ns_MutexUnlock(&lock); ! return (pw != NULL) ? NS_TRUE : NS_FALSE; } *************** *** 324,333 **** /* *---------------------------------------------------------------------- ! * Ns_GetGid -- * ! * Get the group id from a group name. * * Results: ! * Group id or -1 if not found. * * Side effects: --- 319,328 ---- /* *---------------------------------------------------------------------- ! * Ns_GetNameForGid -- * ! * Get the group name given the id * * Results: ! * NS_TRUE if id is found; NS_FALSE otherwise. * * Side effects: *************** *** 338,355 **** int ! Ns_GetGid(char *group) { ! int retcode; ! struct group *grent; Ns_MutexLock(&lock); ! grent = getgrnam(group); ! if (grent == NULL) { ! retcode = -1; ! } else { ! retcode = grent->gr_gid; } Ns_MutexUnlock(&lock); ! return retcode; } --- 333,380 ---- int ! Ns_GetNameForGid(Ns_DString *dsPtr, int gid) { ! struct group *gr = NULL; Ns_MutexLock(&lock); ! gr = getgrgid((gid_t)gid); ! if (gr != NULL && dsPtr) { ! Ns_DStringAppend(dsPtr, gr->gr_name); } Ns_MutexUnlock(&lock); ! ! return (gr != NULL) ? NS_TRUE : NS_FALSE; ! } ! ! ! /* ! *---------------------------------------------------------------------- ! * Ns_GetUserHome -- ! * ! * Get the home directory name for a user name ! * ! * Results: ! * Return NS_TRUE if user name is found in /etc/passwd file and ! * NS_FALSE otherwise. ! * ! * Side effects: ! * None. ! * ! *---------------------------------------------------------------------- ! */ ! ! int ! Ns_GetUserHome(Ns_DString *ds, char *user) ! { ! struct passwd *pw = NULL; ! ! Ns_MutexLock(&lock); ! pw = getpwnam(user); ! if (pw != NULL) { ! Ns_DStringAppend(ds, pw->pw_dir); ! } ! Ns_MutexUnlock(&lock); ! ! return (pw != NULL) ? NS_TRUE : NS_FALSE; } *************** *** 362,367 **** * * Results: ! * Returns group id of the user name found in /etc/passwd or -1 ! * otherwise. * * Side effects: --- 387,391 ---- * * Results: ! * Group id or -1 if not found. * * Side effects: *************** *** 374,379 **** Ns_GetUserGid(char *user) { ! struct passwd *pw; ! int retcode; Ns_MutexLock(&lock); --- 398,403 ---- Ns_GetUserGid(char *user) { ! struct passwd *pw; ! int retcode; Ns_MutexLock(&lock); *************** *** 382,386 **** retcode = -1; } else { ! retcode = pw->pw_gid; } Ns_MutexUnlock(&lock); --- 406,410 ---- retcode = -1; } else { ! retcode = (int) pw->pw_gid; } Ns_MutexUnlock(&lock); *************** *** 396,401 **** * * Results: ! * Return NS_TRUE if user name is found in /etc/passwd file and ! * NS_FALSE otherwise. * * Side effects: --- 420,424 ---- * * Results: ! * User id or -1 if not found. * * Side effects: *************** *** 408,412 **** Ns_GetUid(char *user) { ! struct passwd *pw; int retcode; --- 431,435 ---- Ns_GetUid(char *user) { ! struct passwd *pw; int retcode; *************** *** 416,422 **** retcode = -1; } else { ! retcode = (unsigned) pw->pw_uid; } Ns_MutexUnlock(&lock); return retcode; } --- 439,479 ---- retcode = -1; } else { ! retcode = (int) pw->pw_uid; } Ns_MutexUnlock(&lock); + + return retcode; + } + + /* + *---------------------------------------------------------------------- + * Ns_GetGid -- + * + * Get the group id from a group name. + * + * Results: + * Group id or -1 if not found. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + int + Ns_GetGid(char *group) + { + struct group *gr; + int retcode; + + Ns_MutexLock(&lock); + gr = getgrnam(group); + if (gr == NULL) { + retcode = -1; + } else { + retcode = (int) gr->gr_gid; + } + Ns_MutexUnlock(&lock); + return retcode; } |
From: Zoran V. <vas...@us...> - 2005-02-26 13:21:40
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2925/include Modified Files: ns.h Log Message: Added Ns_GetNameForUid(), Ns_GetNameForGid() Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ns.h 24 Feb 2005 17:24:52 -0000 1.3 --- ns.h 26 Feb 2005 13:21:23 -0000 1.4 *************** *** 1227,1234 **** NS_EXTERN int ns_sockpair(SOCKET *socks); NS_EXTERN int ns_pipe(int *fds); ! NS_EXTERN int Ns_GetUserHome(Ns_DString *pds, char *user); ! NS_EXTERN int Ns_GetGid(char *group); NS_EXTERN int Ns_GetUserGid(char *user); NS_EXTERN int Ns_GetUid(char *user); /* --- 1227,1236 ---- NS_EXTERN int ns_sockpair(SOCKET *socks); NS_EXTERN int ns_pipe(int *fds); ! NS_EXTERN int Ns_GetNameForUid(Ns_DString *dsPtr, int uid); ! NS_EXTERN int Ns_GetNameForGid(Ns_DString *dsPtr, int gid); ! NS_EXTERN int Ns_GetUserHome(Ns_DString *dsPtr, char *user); NS_EXTERN int Ns_GetUserGid(char *user); NS_EXTERN int Ns_GetUid(char *user); + NS_EXTERN int Ns_GetGid(char *group); /* |
From: Vlad S. <ser...@us...> - 2005-02-24 17:25:24
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22692/nsd Modified Files: binder.c nsd.h Log Message: ns_info reports NaviSertver now, new Listen functions are in ns.h now Index: nsd.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/nsd.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** nsd.h 16 Feb 2005 08:39:28 -0000 1.1.1.1 --- nsd.h 24 Feb 2005 17:24:52 -0000 1.2 *************** *** 1,7 **** /* ! * The contents of this file are subject to the AOLserver Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://aolserver.com/. * * Software distributed under the License is distributed on an "AS IS" --- 1,7 ---- /* ! * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at ! * http://www.mozilla.org/. * * Software distributed under the License is distributed on an "AS IS" *************** *** 108,114 **** */ ! #define NSD_NAME "AOLserver" #define NSD_VERSION NS_PATCH_LEVEL ! #define NSD_LABEL "aolserver4_0" #define NSD_TAG "$Name$" #define NS_CONFIG_PARAMETERS "ns/parameters" --- 108,114 ---- */ ! #define NSD_NAME "NaviServer" #define NSD_VERSION NS_PATCH_LEVEL ! #define NSD_LABEL "naviserver4_0" #define NSD_TAG "$Name$" #define NS_CONFIG_PARAMETERS "ns/parameters" Index: binder.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/binder.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** binder.c 16 Feb 2005 15:05:46 -0000 1.2 --- binder.c 24 Feb 2005 17:24:52 -0000 1.3 *************** *** 69,73 **** */ ! int Ns_SockListenEx(char *address, int port, int backlog) { --- 69,73 ---- */ ! SOCKET Ns_SockListenEx(char *address, int port, int backlog) { *************** *** 114,118 **** */ ! int Ns_SockBindUdp(struct sockaddr_in *saPtr) { --- 114,118 ---- */ ! SOCKET Ns_SockBindUdp(struct sockaddr_in *saPtr) { *************** *** 146,150 **** */ ! int Ns_SockRaw(int proto) { --- 146,150 ---- */ ! SOCKET Ns_SockRaw(int proto) { *************** *** 177,181 **** */ ! int Ns_SockListenUdp(char *address, int port) { --- 177,181 ---- */ ! SOCKET Ns_SockListenUdp(char *address, int port) { *************** *** 216,220 **** */ ! int Ns_SockListenRaw(int proto) { --- 216,220 ---- */ ! SOCKET Ns_SockListenRaw(int proto) { *************** *** 256,260 **** */ ! static int Ns_SockListenUnix(char *path) { --- 256,260 ---- */ ! SOCKET Ns_SockListenUnix(char *path) { |
From: Vlad S. <ser...@us...> - 2005-02-24 17:25:19
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22692/include Modified Files: ns.h Log Message: ns_info reports NaviSertver now, new Listen functions are in ns.h now Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ns.h 16 Feb 2005 16:45:44 -0000 1.2 --- ns.h 24 Feb 2005 17:24:52 -0000 1.3 *************** *** 1035,1038 **** --- 1035,1047 ---- /* + * binder.c: + */ + + NS_EXTERN SOCKET Ns_SockListenEx(char *address, int port, int backlog); + NS_EXTERN SOCKET Ns_SockListenUdp(char *address, int port); + NS_EXTERN SOCKET Ns_SockListenRaw(int proto); + NS_EXTERN SOCKET Ns_SockListenUnix(char *path); + + /* * sock.c: */ *************** *** 1045,1049 **** NS_EXTERN SOCKET Ns_SockBind(struct sockaddr_in *psa); NS_EXTERN SOCKET Ns_SockListen(char *address, int port); - NS_EXTERN SOCKET Ns_SockListenEx(char *address, int port, int backlog); NS_EXTERN SOCKET Ns_SockAccept(SOCKET sock, struct sockaddr *psa, int *lenPtr); --- 1054,1057 ---- |