- rewrite complete incoming request URI
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
0.5.12
|
||||
======
|
||||
3-Feb-2006: - rewrite complete incoming request URI
|
||||
31-Jan-2006: - CALLIDHOST_SIZE to 128: support longer hostnames
|
||||
1-Jan-2006: - short-dial: use "302 Moved" to point to target
|
||||
28-Dec-2005: - Call logging: display FROM & TO for calls.
|
||||
|
||||
26
src/proxy.c
26
src/proxy.c
@@ -1122,6 +1122,8 @@ if (configuration.debuglevel)
|
||||
* STS_SUCCESS on success
|
||||
*/
|
||||
int proxy_rewrite_request_uri(osip_message_t *mymsg, int idx){
|
||||
char *scheme;
|
||||
char *username;
|
||||
char *host;
|
||||
char *port;
|
||||
osip_uri_t *url;
|
||||
@@ -1134,6 +1136,30 @@ int proxy_rewrite_request_uri(osip_message_t *mymsg, int idx){
|
||||
DEBUGC(DBCLASS_PROXY,"rewriting incoming Request URI");
|
||||
url=osip_message_get_uri(mymsg);
|
||||
|
||||
/* set the true scheme */
|
||||
if (url->scheme) osip_free(url->scheme);url->scheme=NULL;
|
||||
if (urlmap[idx].true_url->scheme) {
|
||||
DEBUGC(DBCLASS_BABBLE,"proxy_rewrite_request_uri: scheme=%s",
|
||||
urlmap[idx].true_url->scheme);
|
||||
scheme = (char *)malloc(strlen(urlmap[idx].true_url->scheme)+1);
|
||||
memcpy(scheme, urlmap[idx].true_url->scheme,
|
||||
strlen(urlmap[idx].true_url->scheme));
|
||||
scheme[strlen(urlmap[idx].true_url->scheme)]='\0';
|
||||
osip_uri_set_scheme(url, scheme);
|
||||
}
|
||||
|
||||
/* set the true username */
|
||||
if (url->username) osip_free(url->username);url->username=NULL;
|
||||
if (urlmap[idx].true_url->username) {
|
||||
DEBUGC(DBCLASS_BABBLE,"proxy_rewrite_request_uri: username=%s",
|
||||
urlmap[idx].true_url->username);
|
||||
username = (char*)malloc(strlen(urlmap[idx].true_url->scheme)+1);
|
||||
memcpy(username, urlmap[idx].true_url->username,
|
||||
strlen(urlmap[idx].true_url->username));
|
||||
username[strlen(urlmap[idx].true_url->username)]='\0';
|
||||
osip_uri_set_username(url, username);
|
||||
}
|
||||
|
||||
/* set the true host */
|
||||
if (url->host) osip_free(url->host);url->host=NULL;
|
||||
if (urlmap[idx].true_url->host) {
|
||||
|
||||
Reference in New Issue
Block a user