cvs commit: apache-1.3 KEYS
jim 99/04/14 16:20:40 Modified:.KEYS Log: Add my [EMAIL PROTECTED] key Revision ChangesPath 1.21 +33 -0 apache-1.3/KEYS Index: KEYS === RCS file: /export/home/cvs/apache-1.3/KEYS,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- KEYS 1999/01/11 21:44:17 1.20 +++ KEYS 1999/04/14 23:20:39 1.21 @@ -84,6 +84,39 @@ =pwim -END PGP PUBLIC KEY BLOCK- +Date User ID +1999-04-14 Jim Jagielski [EMAIL PROTECTED] + +-BEGIN PGP PUBLIC KEY BLOCK- +Version: PGPfreeware 5.5.3i + +mQGiBDcUl9QRBADl5tF8kOD0uddlnl9qsaG70/hwujGTsSXATnqoLseTsWORoVXf +oBklokEAGmT2+Cl8XIXZ31Wh+GaJ3CTbEv8Ok1vapOt+ltPgOKzZEB4uP25EbhC2 +LWf+lUoafcd2Xi0KBV4fqXqEEuDGP1TAdZ6k7NVqgpjvbJ5TdqL0LrWOOwCg/0b4 ++/p/avQr+uZRU2rdmYu/b/0D/2LnjcEqUjsslh2e9m0OgAu+gnYAmQH6Dbnp+iKl +jffWPChwIMFZd/7FnGOzYDzoqnzTFyA4VE5PHWL61V2lpHJWB21K9D6rbEcx0iYB +AHHxZQEmxSBU6PmGnbF+2P7vC0Jz9gZ5dCbjtGboYxd00/XQlZwCs8jHueTpSfx9 +n7dYBACFpW+v2pSlG0ReiS6Ult3gaGWiw81D0nFVvCp5BlxgQDymyF1MS6FbCj/g +FGILosMhlsIHTFaC0DD0LSXyN1rm0ykPvi+vULIlKNJwW7fCi+33j1Azx+zfMNeO +T5vqAfF6cvsZ6qPb9CcYvU4jEKvkovA1U3jMFehqcGkTV5sfvbQeSmltIEphZ2ll +bHNraSA8amltQGFwYWNoZS5vcmc+iQBLBBARAgALBQI3FJfUBAsDAgEACgkQizpg +HwjJdeU/8ACg3mtYerA7QN/8Okp2IgGr+ge4yKgAn09RX5UR8DyZ1/Q8OFasE6T6 +Tg2UuQINBDcUl9UQCAD2Qle3CH8IF3KiutapQvMF6PlTETlPtvFuuUs4INoBp1aj +FOmPQFXz0AfGy0OplK33TGSGSfgMg71l6RfUodNQ+PVZX9x2Uk89PY3bzpnhV5JZ +zf24rnRPxfx2vIPFRzBhznzJZv8V+bv9kV7HAarTW56NoKVyOtQa8L9GAFgr5fSI +/VhOSdvNILSd5JEHNmszbDgNRR0PfIizHHxbLY7288kjwEPwpVsYjY67VYy4XTjT +NP18F1dDox0YbN4zISy1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AK +UJsCRtMIPWakXUGfnHy9iUsiGSa6q6Jew1XpMgs7AAICCACEhzcRGEc3y3/4YNaG +89FmtIRpFU5zoaZxxDrmUiS1HdhqFykv8ozaTyjfImCuhq8i6DG15oGudxPma7Ey +sCcA/qmQEBVrXFK2DYTFW3UnPyqiE822plo0d45u1csKzPvGpHYVGC4HOEKCghRy +/54nH0fsKV3VSlIXAhRG3LIstzAtslrSYELW1Lov53GK+YZpRDJTbLAxjIYB8kEY +hiQYzHm/cbBeRpjG9BpoBQh54dNOj22CU8HC4KvZSnDcLAzmDyrQFXFfffvJtQ7+ +HH2iIWKMFOjpRHh2ZK6uhJb03Yo/v+admKs1HSEFdV5VJUCkqymhKT0OiWnXmNHq +QUfliQBGBBgRAgAGBQI3FJfVAAoJEIs6YB8IyXXlME4AniogMeV3YLNf6C1Y2+k8 +F3rt0S/OAKDHF+wfxLDzCxsoQbwesIUAKgb7Hg== +=mrXV +-END PGP PUBLIC KEY BLOCK- + Type Bits/KeyIDDate User ID pub 2048/DD919C31 1996/12/24 [EMAIL PROTECTED]
cvs commit: apache-apr/apr/network_io/unix sockets.c
rbb 99/04/15 07:57:32 Modified:docs networkio.txt include apr_network_io.h apr/network_io/unix sockets.c Log: Add apr_accept function. Revision ChangesPath 1.8 +4 -5 apache-apr/docs/networkio.txt Index: networkio.txt === RCS file: /home/cvs/apache-apr/docs/networkio.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- networkio.txt 1999/04/14 21:03:01 1.7 +++ networkio.txt 1999/04/15 14:57:30 1.8 @@ -120,17 +120,16 @@ arg 2) The size of the listen queue. return) APR_SUCCESS or APR_FAILURE - APRStatus apr_accept(APRSocket, APRNetAddr *, APRSocket *) + apr_socket_t *apr_accept(apr_socket_t *) extract first connection from listen queue, and sets up a new connection on a new socket of the same type and family. It allocates a new socket for that connection. Arguments: arg 1) The file desc of a socket that is listening. The connection comes from this socket's listen queue. - arg 2) structure to store address of connecting socket. - arg 3) file descriptor of created socket. -1 on failure. - NOTE: accepted socket can not accept more connections. Original socket - remains open, and can accept more connections. + return) new socket that has the accepted connection. +NOTE: accepted socket can not accept more connections. Original socket + remains open, and can accept more connections. 1.6 +2 -0 apache-apr/include/apr_network_io.h Index: apr_network_io.h === RCS file: /home/cvs/apache-apr/include/apr_network_io.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- apr_network_io.h 1999/04/14 21:04:12 1.5 +++ apr_network_io.h 1999/04/15 14:57:31 1.6 @@ -82,8 +82,10 @@ apr_socket_t *apr_create_tcp_socket(void); apr_status_t apr_shutdown(apr_socket_t *, apr_shutdown_how_t); apr_status_t apr_close_socket(apr_socket_t *); + apr_status_t apr_bind(apr_socket_t *); apr_status_t apr_listen(apr_socket_t *, apr_int32_t); +apr_socket_t *apr_accept(const apr_socket_t *); apr_ssize_t apr_send(apr_socket_t *, const char *, int, time_t); apr_ssize_t apr_recv(apr_socket_t *, char *, int, time_t); 1.3 +13 -0 apache-apr/apr/network_io/unix/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-apr/apr/network_io/unix/sockets.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- sockets.c 1999/04/14 21:02:07 1.2 +++ sockets.c 1999/04/15 14:57:31 1.3 @@ -126,3 +126,16 @@ else return APR_SUCCESS; } + +apr_socket_t *apr_accept(const apr_socket_t *sock) +{ +apr_socket_t *new = (apr_socket_t *)malloc(sizeof(apr_socket_t)); + +new-socketdes = accept(sock-socketdes, (struct sockaddr *)new-addr, new-addr_len); + +if (new-socketdes = 0) +return new; +return NULL; +} + +
cvs commit: apache-apr/include apr_network_io.h
rbb 99/04/15 08:41:20 Modified:apr/network_io/unix networkio.h sockets.c docs networkio.txt include apr_network_io.h Log: Cleaned up some memory leaks in network code. And made the sockets know their own hostname. Revision ChangesPath 1.4 +1 -2 apache-apr/apr/network_io/unix/networkio.h Index: networkio.h === RCS file: /home/cvs/apache-apr/apr/network_io/unix/networkio.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- networkio.h 1999/04/14 21:02:06 1.3 +++ networkio.h 1999/04/15 15:41:18 1.4 @@ -56,10 +56,9 @@ #ifndef NETWORK_IO_H #define NETWORK_IO_H - struct socket_t { int socketdes; -char *hostname; +char hostname[MAXHOSTNAMELEN]; struct sockaddr_in *addr; size_t addr_len; }; 1.4 +10 -1 apache-apr/apr/network_io/unix/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-apr/apr/network_io/unix/sockets.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- sockets.c 1999/04/15 14:57:31 1.3 +++ sockets.c 1999/04/15 15:41:18 1.4 @@ -66,9 +66,13 @@ { apr_socket_t *thesocket = (apr_socket_t *)malloc(sizeof(apr_socket_t)); -thesocket-hostname = NULL; thesocket-socketdes = socket(AF_INET ,SOCK_STREAM, IPPROTO_TCP); +if (gethostname(thesocket-hostname, MAXHOSTNAMELEN + 1) == -1) { +free(thesocket); +return NULL; +} + thesocket-addr = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in)); thesocket-addr-sin_family = AF_INET; thesocket-addr-sin_addr.s_addr = INADDR_ANY; @@ -76,6 +80,8 @@ thesocket-addr_len = sizeof(thesocket-addr); if (thesocket-socketdes 0) { +free(thesocket-addr); +free(thesocket); return NULL; } else { @@ -131,10 +137,13 @@ { apr_socket_t *new = (apr_socket_t *)malloc(sizeof(apr_socket_t)); +strcpy(new-hostname, sock-hostname); + new-socketdes = accept(sock-socketdes, (struct sockaddr *)new-addr, new-addr_len); if (new-socketdes = 0) return new; +free(new); return NULL; } 1.9 +10 -10apache-apr/docs/networkio.txt Index: networkio.txt === RCS file: /home/cvs/apache-apr/docs/networkio.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- networkio.txt 1999/04/15 14:57:30 1.8 +++ networkio.txt 1999/04/15 15:41:19 1.9 @@ -133,16 +133,6 @@ - APRStatus apr_initializenetaddr(APRNetAddrValue, APRUInt16, APRNetAddr); - Initialize the fields of a APRNetAddr. assigning well known values - as appropriate. This function only sets up values in the APRNetAddr - structure. It does not setup the connection. - Arguments: - arg 1) The value to assign to the IP address portion of the - APRNetAddr struct. Can only specify INADDR_ANY and - INADR_LOOPBACK equivalents. - arg 2) Port number to be assigned in the struct - arg 3) The address of the APRNetAddr struct to be filled out. APRStatus apr_gethostbyname(char *, APRHostEnt) Lookup a host by name Arguments: @@ -203,6 +193,16 @@ Arguments: arg 1) The file desc of the socket to retrieve the name for. arg 2) structure to store socket address in. + APRStatus apr_initializenetaddr(APRNetAddrValue, APRUInt16, APRNetAddr); + Initialize the fields of a APRNetAddr. assigning well known values + as appropriate. This function only sets up values in the APRNetAddr + structure. It does not setup the connection. + Arguments: + arg 1) The value to assign to the IP address portion of the + APRNetAddr struct. Can only specify INADDR_ANY and + INADR_LOOPBACK equivalents. + arg 2) Port number to be assigned in the struct + arg 3) The address of the APRNetAddr struct to be filled out. IMPLEMENTATION DETAILS * 1.7 +4 -0 apache-apr/include/apr_network_io.h Index: apr_network_io.h === RCS file: /home/cvs/apache-apr/include/apr_network_io.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- apr_network_io.h 1999/04/15 14:57:31 1.6 +++ apr_network_io.h 1999/04/15 15:41:20 1.7 @@ -64,6 +64,10 @@ #define MAX_SECS_TO_LINGER 30 #endif +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif + /*
cvs commit: apache-apr/pthreads/src/main http_main.c http_accept.c
manoj 99/04/15 13:01:43 Modified:pthreads/src/main http_main.c http_accept.c Log: Enable graceful restart and MaxRequestsPerChild for the multiaccept model, using a pipe watched by poll() to wake up the server at the child's graceful shutdown time. Revision ChangesPath 1.72 +1 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -u -r1.71 -r1.72 --- http_main.c 1999/04/14 22:44:57 1.71 +++ http_main.c 1999/04/15 20:01:40 1.72 @@ -1762,6 +1762,7 @@ } ap_destroy_pool(ptrans); +kill(ap_scoreboard_image-parent[process_slot].pid, SIGWINCH); ap_update_child_status(process_slot, thread_slot, SERVER_DEAD, (request_rec *) NULL); return NULL; 1.7 +29 -24apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- http_accept.c 1999/04/14 22:44:57 1.6 +++ http_accept.c 1999/04/15 20:01:40 1.7 @@ -317,6 +317,7 @@ */ static listen_rec *head_listener; static struct pollfd *listenfds; +static int pipe_of_death; void accept_parent_init(pool *pconf, int listener_count) { @@ -329,15 +330,26 @@ int worker_threads_per_child) { int i; +int pipe_pair_of_death[2]; listen_rec *lr; SAFE_ACCEPT(accept_mutex_child_init(pchild)); requests_this_child = ap_max_requests_per_child; head_listener = ap_listeners; -listenfds = ap_palloc(pchild, sizeof(struct pollfd) * num_listenfds); +listenfds = ap_palloc(pchild, sizeof(struct pollfd) * (num_listenfds + 1)); -for (lr = ap_listeners, i = 0; i num_listenfds; lr = lr-next, ++i) { +if (pipe(pipe_pair_of_death) == -1) { +ap_log_error(APLOG_MARK, APLOG_ERR, + (const server_rec*) ap_get_server_conf(), + pipe: (pipe_of_death)); + clean_child_exit(1); +} +pipe_of_death = pipe_pair_of_death[0]; +listenfds[0].fd = pipe_pair_of_death[1]; +listenfds[0].events = POLLIN; +listenfds[0].revents = 0; +for (lr = ap_listeners, i = 1; i = num_listenfds; lr = lr-next, ++i) { lr-index = i; listenfds[i].fd = lr-fd; listenfds[i].events = POLLIN; /* should we add POLLPRI ?*/ @@ -368,12 +380,19 @@ if (workers_may_exit) break; -if (num_listenfds 1) { +/* XXX - Yes, we always go through the poll, at least for now. + * - mvsk + */ +if (1) { /* more than one socket */ -srv = poll(listenfds, num_listenfds, -1); +srv = poll(listenfds, num_listenfds + 1, -1); if (workers_may_exit) break; if (srv 0) { +/* XXX - h, poll can return EINTR. - mvsk */ +if (errno == EINTR) { +continue; +} SAFE_ACCEPT(accept_mutex_off(0)); /* Single Unix documents select as returning errnos * EBADF, EINTR, and EINVAL... and in none of those @@ -427,6 +446,7 @@ } csd = accept(sd, sa_client, len); +requests_this_child--; if (csd = 0) break; /* We have a socket ready for reading */ @@ -442,39 +462,24 @@ break; } } - -/* If the workers have not already been signaled to die, SIGWINCH the parent to - * kick-off the restart - */ -if (!workers_may_exit) { -index = find_child_by_pid(getpid()); -kill(ap_scoreboard_image-parent[index].pid, SIGWINCH); -} - - return -1; - } + void stop_accepting_connections(pool* pconf) { - -listen_rec *lr; int i; int index = find_child_by_pid(getpid()); +char char_of_death = '!'; parent_score *ss = ap_scoreboard_image-parent[index]; requests_this_child = 0; workers_may_exit = 1; -/* Kick threads out of poll/accept */ -lr = ap_listeners; -while (lr != NULL) { - ap_pclosesocket(pconf, lr-fd); - lr= lr-next; -} +/* Kick threads out of poll */ +(void) write(pipe_of_death, char_of_death, 1); -for (i = 0; i ss-worker_threads + ss-acceptor_threads; i++) { +
cvs commit: apache-apr/docs networkio.txt
rbb 99/04/15 13:08:22 Modified:apr/network_io/unix networkio.h sockets.c sockopt.c include apr_network_io.h docs networkio.txt Log: Fixed hostname stuff in apr. Also, we are now saving the remote hostname in the apr structure. Revision ChangesPath 1.5 +1 -1 apache-apr/apr/network_io/unix/networkio.h Index: networkio.h === RCS file: /home/cvs/apache-apr/apr/network_io/unix/networkio.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- networkio.h 1999/04/15 15:41:18 1.4 +++ networkio.h 1999/04/15 20:08:15 1.5 @@ -58,7 +58,7 @@ struct socket_t { int socketdes; -char hostname[MAXHOSTNAMELEN]; +char *remote_hostname; struct sockaddr_in *addr; size_t addr_len; }; 1.5 +12 -10apache-apr/apr/network_io/unix/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-apr/apr/network_io/unix/sockets.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- sockets.c 1999/04/15 15:41:18 1.4 +++ sockets.c 1999/04/15 20:08:16 1.5 @@ -60,18 +60,14 @@ #include sys/socket.h #include netinet/tcp.h #include netinet/in.h +#include netdb.h - apr_socket_t *apr_create_tcp_socket(void) { apr_socket_t *thesocket = (apr_socket_t *)malloc(sizeof(apr_socket_t)); thesocket-socketdes = socket(AF_INET ,SOCK_STREAM, IPPROTO_TCP); - -if (gethostname(thesocket-hostname, MAXHOSTNAMELEN + 1) == -1) { -free(thesocket); -return NULL; -} +thesocket-remote_hostname = NULL; thesocket-addr = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in)); thesocket-addr-sin_family = AF_INET; @@ -102,7 +98,8 @@ apr_status_t apr_close_socket(apr_socket_t *thesocket) { if (close(thesocket-socketdes) == 0) { -free(thesocket-hostname); +free(thesocket-addr); +free(thesocket-remote_hostname); free(thesocket); return APR_SUCCESS; } @@ -136,11 +133,16 @@ apr_socket_t *apr_accept(const apr_socket_t *sock) { apr_socket_t *new = (apr_socket_t *)malloc(sizeof(apr_socket_t)); - -strcpy(new-hostname, sock-hostname); +struct hostent *hptr; -new-socketdes = accept(sock-socketdes, (struct sockaddr *)new-addr, new-addr_len); +new-socketdes = accept(sock-socketdes, (struct sockaddr *)new-addr, new-addr_len); +hptr = gethostbyaddr((char *)new-addr-sin_addr, sizeof(struct in_addr), AF_INET); +if (hptr != NULL) { +new-remote_hostname = strdup(hptr-h_name); +} + +free(hptr); if (new-socketdes = 0) return new; free(new); 1.2 +14 -0 apache-apr/apr/network_io/unix/sockopt.c Index: sockopt.c === RCS file: /home/cvs/apache-apr/apr/network_io/unix/sockopt.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sockopt.c 1999/04/14 16:38:23 1.1 +++ sockopt.c 1999/04/15 20:08:17 1.2 @@ -145,3 +145,17 @@ return APR_SUCCESS; } +apr_status_t apr_gethostname(char *buf, int len) +{ +if (gethostname(buf, len) == -1) +return APR_FAILURE; +else +return APR_SUCCESS; +} + +char *apr_get_remote_hostname(apr_socket_t *sock) +{ +return sock-remote_hostname; +} + + 1.8 +3 -0 apache-apr/include/apr_network_io.h Index: apr_network_io.h === RCS file: /home/cvs/apache-apr/include/apr_network_io.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- apr_network_io.h 1999/04/15 15:41:20 1.7 +++ apr_network_io.h 1999/04/15 20:08:20 1.8 @@ -91,6 +91,9 @@ apr_status_t apr_listen(apr_socket_t *, apr_int32_t); apr_socket_t *apr_accept(const apr_socket_t *); +char *apr_get_remote_hostname(apr_socket_t *); +apr_status_t apr_gethostname(char *, int); + apr_ssize_t apr_send(apr_socket_t *, const char *, int, time_t); apr_ssize_t apr_recv(apr_socket_t *, char *, int, time_t); 1.10 +45 -32apache-apr/docs/networkio.txt Index: networkio.txt === RCS file: /home/cvs/apache-apr/docs/networkio.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- networkio.txt 1999/04/15 15:41:19 1.9 +++ networkio.txt 1999/04/15 20:08:21 1.10 @@ -130,39 +130,20 @@ return) new socket that has the accepted connection. NOTE: accepted socket can