Re: [PATCH] ftp proxy by IPv6

2002-07-17 Thread Shoichi Sakane

  your question means if i can modify ftp proxy to use the
  function ap_proxy_connect_to_backend() ?
 yes, that was my original question...

i can't say yes, but if i will be able to have a free time
and if the issue will remain, then i will try it.

 I just committed your patch with very minor modifications.

thank you.



Re: [PATCH] ftp proxy by IPv6

2002-07-11 Thread Shoichi Sakane

sorry for my delayed response and i have lost original mail.

  here is the patch that can do ftp proxy by IPv6.  i can connect to
  IPv6 ftp server when this patch is applyed to modules/proxy/proxy_ftp.c
  in httpd-2.0.39.

 Is it possible that the utility function ap_proxy_connect_to_backend()
 can be used for part of your patch?  I previously changed proxy HTTP
 and proxy CONNECT to use ap_proxy_connect_to_backend() to handle
 some of the logic you had to fix in an IPv6-capable manner.

my modification to ap_proxy_ftp_handler() is about address family.
the function ap_proxy_connect_to_backend() already cares it.
i think this function works fine for http proxy.

your question means if i can modify ftp proxy to use the
function ap_proxy_connect_to_backend() ?

//shoichi sakane



[PATCH?] SSI by mod_cgid.c, child process becomes zombie.

2002-07-11 Thread Shoichi Sakane

when i get a html file including a line !--#exec cmd=ls --,
a child process of cgi daemon process in the server becomes zombie.
i'm using FreeBSD4.6-RELEASE and apache-2.0.39.

cgid_server() calls apr_signal(SIGCHLD, SIG_IGN), but it doesn't work
at least in my environment.  i might be misoperating, anyway the patch
is attached in this mail.  i haven't care about the porting issue.
so if this patch needs to modify to be suitable for other platform.

i'm sorry if this issue has been already discussed.
thank you.

*** mod_cgid-old.c  Fri Jun 14 04:41:17 2002
--- mod_cgid.c  Wed Jul 10 21:38:02 2002
***
*** 514,520 
--- 514,537 
  
  apr_pool_create(ptrans, pcgi); 
  
+ #if 0
  apr_signal(SIGCHLD, SIG_IGN); 
+ #else
+ /*
+  * parent should ignore the signal from child
+  * OR parent process has to wait for child process.
+  */
+ {
+ struct sigaction sa;
+ 
+ memset(sa, 0, sizeof(sa));
+ sa.sa_handler = NULL;
+ sa.sa_flags = SA_NOCLDWAIT;
+ sigemptyset(sa.sa_mask);
+ sigaction(SIGCHLD, sa, (struct sigaction *)0);
+ }
+ #endif
+ 
  apr_signal(SIGHUP, daemon_signal_handler);
  
  if (unlink(sconf-sockname)  0  errno != ENOENT) {



Re: [PATCH?] SSI by mod_cgid.c, child process becomes zombie.

2002-07-11 Thread Shoichi Sakane

 when i get a html file including a line !--#exec cmd=ls --,
 a child process of cgi daemon process in the server becomes zombie.
 i'm using FreeBSD4.6-RELEASE and apache-2.0.39.

 cgid_server() calls apr_signal(SIGCHLD, SIG_IGN), but it doesn't work
 at least in my environment.  i might be misoperating, anyway the patch
 is attached in this mail.  i haven't care about the porting issue.
 so if this patch needs to modify to be suitable for other platform.

here is additional information.  i have checked if SSI exec cmd
works fine.

signal(SIGCHLD, SIG_IGN) is enough not to make zombie child.
SunOS bahamas 5.7 i386

signal(SIGCHLD, SIG_IGN) makes zombie child.
FreeBSD 4.6-RELEASE i386
FreeBSD 3.5.1-RELEASE i386
NetBSD 1.6_BETA4 i386
Linux 2.4.18 i386



[PATCH] ftp proxy by IPv6

2002-06-28 Thread Shoichi Sakane

here is the patch that can do ftp proxy by IPv6.  i can connect to
IPv6 ftp server when this patch is applyed to modules/proxy/proxy_ftp.c
in httpd-2.0.39.

please verify it and merge it if it is correct.

regards,

//shoichi sakane

*** proxy_ftp-old.c Fri Jun 28 15:18:27 2002
--- proxy_ftp.c Fri Jun 28 15:05:26 2002
***
*** 942,984 
  connectname, NULL));
  }
  
- 
- if ((rv = apr_socket_create(sock, APR_INET, SOCK_STREAM, r-pool)) != 
APR_SUCCESS) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-   proxy: FTP: error creating socket);
- return HTTP_INTERNAL_SERVER_ERROR;
- }
- 
- #if !defined(TPF)  !defined(BEOS)
- if (conf-recv_buffer_size  0
-  (rv = apr_setsocketopt(sock, APR_SO_RCVBUF,
-   conf-recv_buffer_size))) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-   setsockopt(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, 
using default);
- }
- #endif
- 
- if (APR_SUCCESS != (rv = apr_setsocketopt(sock, APR_SO_REUSEADDR, one))) {
- #ifndef _OSD_POSIX  /* BS2000 has this option always on */
- ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
-   proxy: FTP: error setting reuseaddr option: 
setsockopt(SO_REUSEADDR));
- return HTTP_INTERNAL_SERVER_ERROR;
- #endif  /* _OSD_POSIX */
- }
- 
- /* Set a timeout on the socket */
- if (conf-timeout_set == 1) {
- apr_setsocketopt(sock, APR_SO_TIMEOUT, (int)conf-timeout);
- }
- else {
- apr_setsocketopt(sock, 
-  APR_SO_TIMEOUT, (int)r-server-timeout);
- }
- 
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r-server,
-  proxy: FTP: socket has been created);
- 
- 
  /*
   * At this point we have a list of one or more IP addresses of the
   * machine to connect to. If configured, reorder this list so that the
--- 942,947 
***
*** 994,1005 
  int failed = 1;
  while (connect_addr) {
  
! /* FIXME: : We created an APR_INET socket. Now there may be
!  * IPv6 (AF_INET6) DNS addresses in the list... IMO the socket
!  * should be created with the correct family in the first place.
!  * (either do it in this loop, or make at least two attempts
!  * with the AF_INET and AF_INET6 elements in the list)
!  */
  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r-server,
   proxy: FTP: trying to connect to %pI (%s)..., 
connect_addr, connectname);
  
--- 957,998 
  int failed = 1;
  while (connect_addr) {
  
!   if ((rv = apr_socket_create(sock, connect_addr-family, SOCK_STREAM, 
r-pool)) != APR_SUCCESS) {
!   ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
! proxy: FTP: error creating socket);
!   continue;
!   }
! 
! #if !defined(TPF)  !defined(BEOS)
!   if (conf-recv_buffer_size  0
!(rv = apr_setsocketopt(sock, APR_SO_RCVBUF,
! conf-recv_buffer_size))) {
!   ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
! setsockopt(SO_RCVBUF): Failed to set 
ProxyReceiveBufferSize, using default);
!   }
! #endif
! 
!   if (APR_SUCCESS != (rv = apr_setsocketopt(sock, APR_SO_REUSEADDR, one))) {
!   apr_socket_close(sock);
! #ifndef _OSD_POSIX  /* BS2000 has this option always on */
!   ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
! proxy: FTP: error setting reuseaddr option: 
setsockopt(SO_REUSEADDR));
!   continue;
! #endif  /* _OSD_POSIX */
!   }
! 
!   /* Set a timeout on the socket */
!   if (conf-timeout_set == 1) {
!   apr_setsocketopt(sock, APR_SO_TIMEOUT, (int)conf-timeout);
!   }
!   else {
!   apr_setsocketopt(sock, 
!APR_SO_TIMEOUT, (int)r-server-timeout);
!   }
! 
!   ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r-server,
!proxy: FTP: socket has been created);
! 
  ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r-server,
   proxy: FTP: trying to connect to %pI (%s)..., 
connect_addr, connectname);
  
***
*** 1008,1013 
--- 1001,1007 
  
  /* if an error occurred, loop round and try again */
  if (rv != APR_SUCCESS) {
+   apr_socket_close(sock);
  ap_log_error(APLOG_MARK, APLOG_ERR, rv, r-server,
   proxy: FTP: attempt to connect to %pI (%s) failed, 
connect_addr, connectname);
  connect_addr = connect_addr-next