
| Key: |
MODPYTHON-64
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Priority: |
Major
|
| Assignee: |
Unassigned
|
| Reporter: |
Deron Meranda
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
Apache built with IPv6 support.
|
|
| Resolution Date: |
13/Nov/05 04:42 AM
|
|
In the connection object the local_addr and remote_addr members are not
correctly built. This has the result that under IPv6-enabled Apache the IP address
strings are always zero-length.
I think the following diff fixes this by using the appropriate APR functions,
apr_sockaddr_ip_get() and apr_sockaddr_port_get(), to build these strings
(although I'm not an APR expert). This patch does appear to work correctly
for me.
--- connobject.c.orig 2004-02-16 14:47:27.000000000 -0500
+++ connobject.c 2005-07-14 11:22:09.076148325 -0400
@@ -292,12 +292,15 @@
static PyObject *makeipaddr(struct apr_sockaddr_t *addr)
{
- long x = ntohl(addr->sa.sin.sin_addr.s_addr);
- char buf[100];
- sprintf(buf, "%d.%d.%d.%d",
- (int) (x>>24) & 0xff, (int) (x>>16) & 0xff,
- (int) (x>> 8) & 0xff, (int) (x>> 0) & 0xff);
- return PyString_FromString(buf);
+ char *str = NULL;
+ apr_status_t rc;
+ PyObject *ret = NULL;
+
+ rc = apr_sockaddr_ip_get( &str, addr );
+ if (rc==APR_SUCCESS) {
+ ret = PyString_FromString( str );
+ }
+ return ret;
}
/**
@@ -311,7 +314,9 @@
PyObject *addrobj = makeipaddr(addr);
PyObject *ret = NULL;
if (addrobj) {
- ret = Py_BuildValue("Oi", addrobj, ntohs(addr->sa.sin.sin_port));
+ apr_port_t port;
+ apr_sockaddr_port_get(&port, addr);
+ ret = Py_BuildValue("Oi", addrobj, port );
Py_DECREF(addrobj);
}
return ret;
|
|
Description
|
In the connection object the local_addr and remote_addr members are not
correctly built. This has the result that under IPv6-enabled Apache the IP address
strings are always zero-length.
I think the following diff fixes this by using the appropriate APR functions,
apr_sockaddr_ip_get() and apr_sockaddr_port_get(), to build these strings
(although I'm not an APR expert). This patch does appear to work correctly
for me.
--- connobject.c.orig 2004-02-16 14:47:27.000000000 -0500
+++ connobject.c 2005-07-14 11:22:09.076148325 -0400
@@ -292,12 +292,15 @@
static PyObject *makeipaddr(struct apr_sockaddr_t *addr)
{
- long x = ntohl(addr->sa.sin.sin_addr.s_addr);
- char buf[100];
- sprintf(buf, "%d.%d.%d.%d",
- (int) (x>>24) & 0xff, (int) (x>>16) & 0xff,
- (int) (x>> 8) & 0xff, (int) (x>> 0) & 0xff);
- return PyString_FromString(buf);
+ char *str = NULL;
+ apr_status_t rc;
+ PyObject *ret = NULL;
+
+ rc = apr_sockaddr_ip_get( &str, addr );
+ if (rc==APR_SUCCESS) {
+ ret = PyString_FromString( str );
+ }
+ return ret;
}
/**
@@ -311,7 +314,9 @@
PyObject *addrobj = makeipaddr(addr);
PyObject *ret = NULL;
if (addrobj) {
- ret = Py_BuildValue("Oi", addrobj, ntohs(addr->sa.sin.sin_port));
+ apr_port_t port;
+ apr_sockaddr_port_get(&port, addr);
+ ret = Py_BuildValue("Oi", addrobj, port );
Py_DECREF(addrobj);
}
return ret;
|
Show » |
| No work has yet been logged on this issue.
|
|