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...> - 2006-01-24 15:36:19
|
Update of /cvsroot/naviserver/modules/nsdns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27820/nsdns Modified Files: nsdns.c Log Message: Changed all modules to new Ns_Sock timeout API Index: nsdns.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsdns/nsdns.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** nsdns.c 18 Jan 2006 04:43:21 -0000 1.22 --- nsdns.c 24 Jan 2006 15:36:04 -0000 1.23 *************** *** 802,809 **** int nread,n; char *buf = (char *) vbuf; nread = len; while(len > 0) { ! n = Ns_SockRecv(sock,buf,len,dnsReadTimeout); if(n <= 0) return -1; len -= n; --- 802,810 ---- int nread,n; char *buf = (char *) vbuf; + Ns_Time timeout = {dnsReadTimeout, 0}; nread = len; while(len > 0) { ! n = Ns_SockRecv(sock,buf,len,&timeout); if(n <= 0) return -1; len -= n; *************** *** 818,826 **** int nwrote,n; char *buf; nwrote = len; buf = vbuf; while(len > 0) { ! n = Ns_SockSend(sock,buf,len,dnsWriteTimeout); if(n <= 0) return -1; len -= n; --- 819,828 ---- int nwrote,n; char *buf; + Ns_Time timeout = {dnsWriteTimeout, 0}; nwrote = len; buf = vbuf; while(len > 0) { ! n = Ns_SockSend(sock,buf,len,&timeout); if(n <= 0) return -1; len -= n; |
From: Vlad S. <ser...@us...> - 2006-01-24 15:36:17
|
Update of /cvsroot/naviserver/modules/nsudp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27820/nsudp Modified Files: nsudp.c Log Message: Changed all modules to new Ns_Sock timeout API Index: nsudp.c =================================================================== RCS file: /cvsroot/naviserver/modules/nsudp/nsudp.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nsudp.c 7 Aug 2005 22:15:09 -0000 1.4 --- nsudp.c 24 Jan 2006 15:36:05 -0000 1.5 *************** *** 64,68 **** #include <string.h> ! #define VERSION "0.1" static Ns_DriverProc udpProc; --- 64,68 ---- #include <string.h> ! #define UDP_VERSION "0.1" static Ns_DriverProc udpProc; |
From: Vlad S. <ser...@us...> - 2006-01-24 15:36:14
|
Update of /cvsroot/naviserver/modules/nssnmp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27820/nssnmp Modified Files: nssnmp.c Log Message: Changed all modules to new Ns_Sock timeout API Index: nssnmp.c =================================================================== RCS file: /cvsroot/naviserver/modules/nssnmp/nssnmp.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** nssnmp.c 5 Jan 2006 15:36:33 -0000 1.10 --- nssnmp.c 24 Jan 2006 15:36:04 -0000 1.11 *************** *** 174,178 **** #include "snmp_pp/snmp_pp.h" ! #define VERSION "1.14" typedef struct _icmpPort { --- 174,178 ---- #include "snmp_pp/snmp_pp.h" ! #define SNMP_VERSION "1.14" typedef struct _icmpPort { *************** *** 508,512 **** Server *serverPtr; ! Ns_Log(Notice, "nssnmp module version %s server: %s", VERSION,server); path = Ns_ConfigGetPath(server,module,NULL); --- 508,512 ---- Server *serverPtr; ! Ns_Log(Notice, "nssnmp module version %s server: %s", SNMP_VERSION,server); path = Ns_ConfigGetPath(server,module,NULL); *************** *** 2016,2019 **** --- 2016,2022 ---- * * $Log$ + * Revision 1.11 2006/01/24 15:36:04 seryakov + * Changed all modules to new Ns_Sock timeout API + * * Revision 1.10 2006/01/05 15:36:33 seryakov * added debug config option |
From: Vlad S. <ser...@us...> - 2006-01-24 15:36:14
|
Update of /cvsroot/naviserver/modules/nssmtpd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27820/nssmtpd Modified Files: nssmtpd.c Log Message: Changed all modules to new Ns_Sock timeout API Index: nssmtpd.c =================================================================== RCS file: /cvsroot/naviserver/modules/nssmtpd/nssmtpd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nssmtpd.c 20 Jan 2006 06:04:59 -0000 1.2 --- nssmtpd.c 24 Jan 2006 15:36:04 -0000 1.3 *************** *** 1059,1062 **** --- 1059,1063 ---- smtpdRcpt *rcpt; smtpdConn *relay; + Ns_Time timeout = { conn->server->writetimeout, 0}; int size = 0,vcount = 0; Ns_Conn *nsconn = Ns_GetConn(); *************** *** 1073,1077 **** if (!port) port = 25; ! if ((sock.sock = Ns_SockTimedConnect(host,port,conn->server->writetimeout)) == INVALID_SOCKET) { Ns_Log(Error,"nssmtpd: relay: %d/%d: Unable to connect to %s:%d: %s", conn->id,getpid(),host,port,strerror(errno)); --- 1074,1078 ---- if (!port) port = 25; ! if ((sock.sock = Ns_SockTimedConnect(host,port,&timeout)) == INVALID_SOCKET) { Ns_Log(Error,"nssmtpd: relay: %d/%d: Unable to connect to %s:%d: %s", conn->id,getpid(),host,port,strerror(errno)); *************** *** 1185,1188 **** --- 1186,1190 ---- Tcl_Obj *data; smtpdConn *conn; + Ns_Time timeout = { conn->server->writetimeout, 0}; int duplicated = 0; *************** *** 1195,1199 **** if (!port) port = 25; ! if ((sock.sock = Ns_SockTimedConnect(host,port,server->writetimeout)) == INVALID_SOCKET) { Tcl_AppendResult(interp,"nssmtpd: send: unable to connect to ",host,": ",strerror(errno),0); return -1; --- 1197,1201 ---- if (!port) port = 25; ! if ((sock.sock = Ns_SockTimedConnect(host,port,&timeout)) == INVALID_SOCKET) { Tcl_AppendResult(interp,"nssmtpd: send: unable to connect to ",host,": ",strerror(errno),0); return -1; *************** *** 1317,1320 **** --- 1319,1323 ---- int nread,n; char *buf = (char *) vbuf; + Ns_Time timeout = { conn->server->readtimeout, 0}; nread = len; *************** *** 1332,1336 **** /* Attempt to fill the read-ahead buffer. */ conn->buf.ptr = conn->buf.data; ! conn->buf.pos = Ns_SockRecv(conn->sock->sock,conn->buf.data,conn->server->bufsize,conn->server->readtimeout); if (conn->buf.pos <= 0) return -1; } --- 1335,1339 ---- /* Attempt to fill the read-ahead buffer. */ conn->buf.ptr = conn->buf.data; ! conn->buf.pos = Ns_SockRecv(conn->sock->sock,conn->buf.data,conn->server->bufsize,&timeout); if (conn->buf.pos <= 0) return -1; } *************** *** 1344,1352 **** int nwrote,n; char *buf; nwrote = len; buf = vbuf; while(len > 0) { ! n = Ns_SockSend(conn->sock->sock,buf,len,conn->server->writetimeout); if (n < 0) return -1; len -= n; --- 1347,1356 ---- int nwrote,n; char *buf; + Ns_Time timeout = { conn->server->writetimeout, 0}; nwrote = len; buf = vbuf; while(len > 0) { ! n = Ns_SockSend(conn->sock->sock,buf,len,&timeout); if (n < 0) return -1; len -= n; *************** *** 1818,1821 **** --- 1822,1826 ---- smtpdRcpt *rcpt; smtpdConn *spamd; + Ns_Time timeout = { conn->server->writetimeout, 0}; if (!conn->server->spamdhost) return 0; *************** *** 1826,1830 **** /* Connect to spamd server */ ! if ((sock.sock = Ns_SockTimedConnect(conn->server->spamdhost,conn->server->spamdport,conn->server->writetimeout)) == INVALID_SOCKET) { Ns_Log(Error,"nssmtpd: spamd: %d/%d: unable to connect to %s:%d: %s",conn->id,getpid(),conn->server->spamdhost,conn->server->spamdport,strerror(errno)); return -1; --- 1831,1835 ---- /* Connect to spamd server */ ! if ((sock.sock = Ns_SockTimedConnect(conn->server->spamdhost,conn->server->spamdport,&timeout)) == INVALID_SOCKET) { Ns_Log(Error,"nssmtpd: spamd: %d/%d: unable to connect to %s:%d: %s",conn->id,getpid(),conn->server->spamdhost,conn->server->spamdport,strerror(errno)); return -1; |
From: Zoran V. <vas...@us...> - 2006-01-24 15:35:38
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27415/nsd Modified Files: tcljob.c Log Message: Untabified, indented Index: tcljob.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tcljob.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcljob.c 24 Jan 2006 13:24:01 -0000 1.8 --- tcljob.c 24 Jan 2006 15:35:23 -0000 1.9 *************** *** 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 [...2753 lines suppressed...] ! * ! * Compute the time difference . ! * ! * Results: ! * Difference in milliseconds ! * ! * Side effects: ! * None. ! * *---------------------------------------------------------------------- */ + static double + ComputeDelta(Ns_Time *start, Ns_Time *end) + { + Ns_Time diff; Ns_DiffTime(end, start, &diff); + return ((double)diff.sec * 1000.0) + ((double)diff.usec / 1000.0); } |
From: Zoran V. <vas...@us...> - 2006-01-24 14:12:32
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26219/nsd Modified Files: tclsock.c Log Message: Untabified, indented Index: tclsock.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclsock.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tclsock.c 24 Jan 2006 13:24:01 -0000 1.6 --- tclsock.c 24 Jan 2006 14:12:21 -0000 1.7 *************** *** 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 [...1737 lines suppressed...] ! listPtr = Tcl_GetObjResult(interp); ! if (Tcl_ListObjGetElements(interp, listPtr, &objc, &objv) == TCL_OK ! && objc == 2) { ! Tcl_DStringInit(&script); Tcl_DStringAppend(&script, lcbPtr->script, -1); ! Tcl_DStringAppendElement(&script, Tcl_GetString(objv[0])); ! Tcl_DStringAppendElement(&script, Tcl_GetString(objv[1])); result = Tcl_EvalEx(interp, script.string, script.length, 0); ! Tcl_DStringFree(&script); ! } } + if (result != TCL_OK) { Ns_TclLogError(interp); } + Ns_TclDeAllocateInterp(interp); + return NS_TRUE; } |
From: Zoran V. <vas...@us...> - 2006-01-24 13:44:34
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14470/nsd Modified Files: sock.c Log Message: Untabified, indented Index: sock.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/sock.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sock.c 24 Jan 2006 13:24:01 -0000 1.8 --- sock.c 24 Jan 2006 13:44:25 -0000 1.9 *************** *** 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 **** * sock.c -- * ! * Wrappers and convenience functions for TCP/IP stuff. */ --- 32,36 ---- * sock.c -- * ! * Wrappers and convenience functions for TCP/IP stuff. */ *************** *** 47,51 **** */ ! static SOCKET SockConnect(char *host, int port, char *lhost, int lport, int async); static SOCKET SockSetup(SOCKET sock); --- 47,52 ---- */ ! static SOCKET SockConnect(char *host, int port, char *lhost, int lport, ! int async); static SOCKET SockSetup(SOCKET sock); *************** *** 57,63 **** flags = 0; ! if (WSARecv(sock, (LPWSABUF)bufs, nbufs, &n, &flags, NULL, NULL) != 0) { ! n = -1; } return n; #else --- 58,66 ---- flags = 0; ! if (WSARecv(sock, (LPWSABUF)bufs, nbufs, &n, &flags, ! NULL, NULL) != 0) { ! n = -1; } + return n; #else *************** *** 67,70 **** --- 70,74 ---- msg.msg_iov = bufs; msg.msg_iovlen = nbufs; + return recvmsg(sock, &msg, 0); #endif *************** *** 78,84 **** int n; ! if (WSASend(sock, (LPWSABUF)bufs, nbufs, &n, 0, NULL, NULL) != 0) { ! n = -1; } return n; #else --- 82,90 ---- int n; ! if (WSASend(sock, (LPWSABUF)bufs, nbufs, &n, 0, ! NULL, NULL) != 0) { ! n = -1; } + return n; #else *************** *** 88,91 **** --- 94,98 ---- msg.msg_iov = bufs; msg.msg_iovlen = nbufs; + return sendmsg(sock, &msg, 0); #endif *************** *** 93,97 **** int ! Ns_SockRecvBufs(SOCKET sock, struct iovec *bufs, int nbufs, Ns_Time *timeoutPtr) { int n; --- 100,105 ---- int ! Ns_SockRecvBufs(SOCKET sock, struct iovec *bufs, int nbufs, ! Ns_Time *timeoutPtr) { int n; *************** *** 103,115 **** n = SockRecv(sock, bufs, nbufs); } return n; } int ! Ns_SockSendBufs(SOCKET sock, struct iovec *bufs, int nbufs, Ns_Time *timeoutPtr) { int n; n = SockSend(sock, bufs, nbufs); if (n < 0 && ns_sockerrno == EWOULDBLOCK --- 111,126 ---- n = SockRecv(sock, bufs, nbufs); } + return n; } int ! Ns_SockSendBufs(SOCKET sock, struct iovec *bufs, int nbufs, ! Ns_Time *timeoutPtr) { int n; n = SockSend(sock, bufs, nbufs); + if (n < 0 && ns_sockerrno == EWOULDBLOCK *************** *** 117,120 **** --- 128,132 ---- n = SockSend(sock, bufs, nbufs); } + return n; } *************** *** 126,136 **** * NsSockRecv -- * ! * Timed recv() from a non-blocking socket. * * Results: ! * # bytes read * * Side effects: ! * May wait for given timeout. * *---------------------------------------------------------------------- --- 138,148 ---- * NsSockRecv -- * ! * Timed recv() from a non-blocking socket. * * Results: ! * Number of bytes read * * Side effects: ! * May wait for given timeout. * *---------------------------------------------------------------------- *************** *** 140,151 **** Ns_SockRecv(SOCKET sock, void *buf, size_t toread, Ns_Time *timePtr) { ! int nread; nread = recv(sock, buf, toread, 0); if (nread == -1 ! && ns_sockerrno == EWOULDBLOCK ! && Ns_SockTimedWait(sock, NS_SOCK_READ, timePtr) == NS_OK) { ! nread = recv(sock, buf, toread, 0); } return nread; } --- 152,165 ---- Ns_SockRecv(SOCKET sock, void *buf, size_t toread, Ns_Time *timePtr) { ! int nread; nread = recv(sock, buf, toread, 0); + if (nread == -1 ! && ns_sockerrno == EWOULDBLOCK ! && Ns_SockTimedWait(sock, NS_SOCK_READ, timePtr) == NS_OK) { ! nread = recv(sock, buf, toread, 0); } + return nread; } *************** *** 157,168 **** * Ns_SockSend -- * ! * Timed send() to a non-blocking socket. ! * NOTE: This may not write all of the data you send it! * * Results: ! * Number of bytes written, -1 for error * * Side effects: ! * May wait given timeout. * *---------------------------------------------------------------------- --- 171,182 ---- * Ns_SockSend -- * ! * Timed send() to a non-blocking socket. ! * NOTE: This may not write all of the data you send it! * * Results: ! * Number of bytes written, -1 for error * * Side effects: ! * May wait given timeout. * *---------------------------------------------------------------------- *************** *** 175,183 **** nwrote = send(sock, buf, towrite, 0); if (nwrote == -1 ! && ns_sockerrno == EWOULDBLOCK ! && Ns_SockTimedWait(sock, NS_SOCK_WRITE, timeoutPtr) == NS_OK) { ! nwrote = send(sock, buf, towrite, 0); } return nwrote; } --- 189,199 ---- nwrote = send(sock, buf, towrite, 0); + if (nwrote == -1 ! && ns_sockerrno == EWOULDBLOCK ! && Ns_SockTimedWait(sock, NS_SOCK_WRITE, timeoutPtr) == NS_OK) { ! nwrote = send(sock, buf, towrite, 0); } + return nwrote; } *************** *** 189,199 **** * Ns_SockTimedWait -- * ! * Wait for I/O. * * Results: ! * NS_OK, NS_TIMEOUT, or NS_ERROR. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 205,215 ---- * Ns_SockTimedWait -- * ! * Wait for I/O. * * Results: ! * NS_OK, NS_TIMEOUT, or NS_ERROR. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 203,209 **** Ns_SockTimedWait(SOCKET sock, int what, Ns_Time *timeoutPtr) { ! int n, msec = timeoutPtr->sec * 1000 + timeoutPtr->usec / 1000; struct pollfd pfd; pfd.fd = sock; --- 219,226 ---- Ns_SockTimedWait(SOCKET sock, int what, Ns_Time *timeoutPtr) { ! int n, msec; struct pollfd pfd; + msec = timeoutPtr->sec * 1000 + timeoutPtr->usec / 1000; pfd.fd = sock; *************** *** 239,249 **** * Ns_SockListen -- * ! * Listen for connections with default backlog. * * Results: ! * A socket or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 256,266 ---- * Ns_SockListen -- * ! * Listen for connections with default backlog. * * Results: ! * A socket or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 262,272 **** * Ns_SockAccept -- * ! * Accept a TCP socket, setting close on exec. * * Results: ! * A socket or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 279,289 ---- * Ns_SockAccept -- * ! * Accept a TCP socket, setting close on exec. * * Results: ! * A socket or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 279,285 **** sock = accept(lsock, saPtr, (socklen_t *) lenPtr); if (sock != INVALID_SOCKET) { ! sock = SockSetup(sock); } return sock; } --- 296,304 ---- sock = accept(lsock, saPtr, (socklen_t *) lenPtr); + if (sock != INVALID_SOCKET) { ! sock = SockSetup(sock); } + return sock; } *************** *** 291,301 **** * Ns_SockBind -- * ! * Create a TCP socket and bind it to the passed-in address. * * Results: ! * A socket or -1 on error. * * Side effects: ! * Will set SO_REUSEADDR on the socket. * *---------------------------------------------------------------------- --- 310,320 ---- * Ns_SockBind -- * ! * Create a TCP socket and bind it to the passed-in address. * * Results: ! * A socket or -1 on error. * * Side effects: ! * Will set SO_REUSEADDR on the socket. * *---------------------------------------------------------------------- *************** *** 312,328 **** { SOCKET sock; ! int n; sock = socket(AF_INET, SOCK_STREAM, 0); if (sock != INVALID_SOCKET) { ! sock = SockSetup(sock); } if (sock != INVALID_SOCKET) { n = 1; if (saPtr->sin_port != 0) { ! setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof(n)); } if (bind(sock, (struct sockaddr *) saPtr, ! sizeof(struct sockaddr_in)) != 0) { ns_sockclose(sock); sock = INVALID_SOCKET; --- 331,349 ---- { SOCKET sock; ! int n; sock = socket(AF_INET, SOCK_STREAM, 0); + if (sock != INVALID_SOCKET) { ! sock = SockSetup(sock); } if (sock != INVALID_SOCKET) { n = 1; if (saPtr->sin_port != 0) { ! setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, ! (char *) &n, sizeof(n)); } if (bind(sock, (struct sockaddr *) saPtr, ! sizeof(struct sockaddr_in)) != 0) { ns_sockclose(sock); sock = INVALID_SOCKET; *************** *** 339,349 **** * Ns_SockConnect -- * ! * Open a TCP connection to a host/port. * * Results: ! * A socket, or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 360,370 ---- * Ns_SockConnect -- * ! * Open a TCP connection to a host/port. * * Results: ! * A socket, or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 368,378 **** * Ns_SockAsyncConnect -- * ! * Like Ns_SockConnect, but uses a nonblocking socket. * * Results: ! * A socket, or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 389,399 ---- * Ns_SockAsyncConnect -- * ! * Like Ns_SockConnect, but uses a nonblocking socket. * * Results: ! * A socket, or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 397,407 **** * Ns_SockTimedConnect -- * ! * Like Ns_SockConnect, but with an optional timeout in seconds. * * Results: ! * A socket, or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 418,428 ---- * Ns_SockTimedConnect -- * ! * Like Ns_SockConnect, but with an optional timeout in seconds. * * Results: ! * A socket, or -1 on error. * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 418,424 **** Ns_Time *timePtr) { ! SOCKET sock; ! int err; ! socklen_t len; /* --- 439,445 ---- Ns_Time *timePtr) { ! SOCKET sock; ! int err; ! socklen_t len; /* *************** *** 431,435 **** len = sizeof(err); if (Ns_SockTimedWait(sock, NS_SOCK_WRITE, timePtr) == NS_OK ! && getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == 0 && err == 0) { return sock; --- 452,457 ---- len = sizeof(err); if (Ns_SockTimedWait(sock, NS_SOCK_WRITE, timePtr) == NS_OK ! && getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *) &err, ! &len) == 0 && err == 0) { return sock; *************** *** 438,441 **** --- 460,464 ---- sock = INVALID_SOCKET; } + return sock; } *************** *** 447,457 **** * Ns_SockSetNonBlocking -- * ! * Set a socket nonblocking. * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 470,480 ---- * Ns_SockSetNonBlocking -- * ! * Set a socket nonblocking. * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 461,470 **** Ns_SockSetNonBlocking(SOCKET sock) { ! unsigned long i; ! i = 1; ! if (ns_sockioctl(sock, FIONBIO, &i) == -1) { return NS_ERROR; } return NS_OK; } --- 484,493 ---- Ns_SockSetNonBlocking(SOCKET sock) { ! unsigned long nb = 1; ! if (ns_sockioctl(sock, FIONBIO, &nb) == -1) { return NS_ERROR; } + return NS_OK; } *************** *** 476,486 **** * Ns_SockSetBlocking -- * ! * Set a socket blocking. * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 499,509 ---- * Ns_SockSetBlocking -- * ! * Set a socket blocking. * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 490,499 **** Ns_SockSetBlocking(SOCKET sock) { ! unsigned long i; ! i = 0; ! if (ns_sockioctl(sock, FIONBIO, &i) == -1) { return NS_ERROR; } return NS_OK; } --- 513,522 ---- Ns_SockSetBlocking(SOCKET sock) { ! unsigned long nb = 0; ! if (ns_sockioctl(sock, FIONBIO, &nb) == -1) { return NS_ERROR; } + return NS_OK; } *************** *** 505,516 **** * Ns_GetSockAddr -- * ! * Take a host/port and fill in a sockaddr_in structure ! * appropriately. Host may be an IP address or a DNS name. * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * May perform DNS query. * *---------------------------------------------------------------------- --- 528,539 ---- * Ns_GetSockAddr -- * ! * Take a host/port and fill in a sockaddr_in structure ! * appropriately. Host may be an IP address or a DNS name. * * Results: ! * NS_OK/NS_ERROR * * Side effects: ! * May perform DNS query. * *---------------------------------------------------------------------- *************** *** 520,525 **** Ns_GetSockAddr(struct sockaddr_in *saPtr, char *host, int port) { ! struct in_addr ia; ! Ns_DString ds; if (host == NULL) { --- 543,548 ---- Ns_GetSockAddr(struct sockaddr_in *saPtr, char *host, int port) { ! struct in_addr ia; ! Ns_DString ds; if (host == NULL) { *************** *** 528,541 **** ia.s_addr = inet_addr(host); if (ia.s_addr == INADDR_NONE) { ! Ns_DStringInit(&ds); ! if (Ns_GetAddrByHost(&ds, host) == NS_TRUE) { ! ia.s_addr = inet_addr(ds.string); ! } ! Ns_DStringFree(&ds); ! if (ia.s_addr == INADDR_NONE) { ! return NS_ERROR; ! } ! } } memset(saPtr, 0, sizeof(struct sockaddr_in)); saPtr->sin_family = AF_INET; --- 551,565 ---- ia.s_addr = inet_addr(host); if (ia.s_addr == INADDR_NONE) { ! Ns_DStringInit(&ds); ! if (Ns_GetAddrByHost(&ds, host) == NS_TRUE) { ! ia.s_addr = inet_addr(ds.string); ! } ! Ns_DStringFree(&ds); ! if (ia.s_addr == INADDR_NONE) { ! return NS_ERROR; ! } ! } } + memset(saPtr, 0, sizeof(struct sockaddr_in)); saPtr->sin_family = AF_INET; *************** *** 552,562 **** * Ns_SockPipe -- * ! * Create a pair of unix-domain sockets. * * Results: ! * See socketpair(2) * * Side effects: ! * None. * *---------------------------------------------------------------------- --- 576,586 ---- * Ns_SockPipe -- * ! * Create a pair of unix-domain sockets. * * Results: ! * See socketpair(2) * * Side effects: ! * None. * *---------------------------------------------------------------------- *************** *** 569,572 **** --- 593,597 ---- return NS_ERROR; } + return NS_OK; } *************** *** 578,588 **** * SockConnect -- * ! * Open a TCP connection to a host/port. * * Results: ! * A socket or -1 on error. * * Side effects: ! * If async is true, the returned socket will be nonblocking. * *---------------------------------------------------------------------- --- 603,613 ---- * SockConnect -- * ! * Open a TCP connection to a host/port. * * Results: ! * A socket or -1 on error. * * Side effects: ! * If async is true, the returned socket will be nonblocking. * *---------------------------------------------------------------------- *************** *** 598,602 **** if (Ns_GetSockAddr(&sa, host, port) != NS_OK || ! Ns_GetSockAddr(&lsa, lhost, lport) != NS_OK) { return INVALID_SOCKET; } --- 623,627 ---- if (Ns_GetSockAddr(&sa, host, port) != NS_OK || ! Ns_GetSockAddr(&lsa, lhost, lport) != NS_OK) { return INVALID_SOCKET; } *************** *** 617,620 **** --- 642,646 ---- } } + return sock; } *************** *** 626,637 **** * Ns_SockCloseLater -- * ! * Register a callback to close a socket when writable. This ! * is necessary for timed-out async connecting sockets on NT. * * Results: ! * NS_OK or NS_ERROR from Ns_SockCallback. * * Side effects: ! * Socket will be closed sometime in the future. * *---------------------------------------------------------------------- --- 652,663 ---- * Ns_SockCloseLater -- * ! * Register a callback to close a socket when writable. This ! * is necessary for timed-out async connecting sockets on NT. * * Results: ! * NS_OK or NS_ERROR from Ns_SockCallback. * * Side effects: ! * Socket will be closed sometime in the future. * *---------------------------------------------------------------------- *************** *** 657,667 **** * Ns_SockErrno -- * ! * Errno/GetLastError utility routines. * * Results: ! * See code. * * Side effects: ! * May set last error. * *---------------------------------------------------------------------- --- 683,693 ---- * Ns_SockErrno -- * ! * Errno/GetLastError utility routines. * * Results: ! * See code. * * Side effects: ! * May set last error. * *---------------------------------------------------------------------- *************** *** 778,788 **** * SockSetup -- * ! * Setup new sockets for close-on-exec and possibly duped high. * * Results: ! * Current or duped socket. * * Side effects: ! * Original socket is closed if duped. * *---------------------------------------------------------------------- --- 804,814 ---- * SockSetup -- * ! * Setup new sockets for close-on-exec and possibly duped high. * * Results: ! * Current or duped socket. * * Side effects: ! * Original socket is closed if duped. * *---------------------------------------------------------------------- *************** *** 797,802 **** nsock = fcntl(sock, F_DUPFD, 256); if (nsock != -1) { ! close(sock); ! sock = nsock; } #endif --- 823,828 ---- nsock = fcntl(sock, F_DUPFD, 256); if (nsock != -1) { ! close(sock); ! sock = nsock; } #endif |
From: Zoran V. <vas...@us...> - 2006-01-24 13:24:20
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5973/nsd Modified Files: sock.c tcljob.c tclsock.c Log Message: Implemented RFE #1413620. Changed all C-API calls accepting an integer timeout in seconds/msecs to allow Ns_Time struct ptr instead. Index: sock.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/sock.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sock.c 4 Jan 2006 10:15:52 -0000 1.7 --- sock.c 24 Jan 2006 13:24:01 -0000 1.8 *************** *** 93,97 **** int ! Ns_SockRecvBufs(SOCKET sock, struct iovec *bufs, int nbufs, int timeout) { int n; --- 93,97 ---- int ! Ns_SockRecvBufs(SOCKET sock, struct iovec *bufs, int nbufs, Ns_Time *timeoutPtr) { int n; *************** *** 100,104 **** if (n < 0 && ns_sockerrno == EWOULDBLOCK ! && Ns_SockWait(sock, NS_SOCK_READ, timeout) == NS_OK) { n = SockRecv(sock, bufs, nbufs); } --- 100,104 ---- if (n < 0 && ns_sockerrno == EWOULDBLOCK ! && Ns_SockTimedWait(sock, NS_SOCK_READ, timeoutPtr) == NS_OK) { n = SockRecv(sock, bufs, nbufs); } *************** *** 107,111 **** int ! Ns_SockSendBufs(SOCKET sock, struct iovec *bufs, int nbufs, int timeout) { int n; --- 107,111 ---- int ! Ns_SockSendBufs(SOCKET sock, struct iovec *bufs, int nbufs, Ns_Time *timeoutPtr) { int n; *************** *** 114,118 **** if (n < 0 && ns_sockerrno == EWOULDBLOCK ! && Ns_SockWait(sock, NS_SOCK_WRITE, timeout) == NS_OK) { n = SockSend(sock, bufs, nbufs); } --- 114,118 ---- if (n < 0 && ns_sockerrno == EWOULDBLOCK ! && Ns_SockTimedWait(sock, NS_SOCK_WRITE, timeoutPtr) == NS_OK) { n = SockSend(sock, bufs, nbufs); } *************** *** 138,142 **** int ! Ns_SockRecv(SOCKET sock, void *buf, size_t toread, int timeout) { int nread; --- 138,142 ---- int ! Ns_SockRecv(SOCKET sock, void *buf, size_t toread, Ns_Time *timePtr) { int nread; *************** *** 145,149 **** if (nread == -1 && ns_sockerrno == EWOULDBLOCK ! && Ns_SockWait(sock, NS_SOCK_READ, timeout) == NS_OK) { nread = recv(sock, buf, toread, 0); } --- 145,149 ---- if (nread == -1 && ns_sockerrno == EWOULDBLOCK ! && Ns_SockTimedWait(sock, NS_SOCK_READ, timePtr) == NS_OK) { nread = recv(sock, buf, toread, 0); } *************** *** 170,174 **** int ! Ns_SockSend(SOCKET sock, void *buf, size_t towrite, int timeout) { int nwrote; --- 170,174 ---- int ! Ns_SockSend(SOCKET sock, void *buf, size_t towrite, Ns_Time *timeoutPtr) { int nwrote; *************** *** 177,181 **** if (nwrote == -1 && ns_sockerrno == EWOULDBLOCK ! && Ns_SockWait(sock, NS_SOCK_WRITE, timeout) == NS_OK) { nwrote = send(sock, buf, towrite, 0); } --- 177,181 ---- if (nwrote == -1 && ns_sockerrno == EWOULDBLOCK ! && Ns_SockTimedWait(sock, NS_SOCK_WRITE, timeoutPtr) == NS_OK) { nwrote = send(sock, buf, towrite, 0); } *************** *** 187,191 **** *---------------------------------------------------------------------- * ! * Ns_SockWait -- * * Wait for I/O. --- 187,191 ---- *---------------------------------------------------------------------- * ! * Ns_SockTimedWait -- * * Wait for I/O. *************** *** 201,235 **** int ! Ns_SockWait(SOCKET sock, int what, int timeout) { struct pollfd pfd; - int n; - if (timeout < 0) { - return NS_TIMEOUT; - } - timeout *= 1000; pfd.fd = sock; switch (what) { case NS_SOCK_READ: ! pfd.events = POLLIN; ! break; case NS_SOCK_WRITE: ! pfd.events = POLLOUT; ! break; case NS_SOCK_EXCEPTION: ! pfd.events = POLLPRI; ! break; default: ! return NS_ERROR; ! break; } pfd.revents = 0; do { ! n = poll(&pfd, 1, timeout); } while (n < 0 && errno == EINTR); if (n > 0) { ! return NS_OK; } return NS_TIMEOUT; } --- 201,233 ---- int ! Ns_SockTimedWait(SOCKET sock, int what, Ns_Time *timeoutPtr) { + int n, msec = timeoutPtr->sec * 1000 + timeoutPtr->usec / 1000; struct pollfd pfd; pfd.fd = sock; + switch (what) { case NS_SOCK_READ: ! pfd.events = POLLIN; ! break; case NS_SOCK_WRITE: ! pfd.events = POLLOUT; ! break; case NS_SOCK_EXCEPTION: ! pfd.events = POLLPRI; ! break; default: ! return NS_ERROR; ! break; } pfd.revents = 0; do { ! n = poll(&pfd, 1, msec); } while (n < 0 && errno == EINTR); if (n > 0) { ! return NS_OK; } + return NS_TIMEOUT; } *************** *** 411,421 **** SOCKET ! Ns_SockTimedConnect(char *host, int port, int timeout) { ! return Ns_SockTimedConnect2(host, port, NULL, 0, timeout); } SOCKET ! Ns_SockTimedConnect2(char *host, int port, char *lhost, int lport, int timeout) { SOCKET sock; --- 409,420 ---- SOCKET ! Ns_SockTimedConnect(char *host, int port, Ns_Time *timePtr) { ! return Ns_SockTimedConnect2(host, port, NULL, 0, timePtr); } SOCKET ! Ns_SockTimedConnect2(char *host, int port, char *lhost, int lport, ! Ns_Time *timePtr) { SOCKET sock; *************** *** 431,435 **** if (sock != INVALID_SOCKET) { len = sizeof(err); ! if (Ns_SockWait(sock, NS_SOCK_WRITE, timeout) == NS_OK && getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == 0 && err == 0) { --- 430,434 ---- if (sock != INVALID_SOCKET) { len = sizeof(err); ! if (Ns_SockTimedWait(sock, NS_SOCK_WRITE, timePtr) == NS_OK && getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len) == 0 && err == 0) { Index: tclsock.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclsock.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tclsock.c 13 Jun 2005 01:47:18 -0000 1.5 --- tclsock.c 24 Jan 2006 13:24:01 -0000 1.6 *************** *** 377,387 **** { SOCKET sock; char *host, *lhost = NULL, *opt, *val; ! int lport = 0, port, first, async = 0, timeout = -1; if (objc < 3 || objc > 9) { syntax: Tcl_WrongNumArgs(interp, 1, objv, ! "?(-nonblock | -async) | -timeout seconds? " "?-localhost host? ?-localport port? host port"); return TCL_ERROR; --- 377,388 ---- { SOCKET sock; + Ns_Time timeout; char *host, *lhost = NULL, *opt, *val; ! int lport = 0, port, first, async = 0, msec = -1; if (objc < 3 || objc > 9) { syntax: Tcl_WrongNumArgs(interp, 1, objv, ! "?(-nonblock | -async) | -timeout timeout? " "?-localhost host? ?-localport port? host port"); return TCL_ERROR; *************** *** 392,396 **** * -nonblock | -async * or ! * -timeout seconds * combinations are accepted. */ --- 393,397 ---- * -nonblock | -async * or ! * -timeout seconds?:microseconds? * combinations are accepted. */ *************** *** 402,406 **** } if (STREQ(opt, "-nonblock") || STREQ(opt, "-async")) { ! if (timeout >= 0) { goto syntax; } --- 403,407 ---- } if (STREQ(opt, "-nonblock") || STREQ(opt, "-async")) { ! if (msec >= 0) { goto syntax; } *************** *** 420,426 **** goto syntax; } ! if (Tcl_GetIntFromObj(interp, objv[first], &timeout) != TCL_OK) { return TCL_ERROR; } } else if (STREQ(opt, "-localport")) { if (++first >= objc) { --- 421,428 ---- goto syntax; } ! if (Ns_TclGetTimeFromObj(interp, objv[first], &timeout) != TCL_OK) { return TCL_ERROR; } + msec = timeout.sec * 1000 + timeout.usec / 1000; } else if (STREQ(opt, "-localport")) { if (++first >= objc) { *************** *** 477,484 **** if (async) { sock = Ns_SockAsyncConnect2(host, port, lhost, lport); ! } else if (timeout < 0) { sock = Ns_SockConnect2(host, port, lhost, lport); } else { ! sock = Ns_SockTimedConnect2(host, port, lhost, lport, timeout); } --- 479,486 ---- if (async) { sock = Ns_SockAsyncConnect2(host, port, lhost, lport); ! } else if (msec < 0) { sock = Ns_SockConnect2(host, port, lhost, lport); } else { ! sock = Ns_SockTimedConnect2(host, port, lhost, lport, &timeout); } *************** *** 527,531 **** status = TCL_ERROR; if (objc != 6 && objc != 4) { ! Tcl_WrongNumArgs(interp, 1, objv, "?-timeout sec? rfds wfds efds"); return TCL_ERROR; } --- 529,534 ---- status = TCL_ERROR; if (objc != 6 && objc != 4) { ! badargs: ! Tcl_WrongNumArgs(interp, 1, objv, "?-timeout timeout? rfds wfds efds"); return TCL_ERROR; } *************** *** 536,541 **** tvPtr = &tv; if (strcmp(Tcl_GetString(objv[1]), "-timeout") != 0) { ! Tcl_WrongNumArgs(interp, 1, objv, "?-timeout sec? rfds wfds efds"); ! return TCL_ERROR; } if (Ns_TclGetTimeFromObj(interp, objv[2], &timeout) != TCL_OK) { --- 539,543 ---- tvPtr = &tv; if (strcmp(Tcl_GetString(objv[1]), "-timeout") != 0) { ! goto badargs; } if (Ns_TclGetTimeFromObj(interp, objv[2], &timeout) != TCL_OK) { Index: tcljob.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tcljob.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcljob.c 18 Jan 2006 02:26:53 -0000 1.7 --- tcljob.c 24 Jan 2006 13:24:01 -0000 1.8 *************** *** 565,569 **** if ((objc != 4) && (objc != 6)) { Tcl_WrongNumArgs(interp, 2, objv, ! "?-timeout seconds:microseconds? queueId jobId"); return TCL_ERROR; } --- 565,569 ---- if ((objc != 4) && (objc != 6)) { Tcl_WrongNumArgs(interp, 2, objv, ! "?-timeout timeout? queueId jobId"); return TCL_ERROR; } *************** *** 727,732 **** argIndex = 2; if ((objc != 3) && (objc != 5)) { ! Tcl_WrongNumArgs(interp, 2, objv, ! "?-timeout seconds:microseconds? queueId"); return TCL_ERROR; } --- 727,731 ---- argIndex = 2; if ((objc != 3) && (objc != 5)) { ! Tcl_WrongNumArgs(interp, 2, objv, "?-timeout timeout? queueId"); return TCL_ERROR; } |
From: Zoran V. <vas...@us...> - 2006-01-24 13:24:20
|
Update of /cvsroot/naviserver/naviserver/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5973/include Modified Files: ns.h Log Message: Implemented RFE #1413620. Changed all C-API calls accepting an integer timeout in seconds/msecs to allow Ns_Time struct ptr instead. Index: ns.h =================================================================== RCS file: /cvsroot/naviserver/naviserver/include/ns.h,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** ns.h 20 Jan 2006 06:04:59 -0000 1.69 --- ns.h 24 Jan 2006 13:24:01 -0000 1.70 *************** *** 478,483 **** char *address; /* Address in location, e.g. "foo" */ char *protocol; /* Protocol in location, e.g, "http" */ ! int sendwait; /* send() I/O timeout. */ ! int recvwait; /* recv() I/O timeout. */ int bufsize; /* Conn bufsize (0 for SSL) */ int sndbuf; /* setsockopt() SNDBUF option. */ --- 478,483 ---- char *address; /* Address in location, e.g. "foo" */ char *protocol; /* Protocol in location, e.g, "http" */ ! int sendwait; /* send() I/O timeout in seconds */ ! int recvwait; /* recv() I/O timeout in seconds */ int bufsize; /* Conn bufsize (0 for SSL) */ int sndbuf; /* setsockopt() SNDBUF option. */ *************** *** 1660,1669 **** */ ! NS_EXTERN int Ns_SockRecv(SOCKET sock, void *vbuf, size_t nrecv, int timeout); ! NS_EXTERN int Ns_SockSend(SOCKET sock, void *vbuf, size_t nsend, int timeout); ! NS_EXTERN int Ns_SockWait(SOCKET sock, int what, int timeout); ! ! NS_EXTERN int Ns_SockRecvBufs(SOCKET sock, struct iovec *bufs, int nbufs, int timeout); ! NS_EXTERN int Ns_SockSendBufs(SOCKET sock, struct iovec *bufs, int nbufs, int timeout); NS_EXTERN SOCKET Ns_BindSock(struct sockaddr_in *psa) NS_GNUC_DEPRECATED; --- 1660,1672 ---- */ ! NS_EXTERN int Ns_SockTimedWait(SOCKET sock, int what, Ns_Time *timeoutPtr); ! NS_EXTERN int Ns_SockRecv(SOCKET sock, void *vbuf, size_t nrecv, ! Ns_Time *timeoutPtr); ! NS_EXTERN int Ns_SockSend(SOCKET sock, void *vbuf, size_t nsend, ! Ns_Time *timeoutPtr); ! NS_EXTERN int Ns_SockRecvBufs(SOCKET sock, struct iovec *bufs, int nbufs, ! Ns_Time *timeoutPtr); ! NS_EXTERN int Ns_SockSendBufs(SOCKET sock, struct iovec *bufs, int nbufs, ! Ns_Time *timeoutPtr); NS_EXTERN SOCKET Ns_BindSock(struct sockaddr_in *psa) NS_GNUC_DEPRECATED; *************** *** 1676,1681 **** NS_EXTERN SOCKET Ns_SockAsyncConnect(char *host, int port); NS_EXTERN SOCKET Ns_SockAsyncConnect2(char *host, int port, char *lhost, int lport); ! NS_EXTERN SOCKET Ns_SockTimedConnect(char *host, int port, int timeout); ! NS_EXTERN SOCKET Ns_SockTimedConnect2(char *host, int port, char *lhost, int lport, int timeout); NS_EXTERN int Ns_SockSetNonBlocking(SOCKET sock); --- 1679,1685 ---- NS_EXTERN SOCKET Ns_SockAsyncConnect(char *host, int port); NS_EXTERN SOCKET Ns_SockAsyncConnect2(char *host, int port, char *lhost, int lport); ! NS_EXTERN SOCKET Ns_SockTimedConnect(char *host, int port, Ns_Time *timeoutPtr); ! NS_EXTERN SOCKET Ns_SockTimedConnect2(char *host, int port, char *lhost, int lport, ! Ns_Time *timeoutPtr); NS_EXTERN int Ns_SockSetNonBlocking(SOCKET sock); |
From: Zoran V. <vas...@us...> - 2006-01-24 13:24:20
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5973 Modified Files: ChangeLog Log Message: Implemented RFE #1413620. Changed all C-API calls accepting an integer timeout in seconds/msecs to allow Ns_Time struct ptr instead. Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.286 retrieving revision 1.287 diff -C2 -d -r1.286 -r1.287 *** ChangeLog 23 Jan 2006 15:57:33 -0000 1.286 --- ChangeLog 24 Jan 2006 13:24:01 -0000 1.287 *************** *** 1,2 **** --- 1,14 ---- + 2006-01-24 Zoran Vasiljevic <vas...@us...> + + ATTENTION: C-compatibility affected. + + * include/ns.h + * nsd/sock.c: + * nsd/tcljob.c: + * nsd/tclsock.c: + * nsd/nssock.c: Implemented RFE #1413620. Changed + all C-API calls accepting an integer timeout in + seconds/msecs to allow Ns_Time struct ptr instead. + 2006-01-23 Vlad Seryakov <ser...@us...> |
From: Zoran V. <vas...@us...> - 2006-01-24 13:24:20
|
Update of /cvsroot/naviserver/naviserver/nssock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5973/nssock Modified Files: nssock.c Log Message: Implemented RFE #1413620. Changed all C-API calls accepting an integer timeout in seconds/msecs to allow Ns_Time struct ptr instead. Index: nssock.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nssock/nssock.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** nssock.c 12 Nov 2005 18:30:40 -0000 1.3 --- nssock.c 24 Jan 2006 13:24:01 -0000 1.4 *************** *** 109,133 **** { int n; switch (cmd) { case DriverRecv: ! n = Ns_SockRecvBufs(sock->sock, bufs, nbufs, sock->driver->recvwait); ! break; ! case DriverSend: ! n = Ns_SockSendBufs(sock->sock, bufs, nbufs, sock->driver->sendwait); ! break; ! case DriverKeep: case DriverClose: ! /* NB: Nothing to do. */ ! n = 0; ! break; ! default: ! /* Unsupported command. */ ! n = -1; ! break; } return n; } --- 109,136 ---- { int n; + Ns_Time timeout = {0,0}; switch (cmd) { case DriverRecv: ! timeout.sec = sock->driver->recvwait; ! n = Ns_SockRecvBufs(sock->sock, bufs, nbufs, &timeout); ! break; case DriverSend: ! timeout.sec = sock->driver->sendwait; ! n = Ns_SockSendBufs(sock->sock, bufs, nbufs, &timeout); ! break; ! case DriverKeep: case DriverClose: ! /* NB: Nothing to do. */ ! n = 0; ! break; ! default: ! /* Unsupported command. */ ! n = -1; ! break; } + return n; } |
From: Vlad S. <ser...@us...> - 2006-01-23 15:57:46
|
Update of /cvsroot/naviserver/naviserver/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24311/tests Modified Files: ns_cache.test ns_info.test Log Message: Index: ns_cache.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_cache.test,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ns_cache.test 30 Dec 2005 11:07:34 -0000 1.1 --- ns_cache.test 23 Jan 2006 15:57:33 -0000 1.2 *************** *** 49,52 **** --- 49,56 ---- test cache-1.9 {basic syntax} -body { + ns_cache_exists + } -returnCodes error -result {wrong # args: should be "ns_cache_exists cache key"} + + test cache-1.10 {basic syntax} -body { ns_memoize } -returnCodes error -result {wrong # args: should be "?-timeout timeout? ?-ttl ttl? ?--? script ?args?"} *************** *** 56,60 **** test cache-2.1 {cache names} -body { lsort [ns_cache_names] ! } -result {c1 c2 ns:memoize} --- 60,64 ---- test cache-2.1 {cache names} -body { lsort [ns_cache_names] ! } -result {c1 c2 ns:filecache ns:memoize} *************** *** 89,93 **** --- 93,109 ---- } -result {k1 k2} + test cache-4.5 {cache exists} -body { + ns_cache_eval c1 k1 {return a} + ns_cache_exists c1 k1 + } -cleanup { + ns_cache_flush c1 + } -result {1} + test cache-4.6 {cache exists} -body { + ns_cache_eval c1 k1 {return a} + ns_cache_exists c1 k2 + } -cleanup { + ns_cache_flush c1 + } -result {0} test cache-5.1 {cache flush} -body { Index: ns_info.test =================================================================== RCS file: /cvsroot/naviserver/naviserver/tests/ns_info.test,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ns_info.test 23 Dec 2005 04:27:22 -0000 1.7 --- ns_info.test 23 Jan 2006 15:57:33 -0000 1.8 *************** *** 95,99 **** test ns_info-2.19.1 {basic operation} -body { ! expr {[llength [ns_info pools]]>0} } -result 1 --- 95,99 ---- test ns_info-2.19.1 {basic operation} -body { ! expr {[llength [ns_info pools]]<=0} } -result 1 |
From: Vlad S. <ser...@us...> - 2006-01-23 15:57:46
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24311 Modified Files: ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.285 retrieving revision 1.286 diff -C2 -d -r1.285 -r1.286 *** ChangeLog 23 Jan 2006 15:20:39 -0000 1.285 --- ChangeLog 23 Jan 2006 15:57:33 -0000 1.286 *************** *** 3,6 **** --- 3,10 ---- * m4/tcl.m4: Fixed bug with extra single quote for bash 3.1 + * tests/nscache.test: + * nsd/tclcache.c: + * nsd/tclcmds.c: Added ns_cache_exists command for cases when + just existence needed without retrieving the whole cache entry 2006-01-23 Bernd Eidenschink <ei...@us...> |
From: Vlad S. <ser...@us...> - 2006-01-23 15:57:46
|
Update of /cvsroot/naviserver/naviserver/nsd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24311/nsd Modified Files: tclcache.c tclcmds.c Log Message: Index: tclcmds.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclcmds.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** tclcmds.c 12 Jan 2006 01:17:57 -0000 1.29 --- tclcmds.c 23 Jan 2006 15:57:33 -0000 1.30 *************** *** 75,78 **** --- 75,79 ---- NsTclCacheFlushObjCmd, NsTclCacheIncrObjCmd, + NsTclCacheExistsObjCmd, NsTclCacheKeysObjCmd, NsTclCacheLappendObjCmd, *************** *** 258,261 **** --- 259,263 ---- {"ns_cache_flush", NULL, NsTclCacheFlushObjCmd}, {"ns_cache_incr", NULL, NsTclCacheIncrObjCmd}, + {"ns_cache_exists", NULL, NsTclCacheExistsObjCmd}, {"ns_cache_keys", NULL, NsTclCacheKeysObjCmd}, {"ns_cache_lappend", NULL, NsTclCacheLappendObjCmd}, Index: tclcache.c =================================================================== RCS file: /cvsroot/naviserver/naviserver/nsd/tclcache.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tclcache.c 30 Dec 2005 11:07:34 -0000 1.1 --- tclcache.c 23 Jan 2006 15:57:33 -0000 1.2 *************** *** 192,196 **** * * Treat the value of the cached object as in integer and ! * increment it. No value is trated as starting at zero.a * * Results: --- 192,196 ---- * * Treat the value of the cached object as in integer and ! * increment it. No value is treated as starting at zero.a * * Results: *************** *** 243,246 **** --- 243,288 ---- } + /* + *---------------------------------------------------------------------- + * + * NsTclCacheExistsObjCmd -- + * + * Returns 1 if entry exists in the cache and not expired yet + * + * Results: + * TCL result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + + int + NsTclCacheExistsObjCmd(ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) + { + Ns_Cache *cache; + Ns_Entry *entry; + char *key; + int rc = 0; + + Ns_ObjvSpec args[] = { + {"cache", ObjvCache, &cache, arg}, + {"key", Ns_ObjvString, &key, NULL}, + {NULL, NULL, NULL, NULL} + }; + if (Ns_ParseObjv(NULL, args, interp, 1, objc, objv) != NS_OK) { + return TCL_ERROR; + } + Ns_CacheLock(cache); + if ((entry = Ns_CacheFindEntry(cache, key)) != NULL) { + rc = 1; + } + Ns_CacheUnlock(cache); + Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); + + return TCL_OK; + } + /* |
From: Vlad S. <ser...@us...> - 2006-01-23 15:20:49
|
Update of /cvsroot/naviserver/naviserver/m4 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9683/m4 Modified Files: tcl.m4 Log Message: Index: tcl.m4 =================================================================== RCS file: /cvsroot/naviserver/naviserver/m4/tcl.m4,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcl.m4 20 Jan 2006 21:40:24 -0000 1.3 --- tcl.m4 23 Jan 2006 15:20:40 -0000 1.4 *************** *** 864,868 **** if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then ! system=MP-RAS-`awk '{print $3}' /etc/.relid'` fi if test "`uname -s`" = "AIX" ; then --- 864,868 ---- if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then ! system=MP-RAS-`awk '{print $3}' /etc/.relid` fi if test "`uname -s`" = "AIX" ; then |
From: Vlad S. <ser...@us...> - 2006-01-23 15:20:49
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9683 Modified Files: ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.284 retrieving revision 1.285 diff -C2 -d -r1.284 -r1.285 *** ChangeLog 23 Jan 2006 10:09:09 -0000 1.284 --- ChangeLog 23 Jan 2006 15:20:39 -0000 1.285 *************** *** 1,2 **** --- 1,7 ---- + 2006-01-23 Vlad Seryakov <ser...@us...> + + * m4/tcl.m4: Fixed bug with extra single quote for + bash 3.1 + 2006-01-23 Bernd Eidenschink <ei...@us...> |
From: Bernd E. <ei...@us...> - 2006-01-23 10:09:18
|
Update of /cvsroot/naviserver/naviserver/doc/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26256/doc/html Added Files: ns_sendmail.html Log Message: see ChangeLog --- NEW FILE: ns_sendmail.html --- <html><head> <title>ns_sendmail - NaviServer Built-In Commands </title> </head> <! -- Generated from file 'ns_sendmail.man' by tcllib/doctools with format 'html' --> <! -- CVS: $Id: ns_sendmail.html,v 1.1 2006/01/23 10:09:09 eide Exp $ ns_sendmail.3 --> <body> <h1> ns_sendmail(3) 1.0 ns_sendmail "NaviServer Built-In Commands"</h1> <h2><a name="name">NAME</a></h2> <p> <p> ns_sendmail - sending mail <h2><a name="table_of_contents">TABLE OF CONTENTS</a></h2> <p> <a href="#table_of_contents">TABLE OF CONTENTS</a><br> <a href="#synopsis">SYNOPSIS</a><br> <a href="#description">DESCRIPTION</a><br> <a href="#commands">COMMANDS</a><br> <a href="#configuration">CONFIGURATION</a><br> <a href="#alternatives">ALTERNATIVES</a><br> <a href="#examples">EXAMPLES</a><br> <a href="#see_also">SEE ALSO</a><br> <a href="#keywords">KEYWORDS</a><br> <h2><a name="synopsis">SYNOPSIS</a></h2> <p> <table border=1 width=100% cellspacing=0 cellpadding=0><tr bgcolor=lightyellow><td bgcolor=lightyellow><table 0 width=100% cellspacing=0 cellpadding=0><tr valign=top ><td ><a href="#1"><b class='cmd'>ns_sendmail</b> <i class='arg'>to</i> <i class='arg'>from</i> <i class='arg'>subject</i> <i class='arg'>body</i> ?headers? ?bcc? ?cc?</a></td></tr> <tr valign=top ><td ><a href="#2"><b class='cmd'>ns_sendmail_config</b> ?log?</a></td></tr> </table></td></tr></table> <h2><a name="description">DESCRIPTION</a></h2> <p> <em>ns_sendmail</em> is a procedure for sending email from a Tcl script through a remote SMTP server. It now supports character encoding of subject and body, message-id creation, quoted printable text and AUTH PLAIN mechanism. It is backwards compatible. <p> The helper command <em>ns_sendmail_config</em> returns or logs the current configuration for ns_sendmail. <p> In the default configuration mail is sent to "localhost" on port 25. Usually "localhost" resolves to the host where NaviServer is deployed and the running SMTP server accepts mail from the local machine. <p> In order to send mail directly to a specified SMTP server other than localhost some form of authentication may be required. The AUTH PLAIN mechanism is supported as it is offered by most SMTP servers and easy to implement. Note, however, it is a plaintext mechanism and not secure. Also note that ns_sendmail does not verify if AUTH PLAIN is offered by the SMTP server at all. In case of an error the error code and message are returned. <h2><a name="commands">COMMANDS</a></h2> <p> <dl> <dt><a name="1"><b class='cmd'>ns_sendmail</b> <i class='arg'>to</i> <i class='arg'>from</i> <i class='arg'>subject</i> <i class='arg'>body</i> ?headers? ?bcc? ?cc?</a><dd> <i class='arg'>to</i> Email address of recipient. To send a real name along with the address give the name and place the latter between "<" and ">" like "John Foo <j....@ex...>". This also applies to <em>from</em>, <em>cc</em> and <em>bcc</em>. Can be a comma-separated string with multiple recipients. <br><br> <i class='arg'>from</i> Email address of sender. <br><br> <i class='arg'>subject</i> Subject of the mail. <br><br> <i class='arg'>body</i> Body of the mail. <br><br> <i class='arg'>?headers?</i> An ns_set of key-value pairs. The set will become part of the email header. May be left empty. <br><br> <i class='arg'>?bcc?</i> Email address of undisclosed recipient. Can be a comma-separated string with multiple undisclosed recipients. <br><br> <i class='arg'>?cc?</i> Email address of additional recipient. Can be a comma-separated string with multiple recipients. <br><br> <dt><a name="2"><b class='cmd'>ns_sendmail_config</b> ?log?</a><dd> ns_sendmail_config returns the current configuration that is set up in the configuration file. Returns either an array usable by "array get" or logs to the server logfile. </dl> <h2><a name="configuration">CONFIGURATION</a></h2> <p> <p> <em>Basic configuration options:</em> <dl> <dt>smtphost = mail.domain.tld<dd> The hostname or IP of the mail server. Default is localhost. Full qualified hostname is a good choice (mail.example.com). <br><br> <dt>smtpport = 25<dd> The port for the connection. Default is 25. <br><br> <dt>smtptimeout = 60<dd> After smtptimeout seconds of inactivity (no answer from server) connection is closed. </dl> <p> <em>Extended configuration options:</em> <p> Note: "boolean" in NaviServer configuration means value can be one of "true", "false", "on", "off", "0" or "1". <dl> <dt>smtplogmode = false (boolean)<dd> If true no attempt to set up a connection to smtphost:smtpport is made, every part of the connection process is just logged to the server logfile. Default is false. <br><br> <dt>smtpmsgid = on (boolean)<dd> If true ns_sendmail creates a message_id. If a key "message_id" is user defined in the optional "headers"-set the latter is used. Default is false. <br><br> <dt>smtpmsgidhostname = host.domain.tld<dd> This string is used when ns_sendmail tells the server that it wants to use SMTP (HELO host.domain.tld) or ESMTP (EHLO host.domain.tld) communication. Some servers have restrictive rules and expect fully qualified domain names here. It is further used as right part of the message-id. <br><br> <dt>smtpencodingmode = on (boolean)<dd> Message subject and body are by default sent in the default server encoding. If this is set true (a) the encoding defined in smtpencoding will be used and (b) Subject and body will be transformed to QUOTED PRINTABLE format. Default is false. <br><br> <dt>smtpencoding = utf-8<dd> If smtpencodingmode is set true subject and body will be encoded with the encoding defined in smtpencoding, e.g. "iso8859-15". <br><br> <dt>smtpauthuser = account--0123<dd> ns_sendmail supports now the simple PLAIN AUTH mechanism to authenticate against a SMTP server. It should be sufficient to provide a mailbox account or email address ("smtpauthuser") and a password (see "smtpauthpassword"). It is possible to give a different authorization identifier (userid) and authentication identifier (authid/realm) by separating them with a nullbyte ("userid\0realm"). Default is empty string to not use SMTP authentication. <br><br> <dt>smtpauthpassword = mysecret<dd> The password to use for PLAIN AUTHentication if smtpauthuser is set. </dl> <h2><a name="alternatives">ALTERNATIVES</a></h2> <p> See the excellent TCL Standard Library smtp and mime packages. <h2><a name="examples">EXAMPLES</a></h2> <p> <em>Log current configuration to server log:</em> <p><table><tr><td bgcolor=black> </td><td><pre class='sample'> % ns_sendmail_config log smtpconfiguration: smtphost = mail.domain.tld smtpport = 25 smtptimeout = 60 smtplogmode = false smtpmsgid = on smtpmsgidhostname = host.domain.tld smtpencodingmode = on smtpencoding = iso8859-15 smtpauthuser = account--0123 smtpauthpassword = mysecret </pre></td></tr></table></p> <p> <em>Default use:</em> <p><table><tr><td bgcolor=black> </td><td><pre class='sample'> % ns_sendmail to...@ex... fr...@ex... "My subject" "My body" </pre></td></tr></table></p> <p> <em>Separate multiple recipients with a comma (to,cc,bcc):</em> <p><table><tr><td bgcolor=black> </td><td><pre class='sample'> % ns_sendmail "to...@ex...,to...@ex..." \ fr...@ex... "My subject" "My body" </pre></td></tr></table></p> <p> <em>You may give real names along with email address:</em> <p><table><tr><td bgcolor=black> </td><td><pre class='sample'> % ns_sendmail "Jo Foo <to...@ex...>,Pete Bar <to...@ex...>" \ fr...@ex... "My subject" "My body" </pre></td></tr></table></p> <p> <em>For cc and bcc, leave header field empty, if you don't need it anyway:</em> <p><table><tr><td bgcolor=black> </td><td><pre class='sample'> % ns_sendmail "Jo Foo <to...@ex...>,Pete Bar <to...@ex...>" \ fr...@ex... "My subject" "My body" "" "Ben Care <be...@ex...>" </pre></td></tr></table></p> <p> <em>Header field is an ns_set array:</em> <p><table><tr><td bgcolor=black> </td><td><pre class='sample'> % set SMTP_setid [ns_set create SMTPHeaders "Reply-To" "mar...@ex..."] % ns_sendmail "Jo Foo <to...@ex...>,Pete Bar <to...@ex...>" \ fr...@ex... "My subject" "My body" $SMTP_setid \ "Ben Care <be...@ex...>" </pre></td></tr></table></p> <p> <em>Use smtplogmode to not send mail but watch transaction in server log:</em> <p><table><tr><td bgcolor=black> </td><td><pre class='sample'> % ns_sendmail "Mr. White <wh...@ex...>" "Mr. Black <bl...@ex...>" "log" "this message" Notice: S: Helo sock12 HELO devserver 60 Notice: S: Mail bl...@ex... sock12 MAIL FROM:<bl...@ex...> 60 Notice: S: Rcpt wh...@ex... sock12 RCPT TO:<wh...@ex...> 60 Notice: S: Data sock12 DATA 60 Notice: S: Data sock12 To: Mr. White <wh...@ex...> From: Mr. Black <bl...@ex...> Subject: log Date: Mon, 23 Jan 2006 09:25:22 GMT this message . 60 Notice: S: Quit sock12 QUIT 60 </pre></td></tr></table></p> <h2><a name="see_also">SEE ALSO</a></h2> <p> nsd <h2><a name="keywords">KEYWORDS</a></h2> <p> NaviServer, RFC2822, mail, ns_sendmail, ns_sendmail_config, smtp </body></html> |
From: Bernd E. <ei...@us...> - 2006-01-23 10:09:18
|
Update of /cvsroot/naviserver/naviserver/doc/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26256/doc/src Added Files: ns_sendmail.man README.doc Log Message: see ChangeLog --- NEW FILE: ns_sendmail.man --- [manpage_begin ns_sendmail 3 1.0] [moddesc {NaviServer Built-In Commands}] [titledesc {sending mail}] [description] [emph ns_sendmail] is a procedure for sending email from a Tcl script through a remote SMTP server. It now supports character encoding of subject and body, message-id creation, quoted printable text and AUTH PLAIN mechanism. It is backwards compatible. [para] The helper command [emph ns_sendmail_config] returns or logs the current configuration for ns_sendmail. [para] In the default configuration mail is sent to "localhost" on port 25. Usually "localhost" resolves to the host where NaviServer is deployed and the running SMTP server accepts mail from the local machine. [para] In order to send mail directly to a specified SMTP server other than localhost some form of authentication may be required. The AUTH PLAIN mechanism is supported as it is offered by most SMTP servers and easy to implement. Note, however, it is a plaintext mechanism and not secure. Also note that ns_sendmail does not verify if AUTH PLAIN is offered by the SMTP server at all. In case of an error the error code and message are returned. [section COMMANDS] [list_begin definitions] [call [cmd ns_sendmail] [arg to] [arg from] [arg subject] [arg body] [opt headers] [opt bcc] [opt cc]] [arg to] Email address of recipient. To send a real name along with the address give the name and place the latter between "<" and ">" like "John Foo <j....@ex...>". This also applies to [emph from], [emph cc] and [emph bcc]. Can be a comma-separated string with multiple recipients. [nl] [arg from] Email address of sender. [nl] [arg subject] Subject of the mail. [nl] [arg body] Body of the mail. [nl] [arg ?headers?] An ns_set of key-value pairs. The set will become part of the email header. May be left empty. [nl] [arg ?bcc?] Email address of undisclosed recipient. Can be a comma-separated string with multiple undisclosed recipients. [nl] [arg ?cc?] Email address of additional recipient. Can be a comma-separated string with multiple recipients. [call [cmd ns_sendmail_config] [opt log]] ns_sendmail_config returns the current configuration that is set up in the configuration file. Returns either an array usable by "array get" or logs to the server logfile. [list_end] [section CONFIGURATION] [para] [strong {Basic configuration options:}] [list_begin definitions] [lst_item "smtphost = mail.domain.tld"] The hostname or IP of the mail server. Default is localhost. Full qualified hostname is a good choice (mail.example.com). [lst_item "smtpport = 25"] The port for the connection. Default is 25. [lst_item "smtptimeout = 60"] After smtptimeout seconds of inactivity (no answer from server) connection is closed. [list_end] [para] [strong {Extended configuration options:}] [para] Note: "boolean" in NaviServer configuration means value can be one of "true", "false", "on", "off", "0" or "1". [list_begin definitions] [lst_item "smtplogmode = false (boolean)"] If true no attempt to set up a connection to smtphost:smtpport is made, every part of the connection process is just logged to the server logfile. Default is false. [lst_item "smtpmsgid = on (boolean)"] If true ns_sendmail creates a message_id. If a key "message_id" is user defined in the optional "headers"-set the latter is used. Default is false. [lst_item "smtpmsgidhostname = host.domain.tld"] This string is used when ns_sendmail tells the server that it wants to use SMTP (HELO host.domain.tld) or ESMTP (EHLO host.domain.tld) communication. Some servers have restrictive rules and expect fully qualified domain names here. It is further used as right part of the message-id. [lst_item "smtpencodingmode = on (boolean)"] Message subject and body are by default sent in the default server encoding. If this is set true (a) the encoding defined in smtpencoding will be used and (b) Subject and body will be transformed to QUOTED PRINTABLE format. Default is false. [lst_item "smtpencoding = utf-8"] If smtpencodingmode is set true subject and body will be encoded with the encoding defined in smtpencoding, e.g. "iso8859-15". [lst_item "smtpauthuser = account--0123"] ns_sendmail supports now the simple PLAIN AUTH mechanism to authenticate against a SMTP server. It should be sufficient to provide a mailbox account or email address ("smtpauthuser") and a password (see "smtpauthpassword"). It is possible to give a different authorization identifier (userid) and authentication identifier (authid/realm) by separating them with a nullbyte ("userid\0realm"). Default is empty string to not use SMTP authentication. [lst_item "smtpauthpassword = mysecret"] The password to use for PLAIN AUTHentication if smtpauthuser is set. [list_end] [section ALTERNATIVES] See the excellent TCL Standard Library smtp and mime packages. [section EXAMPLES] [emph "Log current configuration to server log:"] [example_begin] % ns_sendmail_config log smtpconfiguration: smtphost = mail.domain.tld smtpport = 25 smtptimeout = 60 smtplogmode = false smtpmsgid = on smtpmsgidhostname = host.domain.tld smtpencodingmode = on smtpencoding = iso8859-15 smtpauthuser = account--0123 smtpauthpassword = mysecret [example_end] [para] [emph "Default use:"] [example_begin] % ns_sendmail to...@ex... fr...@ex... "My subject" "My body" [example_end] [para] [emph "Separate multiple recipients with a comma (to,cc,bcc):"] [example_begin] % ns_sendmail "to...@ex...,to...@ex..." \ fr...@ex... "My subject" "My body" [example_end] [para] [emph "You may give real names along with email address:"] [example_begin] % ns_sendmail "Jo Foo <to...@ex...>,Pete Bar <to...@ex...>" \ fr...@ex... "My subject" "My body" [example_end] [para] [emph "For cc and bcc, leave header field empty, if you don't need it anyway:"] [example_begin] % ns_sendmail "Jo Foo <to...@ex...>,Pete Bar <to...@ex...>" \ fr...@ex... "My subject" "My body" "" "Ben Care <be...@ex...>" [example_end] [para] [emph "Header field is an ns_set array:"] [example_begin] % set SMTP_setid [lb]ns_set create SMTPHeaders "Reply-To" "mar...@ex..."[rb] % ns_sendmail "Jo Foo <to...@ex...>,Pete Bar <to...@ex...>" \ fr...@ex... "My subject" "My body" $SMTP_setid \ "Ben Care <be...@ex...>" [example_end] [para] [emph "Use smtplogmode to not send mail but watch transaction in server log:"] [example_begin] % ns_sendmail "Mr. White <wh...@ex...>" "Mr. Black <bl...@ex...>" "log" "this message" Notice: S: Helo sock12 HELO devserver 60 Notice: S: Mail bl...@ex... sock12 MAIL FROM:<bl...@ex...> 60 Notice: S: Rcpt wh...@ex... sock12 RCPT TO:<wh...@ex...> 60 Notice: S: Data sock12 DATA 60 Notice: S: Data sock12 To: Mr. White <wh...@ex...> From: Mr. Black <bl...@ex...> Subject: log Date: Mon, 23 Jan 2006 09:25:22 GMT this message . 60 Notice: S: Quit sock12 QUIT 60 [example_end] [see_also nsd] [keywords NaviServer ns_sendmail ns_sendmail_config mail smtp RFC2822] [manpage_end] --- NEW FILE: README.doc --- $Id: README.doc,v 1.1 2006/01/23 10:09:10 eide Exp $ This directory holds NaviServer documentation sources in doctools format. Use 'dtplite' (part of tcllib) to create various target formats like nroff or HTML. Creation of documentation will be automated and eventually become part of the build process. Examples: % dtplite -o - nroff ns_sendmail.man >ns_sendmail.n % dtplite -o - html ns_sendmail.man >ns_sendmail.html Man supports also compressed pages: % dtplite -o - nroff ns_sendmail.man | gzip >ns_sendmail.n.gz % man -l ns_sendmail.n.gz |
From: Bernd E. <ei...@us...> - 2006-01-23 10:09:18
|
Update of /cvsroot/naviserver/naviserver/tcl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26256/tcl Modified Files: sendmail.tcl Log Message: see ChangeLog Index: sendmail.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/tcl/sendmail.tcl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sendmail.tcl 16 Feb 2005 16:45:45 -0000 1.2 --- sendmail.tcl 23 Jan 2006 10:09:09 -0000 1.3 *************** *** 28,31 **** --- 28,33 ---- # + # $Header$ + # # sendmail.tcl - Define the ns_sendmail procedure for sending *************** *** 33,40 **** # ! proc _ns_smtp_send { mode wfp string timeout} { ! ! if {[lindex [ns_sockselect -timeout $timeout {} $wfp {}] 1] == ""} { ! error "$mode: Timeout writing to SMTP host" } puts $wfp $string\r --- 35,47 ---- # ! proc _ns_smtp_send { mode wfp string timeout } { ! ! if {[ns_config -bool ns/parameters "smtplogmode" false]} { ! ns_log notice "S: $mode $wfp $string $timeout" ! return "" ! } ! ! if {[lindex [ns_sockselect -timeout $timeout {} $wfp {}] 1] == ""} { ! error "$mode: Timeout writing to SMTP host" } puts $wfp $string\r *************** *** 43,47 **** proc _ns_smtp_recv { mode rfp check timeout { error 1 } } { ! while (1) { if {[lindex [ns_sockselect -timeout $timeout $rfp {} {}] 0] == ""} { --- 50,58 ---- proc _ns_smtp_recv { mode rfp check timeout { error 1 } } { ! ! if {[ns_config -bool ns/parameters "smtplogmode" false]} { ! return "" ! } ! while (1) { if {[lindex [ns_sockselect -timeout $timeout $rfp {} {}] 0] == ""} { *************** *** 60,63 **** --- 71,129 ---- } + proc ns_sendmail_config { { mode "" } } { + set myset [ns_set create smtpconfiguration \ + smtphost [ns_config ns/parameters smtphost] \ + smtpport [ns_config ns/parameters smtpport] \ + smtptimeout [ns_config ns/parameters smtptimeout] \ + smtplogmode [ns_config ns/parameters smtplogmode] \ + smtpmsgid [ns_config ns/parameters smtpmsgid] \ + smtpmsgidhostname [ns_config ns/parameters smtpmsgidhostname] \ + smtpencodingmode [ns_config ns/parameters smtpencodingmode] \ + smtpencoding [ns_config ns/parameters smtpencoding] \ + smtpauthuser [ns_config ns/parameters smtpauthuser] \ + smtpauthpassword [ns_config ns/parameters smtpauthpassword]] + if { $mode eq "log" } { + ns_log notice [ns_set print $myset] + return + } + return [ns_set array $myset] + } + + proc _ns_sendmail_qp { str } { + + # first step: quote characters where necessary + regsub -all -- \ + {[\x00-\x08\x0B-\x1E\x21-\x24\x3D\x40\x5B-\x5E\x60\x7B-\xFF]} \ + $str {[format =%02X [scan "\\&" %c]]} str + set str [subst -novariable $str] + + # second step: handle some special cases + set _map [list "\t\n" "=09\n" " \n" "=20\n" "\n\.\n" "\n=2E\n"] + + return [string map $_map $str] + + } + + proc _ns_sendmail_breaklines { str } { + + set brokenlines "" + foreach line [split $str "\n"] { + while {[string length $line] > 72} { + if {[regexp -indices -- {(=|=.)$} [string range $line 0 71] _findex]} { + set _index_fragment [expr {[lindex $_findex 0] -1}] + append brokenlines "[string range $line 0 $_index_fragment]=\n" + incr _index_fragment +1 + set line [string range $line $_index_fragment end] + } else { + regexp -- {(.{72})(.*)} $line all first_72 line + append brokenlines "${first_72}=\n" + } + } + append brokenlines "${line}\n" + } + return [regsub -- {\n$} $brokenlines ""] + + } + proc ns_sendmail { to from subject body {headers {}} {bcc {}} {cc {}} } { *************** *** 77,115 **** } } ! ## Get smtp server into, if none then use localhost set smtp [ns_config ns/parameters smtphost] ! if [string match "" $smtp] { set smtp [ns_config ns/parameters mailhost] } ! if [string match "" $smtp] { set smtp localhost } ! set timeout [ns_config ns/parameters smtptimeout] ! if [string match "" $timeout] { set timeout 60 } ! set smtpport [ns_config ns/parameters smtpport] ! if [string match "" $smtpport] { set smtpport 25 } - ## Extract "from" email address - if [regexp {.*<(.*)>} $from d address] { set from $address } - ## Prepare to,cc,bcc address lists set tolist [list] ! regsub -all {[\n\r ]} $to {} to foreach addr [split $to ,] { - if { [regexp {.*<(.*)>} $addr d address] } { set addr $address } if { [set addr [string trim $addr]] != "" } { lappend tolist $addr } } set cclist [list] ! regsub -all {[\n\r ]} $cc {} cc foreach addr [split $cc ,] { - if { [regexp {.*<(.*)>} $addr d address] } { set addr $address } if { [set addr [string trim $addr]] != "" } { lappend cclist $addr } } set bcclist [list] ! regsub -all {[\n\r ]} $bcc {} bcc foreach addr [split $bcc ,] { - if { [regexp {.*<(.*)>} $addr d address] } { set addr $address } if { [set addr [string trim $addr]] != "" } { lappend bcclist $addr } } ! ## Send it along to _ns_sendmail _ns_sendmail $smtp $smtpport $timeout $tolist $cclist $bcclist \ --- 143,200 ---- } } ! ## Get smtp server into, if none then use localhost set smtp [ns_config ns/parameters smtphost] ! if [string match "" $smtp] { ! set smtp [ns_config ns/parameters mailhost "localhost"] ! } ! set timeout [ns_config ns/parameters smtptimeout "60"] ! set smtpport [ns_config ns/parameters smtpport "25"] ! ## Apply an encoding if configured; by default off ! if {[ns_config ns/parameters smtpencodingmode false]} { ! set target_encoding [ns_config ns/parameters smtpencoding "utf-8"] ! if {[string length $subject] != [string bytelength [encoding convertto $target_encoding $subject]]} { ! # just to satisfy pedantic spam rules (0.0 points anyway): ! # 0.0 SUBJECT_EXCESS_QP Subject: quoted-printable encoded unnecessarily ! set subject "=?$target_encoding?Q?[_ns_sendmail_qp [encoding convertto $target_encoding $subject]]?=" ! } ! set body [_ns_sendmail_breaklines [_ns_sendmail_qp [encoding convertto $target_encoding $body]]] ! if { $headers == "" } { ! set headers [ns_set create headers] ! ns_set put $headers "MIME-Version" "1.0" ! ns_set put $headers "Content-Type" "text/plain; charset=\"${target_encoding}\"" ! ns_set put $headers "Content-Transfer-Encoding" "quoted-printable" ! } else { ! if {[ns_set iget $headers "content-type"] eq "" } { ! ns_set put $headers "Content-Type" "text/plain; charset=\"${target_encoding}\"" ! } ! if {[ns_set iget $headers "content-transfer-encoding"] eq "" } { ! ns_set put $headers "Content-Transfer-Encoding" "quoted-printable" ! } ! if {[ns_set iget $headers "mime-version"] eq ""} { ! ns_set put $headers "MIME-Version" "1.0" ! } ! } ! } ## Prepare to,cc,bcc address lists set tolist [list] ! regsub -all {[\n\r]} $to {} to foreach addr [split $to ,] { if { [set addr [string trim $addr]] != "" } { lappend tolist $addr } } set cclist [list] ! regsub -all {[\n\r]} $cc {} cc foreach addr [split $cc ,] { if { [set addr [string trim $addr]] != "" } { lappend cclist $addr } } set bcclist [list] ! regsub -all {[\n\r]} $bcc {} bcc foreach addr [split $bcc ,] { if { [set addr [string trim $addr]] != "" } { lappend bcclist $addr } } ! ## Send it along to _ns_sendmail _ns_sendmail $smtp $smtpport $timeout $tolist $cclist $bcclist \ *************** *** 118,127 **** proc _ns_sendmail {smtp smtpport timeout tolist cclist bcclist from subject body headers} { ! ## Put the tolist in the headers set rfcto [join $tolist ", "] ! ## Build headers ! set msg "To: $rfcto\nFrom: $from\nSubject: $subject\nDate: [ns_httptime [ns_time]]\n" ## CC recipients in separate header --- 203,217 ---- proc _ns_sendmail {smtp smtpport timeout tolist cclist bcclist from subject body headers} { ! ## Put the tolist in the headers set rfcto [join $tolist ", "] ! ## Build headers ! set _date [ns_httptime [ns_time]] ! ! set msg "To: $rfcto\nFrom: $from\nSubject: $subject\nDate: $_date\n" ! ! ## make sure we only work with the address itself from here on ! regexp {.*<(.*)>} $from null from ## CC recipients in separate header *************** *** 135,139 **** } } ! ## Blank line between headers and body append msg "\n$body\n" --- 225,241 ---- } } ! ## If no Message-ID is specified, produce one if smtpmsgid is true ! ## See RFC2822(message identifier) ! if { [ns_config ns/parameters smtpmsgid false] && ($headers eq "" || \ ! ($headers ne "" && [ns_set iget $headers "message-id"] eq ""))} { ! if {[set _msg_0 [ns_config ns/parameters smtpmsgidhostname]] eq ""} { ! set _msg_0 [ns_info hostname] ! } ! set _msg_1 [string range [ns_sha1 "$from$tolist$subject[clock seconds][ns_info threads]"] 0 14] ! set _msg_2 [clock format [clock seconds] -format "%Y%m%d"] ! set _msg_id "$_msg_1.$_msg_2@$_msg_0" ! append msg "Message-ID: <$_msg_id>\n" ! } ! ## Blank line between headers and body append msg "\n$body\n" *************** *** 146,150 **** } append data . ! ## Open the connection set sock [ns_sockopen $smtp $smtpport] --- 248,252 ---- } append data . ! ## Open the connection set sock [ns_sockopen $smtp $smtpport] *************** *** 152,166 **** set wfp [lindex $sock 1] ! ## Perform the SMTP conversation if { [catch { _ns_smtp_recv "Start" $rfp 220 $timeout ! _ns_smtp_send "Helo" $wfp "HELO [ns_info hostname]" $timeout ! _ns_smtp_recv "Helo" $rfp 250 $timeout _ns_smtp_send "Mail $from" $wfp "MAIL FROM:<$from>" $timeout _ns_smtp_recv "Mail $from" $rfp 250 $timeout - ## Loop through To list via multiple RCPT TO lines foreach to $tolist { if { $to == "" } { continue } _ns_smtp_send "Rcpt $to" $wfp "RCPT TO:<$to>" $timeout _ns_smtp_recv "Rcpt $to" $rfp 250 $timeout 0 --- 254,292 ---- set wfp [lindex $sock 1] ! ## Perform the (E)SMTP conversation if { [catch { _ns_smtp_recv "Start" $rfp 220 $timeout ! ! set _authuser [ns_config ns/parameters smtpauthuser] ! set _authpass [ns_config ns/parameters smtpauthpassword] ! set _hostname [ns_info hostname] ! if {[ns_config ns/parameters smtpmsgidhostname] ne ""} { ! set _hostname [ns_config ns/parameters smtpmsgidhostname] ! } ! if {$_authuser ne "" && $_authpass ne ""} { ! _ns_smtp_send "EHLO" $wfp "EHLO $_hostname" $timeout ! _ns_smtp_recv "EHLO" $rfp 250 $timeout ! ! if {[llength [split $_authuser "\0"]]==1} { ! # default case: equal user and realm ! set _authtoken "${_authuser}\0${_authuser}\0${_authpass}" ! } else { ! # self constructed user and realm ! set _authtoken "${_authuser}\0${_authpass}" ! } ! _ns_smtp_send "AUTH PLAIN" $wfp \ ! "AUTH PLAIN [ns_base64encode $_authtoken]" $timeout ! _ns_smtp_recv "AUTH PLAIN" $rfp 235 $timeout ! } else { ! _ns_smtp_send "Helo" $wfp "HELO $_hostname" $timeout ! _ns_smtp_recv "Helo" $rfp 250 $timeout ! } ! _ns_smtp_send "Mail $from" $wfp "MAIL FROM:<$from>" $timeout _ns_smtp_recv "Mail $from" $rfp 250 $timeout ## Loop through To list via multiple RCPT TO lines foreach to $tolist { if { $to == "" } { continue } + regexp {.*<(.*)>} $to null to _ns_smtp_send "Rcpt $to" $wfp "RCPT TO:<$to>" $timeout _ns_smtp_recv "Rcpt $to" $rfp 250 $timeout 0 *************** *** 170,185 **** foreach to $cclist { if { $to == "" } { continue } _ns_smtp_send "Rcpt $to" $wfp "RCPT TO:<$to>" $timeout _ns_smtp_recv "Rcpt $to" $rfp 250 $timeout 0 } ! ## Loop through BCC list via multiple RCPT TO lines ## A BCC should never, ever appear in the header. Ever. Not even. foreach to $bcclist { if { $to == "" } { continue } _ns_smtp_send "Rcpt $to" $wfp "RCPT TO:<$to>" $timeout _ns_smtp_recv "Rcpt $to" $rfp 250 $timeout 0 } ! _ns_smtp_send Data $wfp DATA $timeout _ns_smtp_recv Data $rfp 354 $timeout --- 296,313 ---- foreach to $cclist { if { $to == "" } { continue } + regexp {.*<(.*)>} $to null to _ns_smtp_send "Rcpt $to" $wfp "RCPT TO:<$to>" $timeout _ns_smtp_recv "Rcpt $to" $rfp 250 $timeout 0 } ! ## Loop through BCC list via multiple RCPT TO lines ## A BCC should never, ever appear in the header. Ever. Not even. foreach to $bcclist { if { $to == "" } { continue } + regexp {.*<(.*)>} $to null to _ns_smtp_send "Rcpt $to" $wfp "RCPT TO:<$to>" $timeout _ns_smtp_recv "Rcpt $to" $rfp 250 $timeout 0 } ! _ns_smtp_send Data $wfp DATA $timeout _ns_smtp_recv Data $rfp 354 $timeout |
From: Bernd E. <ei...@us...> - 2006-01-23 10:09:18
|
Update of /cvsroot/naviserver/naviserver/doc/man In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26256/doc/man Added Files: ns_sendmail.n Log Message: see ChangeLog --- NEW FILE: ns_sendmail.n --- '\" '\" Generated from file 'ns_sendmail.man' by tcllib/doctools with format 'nroff' '\" .so man.macros .TH "ns_sendmail" 3 1.0 ns_sendmail "NaviServer Built-In Commands" .BS .SH "NAME" ns_sendmail \- sending mail .SH "SYNOPSIS" \fBns_sendmail\fR \fIto\fR \fIfrom\fR \fIsubject\fR \fIbody\fR ?headers? ?bcc? ?cc? .sp \fBns_sendmail_config\fR ?log? .sp .BE .SH "DESCRIPTION" \fIns_sendmail\fR is a procedure for sending email from a Tcl script through a remote SMTP server. It now supports character encoding of subject and body, message-id creation, quoted printable text and AUTH PLAIN mechanism. It is backwards compatible. .PP The helper command \fIns_sendmail_config\fR returns or logs the current configuration for ns_sendmail. .PP In the default configuration mail is sent to "localhost" on port 25. Usually "localhost" resolves to the host where NaviServer is deployed and the running SMTP server accepts mail from the local machine. .PP In order to send mail directly to a specified SMTP server other than localhost some form of authentication may be required. The AUTH PLAIN mechanism is supported as it is offered by most SMTP servers and easy to implement. Note, however, it is a plaintext mechanism and not secure. Also note that ns_sendmail does not verify if AUTH PLAIN is offered by the SMTP server at all. In case of an error the error code and message are returned. .SH "COMMANDS" .TP \fBns_sendmail\fR \fIto\fR \fIfrom\fR \fIsubject\fR \fIbody\fR ?headers? ?bcc? ?cc? \fIto\fR Email address of recipient. To send a real name along with the address give the name and place the latter between "<" and ">" like "John Foo <j....@ex...>". This also applies to \fIfrom\fR, \fIcc\fR and \fIbcc\fR. Can be a comma-separated string with multiple recipients. .sp \fIfrom\fR Email address of sender. .sp \fIsubject\fR Subject of the mail. .sp \fIbody\fR Body of the mail. .sp \fI?headers?\fR An ns_set of key-value pairs. The set will become part of the email header. May be left empty. .sp \fI?bcc?\fR Email address of undisclosed recipient. Can be a comma-separated string with multiple undisclosed recipients. .sp \fI?cc?\fR Email address of additional recipient. Can be a comma-separated string with multiple recipients. .TP \fBns_sendmail_config\fR ?log? ns_sendmail_config returns the current configuration that is set up in the configuration file. Returns either an array usable by "array get" or logs to the server logfile. .SH "CONFIGURATION" .PP \fIBasic configuration options:\fR .TP smtphost = mail.domain.tld The hostname or IP of the mail server. Default is localhost. Full qualified hostname is a good choice (mail.example.com). .TP smtpport = 25 The port for the connection. Default is 25. .TP smtptimeout = 60 After smtptimeout seconds of inactivity (no answer from server) connection is closed. .PP \fIExtended configuration options:\fR .PP Note: "boolean" in NaviServer configuration means value can be one of "true", "false", "on", "off", "0" or "1". .TP smtplogmode = false (boolean) If true no attempt to set up a connection to smtphost:smtpport is made, every part of the connection process is just logged to the server logfile. Default is false. .TP smtpmsgid = on (boolean) If true ns_sendmail creates a message_id. If a key "message_id" is user defined in the optional "headers"-set the latter is used. Default is false. .TP smtpmsgidhostname = host.domain.tld This string is used when ns_sendmail tells the server that it wants to use SMTP (HELO host.domain.tld) or ESMTP (EHLO host.domain.tld) communication. Some servers have restrictive rules and expect fully qualified domain names here. It is further used as right part of the message-id. .TP smtpencodingmode = on (boolean) Message subject and body are by default sent in the default server encoding. If this is set true (a) the encoding defined in smtpencoding will be used and (b) Subject and body will be transformed to QUOTED PRINTABLE format. Default is false. .TP smtpencoding = utf-8 If smtpencodingmode is set true subject and body will be encoded with the encoding defined in smtpencoding, e.g. "iso8859-15". .TP smtpauthuser = account--0123 ns_sendmail supports now the simple PLAIN AUTH mechanism to authenticate against a SMTP server. It should be sufficient to provide a mailbox account or email address ("smtpauthuser") and a password (see "smtpauthpassword"). It is possible to give a different authorization identifier (userid) and authentication identifier (authid/realm) by separating them with a nullbyte ("userid\\0realm"). Default is empty string to not use SMTP authentication. .TP smtpauthpassword = mysecret The password to use for PLAIN AUTHentication if smtpauthuser is set. .SH "ALTERNATIVES" See the excellent TCL Standard Library smtp and mime packages. .SH "EXAMPLES" \fILog current configuration to server log:\fR .nf % ns_sendmail_config log smtpconfiguration: smtphost = mail.domain.tld smtpport = 25 smtptimeout = 60 smtplogmode = false smtpmsgid = on smtpmsgidhostname = host.domain.tld smtpencodingmode = on smtpencoding = iso8859-15 smtpauthuser = account--0123 smtpauthpassword = mysecret .fi .PP \fIDefault use:\fR .nf % ns_sendmail to...@ex... fr...@ex... "My subject" "My body" .fi .PP \fISeparate multiple recipients with a comma (to,cc,bcc):\fR .nf % ns_sendmail "to...@ex...,to...@ex..." \\ fr...@ex... "My subject" "My body" .fi .PP \fIYou may give real names along with email address:\fR .nf % ns_sendmail "Jo Foo <to...@ex...>,Pete Bar <to...@ex...>" \\ fr...@ex... "My subject" "My body" .fi .PP \fIFor cc and bcc, leave header field empty, if you don't need it anyway:\fR .nf % ns_sendmail "Jo Foo <to...@ex...>,Pete Bar <to...@ex...>" \\ fr...@ex... "My subject" "My body" "" "Ben Care <be...@ex...>" .fi .PP \fIHeader field is an ns_set array:\fR .nf % set SMTP_setid [ns_set create SMTPHeaders "Reply-To" "mar...@ex..."] % ns_sendmail "Jo Foo <to...@ex...>,Pete Bar <to...@ex...>" \\ fr...@ex... "My subject" "My body" $SMTP_setid \\ "Ben Care <be...@ex...>" .fi .PP \fIUse smtplogmode to not send mail but watch transaction in server log:\fR .nf % ns_sendmail "Mr. White <wh...@ex...>" "Mr. Black <bl...@ex...>" "log" "this message" Notice: S: Helo sock12 HELO devserver 60 Notice: S: Mail bl...@ex... sock12 MAIL FROM:<bl...@ex...> 60 Notice: S: Rcpt wh...@ex... sock12 RCPT TO:<wh...@ex...> 60 Notice: S: Data sock12 DATA 60 Notice: S: Data sock12 To: Mr. White <wh...@ex...> From: Mr. Black <bl...@ex...> Subject: log Date: Mon, 23 Jan 2006 09:25:22 GMT this message . 60 Notice: S: Quit sock12 QUIT 60 .fi .SH "SEE ALSO" nsd .SH "KEYWORDS" NaviServer, RFC2822, mail, ns_sendmail, ns_sendmail_config, smtp |
From: Bernd E. <ei...@us...> - 2006-01-23 10:09:17
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26256 Modified Files: ChangeLog Log Message: see ChangeLog Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.283 retrieving revision 1.284 diff -C2 -d -r1.283 -r1.284 *** ChangeLog 20 Jan 2006 22:34:23 -0000 1.283 --- ChangeLog 23 Jan 2006 10:09:09 -0000 1.284 *************** *** 1,2 **** --- 1,13 ---- + 2006-01-23 Bernd Eidenschink <ei...@us...> + + * tcl/sendmail.tcl: Added character encoding for subject and body, + message-id creation, quoted printable text and AUTH PLAIN + mechanism (all optional). + * doc/src/ns_sendmail.man: + * doc/src/README.doc: + * doc/man/ns_sendmail.n: + * doc/html/ns_sendmail.html: Doctools documentation file for new + ns_sendmail functionality as well as examples created with dtplite + 2006-01-20 Vlad Seryakov <ser...@us...> |
From: Vlad S. <ser...@us...> - 2006-01-21 15:53:48
|
Update of /cvsroot/naviserver/naviserver/contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11329/contrib Modified Files: nsd.tcl Log Message: Index: nsd.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/contrib/nsd.tcl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** nsd.tcl 20 Jan 2006 21:40:24 -0000 1.1 --- nsd.tcl 21 Jan 2006 15:53:36 -0000 1.2 *************** *** 91,97 **** ns_section "ns/server/${server}/tcl" - ns_param debug false ns_param nsvbuckets 16 ! ns_param library ${home} ns_section "ns/server/${server}/module/nscgi" --- 91,96 ---- ns_section "ns/server/${server}/tcl" ns_param nsvbuckets 16 ! ns_param library ${home}/modules/tcl ns_section "ns/server/${server}/module/nscgi" |
From: Vlad S. <ser...@us...> - 2006-01-21 15:53:48
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11329 Modified Files: sample-config.tcl Log Message: Index: sample-config.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/sample-config.tcl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sample-config.tcl 20 Jan 2006 21:41:41 -0000 1.8 --- sample-config.tcl 21 Jan 2006 15:53:36 -0000 1.9 *************** *** 228,235 **** --- 228,238 ---- # ns_section "ns/server/${servername}/adp" + # Extensions to parse as ADP's. ns_param map "/*.adp" + # Set "Expires: now" on all ADP's. ns_param enableexpire false + # Allow Tclpro debugging with "?debug". ns_param enabledebug false *************** *** 240,247 **** --- 243,266 ---- ns_param map "/*.sjis_adp" + # ADP start page to use for empty ADP requests + #ns_param startpage $pagedir/index.adp + # ADP error page. #ns_param errorpage $pagedir/errorpage.adp + # + # Server specific Tcl setup + # + + ns_section "ns/server/${servername}/tcl" + + # Number of buckets in Tcl hash table for nsv vars + ns_param nsvbuckets 16 + + # Path to private Tcl modules + ns_param library ${homedir}/modules/tcl + + # # Fast Path -- # |
From: Vlad S. <ser...@us...> - 2006-01-20 22:34:34
|
Update of /cvsroot/naviserver/naviserver/tcl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19004/tcl Modified Files: file.tcl util.tcl Log Message: Index: file.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/tcl/file.tcl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** file.tcl 26 Apr 2005 15:59:41 -0000 1.4 --- file.tcl 20 Jan 2006 22:34:23 -0000 1.5 *************** *** 55,58 **** --- 55,60 ---- ns_register_proc HEAD /*.tcl ns_sourceproc set errorPage [ns_config "${path}/tcl" errorpage] + set size [ns_config "ns/server/[ns_info server]" filecachesize 5000000] + ns_cache_create ns:filecache $size } *************** *** 70,112 **** # ! if { ![string equal [info commands "ns_cache"] ""] } { ! ! ns_cache create util_file_contents_cached -thread 1 \ ! -size [ns_config "ns/server/[ns_info server]" SourceCacheSize 5000000] ! ! # Get the contents of a file from the cache or disk. ! proc ns_sourcefile {filename} { ! file stat $filename stat ! set current_cookie [list $stat(mtime) $stat(ctime) $stat(ino) $stat(dev)] ! set cached_p [ns_cache get util_file_contents_cached $filename pair] ! if {$cached_p} { ! set cached_cookie [lindex $pair 0] ! if {![string equal $cached_cookie $current_cookie]} { ! ns_cache flush util_file_contents_cached $filename ! set cached_p 0 ! } ! } ! if {!$cached_p} { ! # Now cache the Tcl_Obj in a thread-local cache. ! set pair [ns_cache eval util_file_contents_cached $filename { ! set fd [open $filename] ! set contents [read $fd] ! close $fd ! list $current_cookie $contents ! }] ! } ! # And here's the magic part. We're using "for" here to translate the ! # text source file into bytecode, which will be associated with the ! # Tcl_Obj we just cached (as its internal representation). "eval" ! # doesn't do this as the eval provided in Tcl uses the TCL_EVAL_DIRECT ! # flag, and hence interprets the text directly. ! uplevel [for [lindex $pair 1] {0} {} {}] ! } ! ! } else { ! proc ns_sourcefile {filename} { ! uplevel source $filename } } --- 72,97 ---- # ! # Get the contents of a file from the cache or disk. ! proc ns_sourcefile {filename} { ! file stat $filename stat ! set current_cookie [list $stat(mtime) $stat(ctime) $stat(ino) $stat(dev)] ! # Read current cached file ! set pair [ns_cache_eval ns:filecache $filename { ! list $current_cookie [ns_fileread $filename] ! }] ! # If file changed, re-read it ! if {![string equal [lindex $pair 0] $current_cookie]} { ! ns_cache_flush ns:filecache $filename ! set pair [ns_cache_eval ns:filecache $filename { ! list $current_cookie [ns_fileread $filename] ! }] } + # And here's the magic part. We're using "for" here to translate the + # text source file into bytecode, which will be associated with the + # Tcl_Obj we just cached (as its internal representation). "eval" + # doesn't do this as the eval provided in Tcl uses the TCL_EVAL_DIRECT + # flag, and hence interprets the text directly. + uplevel [for [lindex $pair 1] {0} {} {}] } Index: util.tcl =================================================================== RCS file: /cvsroot/naviserver/naviserver/tcl/util.tcl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** util.tcl 26 Mar 2005 17:42:27 -0000 1.3 --- util.tcl 20 Jan 2006 22:34:23 -0000 1.4 *************** *** 384,385 **** --- 384,403 ---- ns_set update [ns_conn outputheaders] $key $value } + + # Read contents of the given file + proc ns_fileread { filename } { + set fd [open $filename] + fconfigure $fd -translation binary -encoding binary + set data [read $fd] + close $fd + return $data + } + + # Write given data into the file + proc ns_filewrite { filename data { mode w } } { + set fd [open $filename $mode] + fconfigure $fd -translation binary -encoding binary + puts -nonewline $fd $data + close $fd + } + |
From: Vlad S. <ser...@us...> - 2006-01-20 22:34:31
|
Update of /cvsroot/naviserver/naviserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19004 Modified Files: ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/naviserver/naviserver/ChangeLog,v retrieving revision 1.282 retrieving revision 1.283 diff -C2 -d -r1.282 -r1.283 *** ChangeLog 20 Jan 2006 21:40:23 -0000 1.282 --- ChangeLog 20 Jan 2006 22:34:23 -0000 1.283 *************** *** 1,4 **** --- 1,6 ---- 2006-01-20 Vlad Seryakov <ser...@us...> + * tcl/file.tcl: Changes to use new cache API + * tcl/util.tcl: Added ns_fileread/ns_filewrite procs * tcl/stats.tcl: fixed all bugs and it runs now under naviserver properly |