Skip to content
This repository was archived by the owner on Apr 12, 2022. It is now read-only.

Commit 7d691e0

Browse files
author
shugo
committed
support IPv6 for Apache 1.3. Thanks, Dirk Meyer.
1 parent 097f0ac commit 7d691e0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

connection.c

+8
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ static VALUE connection_local_port(VALUE self)
9999
Data_Get_Struct(self, conn_rec, conn);
100100
#ifdef APACHE2
101101
return INT2NUM(conn->local_addr->port);
102+
#else
103+
#ifdef APACHE6
104+
return INT2NUM(ntohs(((struct sockaddr_in *)&conn->local_addr)->sin_port));
102105
#else
103106
return INT2NUM(ntohs(conn->local_addr.sin_port));
104107
#endif
108+
#endif
105109
}
106110

107111
static VALUE connection_remote_port(VALUE self)
@@ -111,9 +115,13 @@ static VALUE connection_remote_port(VALUE self)
111115
Data_Get_Struct(self, conn_rec, conn);
112116
#ifdef APACHE2
113117
return INT2NUM(conn->remote_addr->port);
118+
#else
119+
#ifdef APACHE6
120+
return INT2NUM(ntohs(((struct sockaddr_in *)&conn->remote_addr)->sin_port));
114121
#else
115122
return INT2NUM(ntohs(conn->remote_addr.sin_port));
116123
#endif
124+
#endif
117125
}
118126

119127
void rb_init_apache_connection()

0 commit comments

Comments
 (0)