[Mono-bugs] [Bug 591633] New: Basic WebAuth fails.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Mar 27 00:24:07 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=591633

http://bugzilla.novell.com/show_bug.cgi?id=591633#c0


           Summary: Basic WebAuth fails.
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: abe.gillespie at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-US)
AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.7 Safari/533.2

Try this test case.  I believe the headers get dropped:

using System;
using System.Net;
using System.IO;
using System.Text;

namespace Tester
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var req = WebRequest
                   
Create("http://api.twitter.com/1/direct_messages/sent.json");
                req.Method = "GET";
                req.PreAuthenticate = true;
                req.Headers["Authorization"] =
                    ToBasicAuthorizationHeader("twitter-user", "password");
                var stream = req.GetResponse().GetResponseStream();

                Console.WriteLine("Windows: WIN");
            }
            catch
            {
                Console.WriteLine("Mono: FAIL");
            }
        }

        public static string ToBasicAuthorizationHeader(
            string username, string password)
        {
            var bytes = Encoding.ASCII.GetBytes(
                string.Format("{0}:{1}", username, password));
            var token = Convert.ToBase64String(bytes);
            return string.Format("Basic {0}", token);
        }
    }
}

Reproducible: Always

Steps to Reproduce:
Run the test case.
Actual Results:  
Fails with Unauthorized exception.

Expected Results:  
Success.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list