Re: Problem with siproxd not rewriting request URI

Thomas Ries <[email protected]> Fri, 3 Feb 2006 23:10:36 +0100 (CET)
Newsgroups gmane.network.siproxd
Message-ID <[email protected]>
Hello Michael,

Thanks for the feedback. All this sounds logical to me. I just wonder
why I didn't implement it then... Maybe I have to read through the RFC
again. I can't remember a specific reason why I did not do it.
Anyhow, I'll integrate you changes, Thanks a lot.


Regards,
/Thomas

On  2 Feb, Michael Procter wrote:
> 
> Thomas Ries wrote:
>> 
>> I'd really like to have more details to see what is going on exactly.
>> Especially the whole SIP communication in front and after siproxd.
>> 
>> Don't you have the chance to ask the admin of the machine to 
>> assist you
>> to record a debug log? Do you have the chance to reproduce this effect
>> on a machine that you have under control? You should also try with the
>> latest snapshot of siproxd.
>> 
> 
> I am the admin of the machine in question.  I updated to the 02Feb2006
> snapshot this morning, and the problem remained.  I've looked a little
> further and come up with a fix.  The problem seemed to be in the
> function
> proxy_rewrite_request_uri, in that it only rewrote 2 of the 4 components
> of the uri.  Rewriting the 'username' component made it work, but I
> added
> rewriting of the scheme too, just for completeness.
> 
> Regards,
> 
> Michael Procter
> 
> 
> 
> *** siproxd-0.5.12-snapshot-02Feb20006-orig/src/proxy.c  2006-01-01
> 20:31:54.000000000 +0000
> --- siproxd-0.5.12-snapshot-02Feb2006/src/proxy.c       2006-02-02
> 10:34:02.000000000 +0000
> ***************
> *** 1122,1127 ****
> --- 1122,1129 ----
>    *    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,1139 ****
> --- 1136,1163 ----
>      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) {
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd_______________________________________________
> Siproxd-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/siproxd-users

-- 
GnuPG: pub  1024D/87BCDC94 2000-03-19 Thomas Ries <[email protected]>
-      Fingerprint = 13D1 19F5 77D0 4CEC 8D3F  A24E 09FC C18A 87BC DC94
-      Key via pgp.openpkg.org / http://www.ries.ch.vu/87BCDC94.pub
VoIP:  sip:17476691342-rne+wJe3e/u3Jhga2bR/9VaTQe2KTcn/@public.gmane.org | sip:[email protected]
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQBD49TcCfzBioe83JQRAvVtAJ9uYV3SER6giE2y5DA0RH378MqN2wCgtPRp
do5+KCV1c+EFjFmpySa1M0I=
=4OXH
-----END PGP SIGNATURE-----