From 14a6e0cfc284348bc0a3a2312d82a43b2a256456 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Wed, 8 Aug 2012 14:08:31 +0200 Subject: [PATCH 1/2] CGI specifies that REQUEST_URI is relative to the root (and does not include scheme name, hostname, port) --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index 1ac74ebbdf..a0898fb1cd 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -40,6 +40,7 @@ SWITCH_MODULE_DEFINITION(mod_xml_scgi, mod_xml_scgi_load, mod_xml_scgi_shutdown, struct xml_binding { char *host; switch_port_t port; + char *uri; char *url; int timeout; @@ -144,7 +145,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_stream_handle_t stream = { 0 }; char *txt = NULL; - strncpy(hostname, switch_core_get_switchname(), sizeof(hostname)); + strncpy(hostname, switch_core_get_switchname(), sizeof(hostname)); if (!binding) { return NULL; @@ -157,7 +158,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_assert(data); scgi_add_param(&handle, "REQUEST_METHOD", "POST"); - scgi_add_param(&handle, "REQUEST_URI", binding->url); + scgi_add_param(&handle, "REQUEST_URI", binding->uri); scgi_add_body(&handle, data); if (scgi_connect(&handle, binding->host, binding->port, binding->timeout * 1000) == SCGI_SUCCESS) { @@ -318,6 +319,7 @@ static switch_status_t do_config(void) binding->host = switch_core_strdup(globals.pool, host); binding->port = atoi(port); binding->vars_map = vars_map; + binding->uri = switch_mprintf("/%s", bname); binding->url = switch_mprintf("scgi://%s:%s/%s", host, port, bname); if (server) { From f3c1f5aa686231959e9b139d9982c89506a364a9 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Wed, 8 Aug 2012 14:14:54 +0200 Subject: [PATCH 2/2] missed this one --- src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c index a0898fb1cd..3e39e65407 100644 --- a/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c +++ b/src/mod/xml_int/mod_xml_scgi/mod_xml_scgi.c @@ -409,7 +409,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_scgi_shutdown) int x = 3; scgi_add_param(&handle, "REQUEST_METHOD", "POST"); - scgi_add_param(&handle, "REQUEST_URI", bp->url); + scgi_add_param(&handle, "REQUEST_URI", bp->uri); scgi_add_body(&handle, "SHUTDOWN"); while(x--) {