Bug 324377 (MONO81701) - [PATCH] Fix to allow HttpClientChannel to connect to xsp2 using https
Summary: [PATCH] Fix to allow HttpClientChannel to connect to xsp2 using https
Status: RESOLVED FIXED
Alias: MONO81701
Product: Mono: Runtime
Classification: Mono
Component: remoting (show other bugs)
Version: unspecified
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Lluis Sanchez
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-22 05:41 UTC by Luis Alvarenga
Modified: 2007-10-30 02:41 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
https-scheme.diff (3.17 KB, patch)
2007-05-23 14:27 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:39:28 UTC


---- Reported by admin@svwebhosting.com 2007-05-21 22:41:11 MST ----

When connecting to remoting objects hosted on xsp2 with ssl this exception
is thrown:

Unhandled Exception: System.Runtime.Remoting.RemotingException: Cannot
create channel sink to connect to URL https://x.x.x.x:1234/server.soap. An
appropriate channel has probably not been registered.

I tracked the problem to the function StartsWithHttp in file
mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpHelper.cs

The fix to add a check for "https://" in the condition like this:

if(URL.StartsWith("http://") | URL.StartsWith("https://"))



---- Additional Comments From admin@svwebhosting.com 2007-05-22 00:51:22 MST ----

I would like to add that I have compiled and tested this modification
and it works.



---- Additional Comments From robertj@gmx.net 2007-05-22 04:01:14 MST ----

This is not enough. Maybe we don't have a test case for this,
but if you look at HttpUtil.Parse, you'll see that
URL.IndexOf ("/", 7) is not correct anymore. This leads to
wrong object URIs.

A test case could be a MBR like that:

public class MBR : MarshalByRefObject
{
    public MBR Test ()
    {
        return new MBR ();
    }
}




---- Additional Comments From admin@svwebhosting.com 2007-05-22 15:12:02 MST ----

Changing it to URL.IndexOf ("/", 8) works when the url contains https
and http.

I have tested with the class as a wellknown service like this. I had
to change the uri before returning the object because the client tries
to use http by default.

MBR mbr = (MBR)Activator.GetObject(typeof(MBR),
"https://x.x.x.x:1234/mbr.soap");
MBR mbr2 = mbr.Test();
mbr2.Hello();


public class MBR : MarshalByRefObject
{
    public MBR Test(){
        MBR obj = new MBR();
        System.Runtime.Remoting.ObjRef remobj =
System.Runtime.Remoting.RemotingServices.Marshal(obj);
        remobj.URI = "https://x.x.x.x:1234/" + remobj.URI;
        return obj;
    }

    public string Hello(){
        return "hello";
    }
}



---- Additional Comments From robertj@gmx.net 2007-05-23 07:26:57 MST ----

Would you please test the attached patch? You can apply it
with "patch -p 0 < https-scheme.diff" from inside the
mcs/class/System.Runtime.Remoting directory.





---- Additional Comments From robertj@gmx.net 2007-05-23 07:27:28 MST ----

Created an attachment (id=172026)
https-scheme.diff




---- Additional Comments From robertj@gmx.net 2007-05-23 07:30:18 MST ----

Forgot to mention that the patch is fixing this issue as well:

> I have tested with the class as a wellknown service like this. I had
> to change the uri before returning the object because the client tries
> to use http by default.




---- Additional Comments From admin@svwebhosting.com 2007-05-23 14:54:25 MST ----

Thanks. I have tested this with http and https and both work.



---- Additional Comments From admin@svwebhosting.com 2007-05-23 14:58:06 MST ----

Also the fix for the uri is not needed anymore. It is done
automatically after the patch.

Imported an attachment (id=172026)
Comment 1 Robert Jordan 2007-10-30 02:41:08 UTC
Fixed in SVN r88436.