r12817: Create a ESP variable with the struct socket_address * in it, so we
authorAndrew Bartlett <abartlet@samba.org>
Tue, 10 Jan 2006 09:17:58 +0000 (09:17 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:50:01 +0000 (13:50 -0500)
can pass that do the auth subsystem.

Andrew Bartlett

source/web_server/http.c

index 8779007f86994f7035e2f5d2efc4124ee8c9ad18..b2b75c8148289067aece1f9428e7a50816751c4d 100644 (file)
@@ -401,7 +401,7 @@ static void http_setup_arrays(struct esp_state *esp)
        struct esp_data *edata = talloc_get_type(web->task->private, struct esp_data);
        struct EspRequest *req = esp->req;
        struct socket_address *socket_address = socket_get_my_addr(web->conn->socket, esp);
-       struct socket_address *peer_address = socket_get_my_addr(web->conn->socket, esp);
+       struct socket_address *peer_address = socket_get_peer_addr(web->conn->socket, esp);
        char *p;
 
 #define SETVAR(type, name, value) do { \
@@ -418,6 +418,10 @@ static void http_setup_arrays(struct esp_state *esp)
        SETVAR(ESP_REQUEST_OBJ, "SCRIPT_NAME", p+1);
        SETVAR(ESP_REQUEST_OBJ, "SCRIPT_FILENAME", web->input.url);
        if (peer_address) {
+               struct MprVar mpv = mprObject("socket_address");
+               mprSetPtrChild(&mpv, "socket_address", peer_address);
+               espSetVar(req, ESP_REQUEST_OBJ, "REMOTE_SOCKET_ADDRESS", mpv);
+
                SETVAR(ESP_REQUEST_OBJ, "REMOTE_ADDR", peer_address->addr);
        }
        p = socket_get_peer_name(web->conn->socket, esp);