Changeset 426

Show
Ignore:
Timestamp:
02/08/10 23:41:34 (6 months ago)
Author:
serialseb
Message:

New http header parsing implementation, some bug fixes. Not finished but need checkin to merge RC

Location:
trunk
Files:
24 added
24 modified

Legend:

Unmodified
Added
Removed
  • trunk/build/aspnet.proj

    r230 r426  
    55      <MinVersion>20</MinVersion> 
    66      <Merged>false</Merged> 
     7      <SignAssembly>true</SignAssembly> 
    78    </Projects> 
    89    <Projects Include="$(SourcePath)\OpenRasta.Hosting.AspNet.Tests.Integration\OpenRasta.Hosting.AspNet.Tests.Integration.csproj"> 
     
    1314      <MinVersion>20</MinVersion> 
    1415      <Merged>false</Merged> 
     16      <SignAssembly>true</SignAssembly> 
    1517    </Projects> 
    1618    <Projects Include="$(SourcePath)\OpenRasta.Codecs.WebForms.Tests.Unit\OpenRasta.Codecs.WebForms.Tests.Unit.csproj"> 
  • trunk/build/build.proj

    r348 r426  
    1414   
    1515  <ItemGroup> 
    16     <Module Include="core.proj;aspnet.proj;castle.proj;ninject.proj;sharpview.proj;vside.proj;openbastard.proj" /> 
     16    <Module Include="core.proj;aspnet.proj;castle.proj;ninject.proj;unity.proj;sharpview.proj;vside.proj;openbastard.proj" /> 
    1717    <Installer Include="$(RootPath)\src\install\OpenRasta.Installer\OpenRasta.Installer.wixproj"/> 
    1818  </ItemGroup> 
  • trunk/build/core.proj

    r421 r426  
    55      <MinVersion>20</MinVersion> 
    66      <Merged>false</Merged> 
     7      <SignAssembly>true</SignAssembly> 
    78    </Projects> 
    89 
  • trunk/build/defaults.targets

    r268 r426  
    2222    <AssemblyOriginatorKeyFile Condition="!Exists('$(CaffeineSignature)')">$(RootPath)\build\keys\debug.snk</AssemblyOriginatorKeyFile> 
    2323    <AssemblyOriginatorKeyFile Condition="Exists('$(CaffeineSignature)')">$(CaffeineSignature)</AssemblyOriginatorKeyFile> 
    24  
     24    <AssemblySign Condition="'$(AssemblySign)' == ''">true</AssemblySign> 
    2525    <NoWarn>1591;$(NoWarn)</NoWarn> 
    2626  </PropertyGroup> 
  • trunk/build/dependencymanager.proj

    r396 r426  
    8282    <Error Condition="'$(OpenRasta-DI-Windsor)' != '' and '$(CastleWindsor)' == ''" Text="If you add Windsor as a dependency, you need to specify which version with the CastleWindsor property." /> 
    8383    <MSBuild Projects="$(RootPath)\build\core.proj" 
    84              Condition="'$(OpenRasta)' != '' and !Exists('$(OpenRastaAssemblyPath)'))" 
     84             Condition="'$(OpenRasta)' != '' and !Exists('$(OpenRastaAssemblyPath)')" 
    8585             Properties="FrameworkProfileVersion=$(FrameworkProfile)" /> 
    8686    <MSBuild Projects="$(RootPath)\build\castle.proj" 
    87              Condition="'$(OpenRasta-DI-WindsorAssemblyPath)' != '' and !Exists('$(OpenRasta-DI-WindsorAssemblyPath)'))" 
     87             Condition="'$(OpenRasta-DI-WindsorAssemblyPath)' != '' and !Exists('$(OpenRasta-DI-WindsorAssemblyPath)')" 
    8888             Properties="FrameworkProfileVersion=$(FrameworkProfile)" /> 
    8989  </Target> 
  • trunk/build/module.targets

    r421 r426  
    11<?xml version="1.0" encoding="utf-8"?> 
    2 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"  DefaultTargets="Clean;Package" ToolsVersion="3.5"> 
     2<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"  DefaultTargets="DebugInfo;Clean;Package" ToolsVersion="3.5"> 
    33  <UsingTask TaskName="Microsoft.Build.Tasks.CreateItem"                            AssemblyName="Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> 
    44  <UsingTask TaskName="Microsoft.Build.Tasks.FindInList"                            AssemblyName="Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> 
     
    2222      <UnitTest>false</UnitTest> 
    2323      <NUnit-DisableShadowCopy>false</NUnit-DisableShadowCopy> 
    24       <SignAssembly>false</SignAssembly> 
     24      <SignAssembly>true</SignAssembly> 
    2525    </Projects> 
    2626  </ItemDefinitionGroup> 
     
    2828  <PropertyGroup> 
    2929    <Configuration Condition="'$(Configuration)' == ''">Release</Configuration> 
    30     <!--<MergedAssemblyName>OpenRasta.dll</MergedAssemblyName>--> 
    3130    <CaffeineSignature>$(RootPath)\build\keys\caff\caff.snk</CaffeineSignature> 
    3231     
     
    5655 
    5756 
     57  <Target Name="DebugInfo"> 
     58    <Message Text="AssemblySign is '$(AssemblySign)'" /> 
     59              
     60  </Target> 
    5861 
    5962 
     
    6770  <Target Name="Verify"> 
    6871    <!--<Error Condition="!Exists('$(ILMergePath)')" Text="IlMerge has not been found. Either install it from http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=22914587-b4ad-4eae-87cf-b14ae6a939b0&amp;displaylang=en  or specify the path to Ilmerge.exe as the ILMergePath property."/>--> 
    69  
     72     
    7073    <MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')"/> 
    7174    <MakeDir Directories="$(NUnitReportsDirectory)" Condition="!Exists('$(NUnitReportsDirectory)')"/> 
  • trunk/build/ninject.proj

    r336 r426  
    55      <MinVersion>35</MinVersion> 
    66      <Merged>false</Merged> 
     7      <SignAssembly>true</SignAssembly> 
    78    </Projects> 
    8     <Projects Include="$(SourcePath)\OpenRasta.DI.Ninject.Tests.Unit\OpenRasta.DI.Ninject.Tests.Unit.csproj"> 
    9       <UnitTest>true</UnitTest> 
    10     </Projects> 
    11      
    12     <Projects Include="$(SourcePath)\OpenRasta.DI.Ninject\OpenRasta.DI.Ninject.csproj"/> 
    139    <Projects Include="$(SourcePath)\OpenRasta.DI.Ninject.Tests.Unit\OpenRasta.DI.Ninject.Tests.Unit.csproj"> 
    1410      <UnitTest>true</UnitTest> 
  • trunk/build/openbastard.proj

    r356 r426  
    11<?xml version="1.0" encoding="utf-8"?> 
    2 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Package"> 
     2<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="DebugInfo;Package"> 
    33  <ItemGroup> 
    44    <Projects Include="$(SourcePath)\OpenBastard\OpenBastard.csproj"> 
    55      <MinVersion>20</MinVersion> 
    66      <Merged>false</Merged> 
     7      <SignAssembly>true</SignAssembly> 
    78    </Projects> 
    89    <Projects Include="$(SourcePath)\OpenBastard.Hosting.Iis7\OpenBastard.Hosting.Iis7.csproj"> 
    910      <MinVersion>20</MinVersion> 
    10       <Merged>false</Merged> 
     11      <SignAssembly>true</SignAssembly> 
    1112    </Projects> 
    1213    <Projects Include="$(SourcePath)\OpenBastard.Hosting.Iis7.WorkerProcess-32\OpenBastard.Hosting.Iis7.WorkerProcess-32.csproj"> 
    1314      <MinVersion>20</MinVersion> 
    14       <Merged>false</Merged> 
     15      <SignAssembly>true</SignAssembly> 
    1516    </Projects> 
    1617    <Projects Include="$(SourcePath)\OpenBastard.Hosting.Iis7.WorkerProcess-64\OpenBastard.Hosting.Iis7.WorkerProcess-64.csproj"> 
    1718      <MinVersion>20</MinVersion> 
    18       <Merged>false</Merged> 
     19      <SignAssembly>true</SignAssembly> 
    1920    </Projects> 
    2021    <Projects Include="$(SourcePath)\OpenBastard.TestRunner\OpenBastard.TestRunner.csproj"> 
  • trunk/build/releasebuilder.targets

    r396 r426  
    8181    </Math.Add> 
    8282    <PropertyGroup> 
    83       <BuildVersion>$(BuildVersionMajor).$(BuildVersionMinor).$(BuildVersionBuild).$(BuildVersionRevision)</BuildVersion> 
     83      <BuildVersion Condition="'$(build_version_prefix)'!=''">$(BuildVersionMajor).$(BuildVersionMinor).$(build_version_prefix).0</BuildVersion> 
     84      <BuildVersion Condition="'$(build_version_prefix)'==''">$(BuildVersionMajor).$(BuildVersionMinor).$(BuildVersionBuild).0</BuildVersion> 
     85      <BuildFileVersion>$(BuildVersionMajor).$(BuildVersionMinor).$(BuildVersionBuild).$(BuildVersionRevision)</BuildFileVersion> 
    8486      <SetupFilePath Condition="'$(SetupFilePath)' == ''">$(RootPath)\bin\$(Configuration)\OpenRasta-$(BuildVersion).exe</SetupFilePath> 
    8587    </PropertyGroup> 
  • trunk/src/core/OpenRasta.Testing/SpecExtensions.cs

    r420 r426  
    4343            return values; 
    4444        } 
    45  
    4645        public static T ShouldBe<T>(this T valueToAnalyse, T expectedValue) 
    4746        { 
     
    6362        } 
    6463 
     64        public static KeyValuePair<TKey,TValue> ShouldBe<TKey,TValue>(this KeyValuePair<TKey,TValue> actual, TKey expectedName, TValue expectedValue) 
     65        { 
     66            actual.Key.ShouldBe(expectedName); 
     67            actual.Value.ShouldBe(expectedValue); 
     68            return actual; 
     69        } 
    6570        public static void ShouldBe(this Stream actualStream, Stream expectedStream) 
    6671        { 
     
    107112        } 
    108113 
    109         //public static void ShouldBeGreaterThan<T>(this T actual, T expected) where T : IComparable 
    110         //{ 
    111         //    Assert.That(actual, Is.GreaterThan(expected)); 
    112         //} 
    113  
    114         //public static void ShouldBeLessThan<T>(this T actual, T expected) where T : IComparable 
    115         //{ 
    116         //    Assert.That(actual, Is.LessThan(expected)); 
    117         //} 
    118114        public static void ShouldBeGreaterThan<T>(this T actual, T expected) where T : IComparable<T> 
    119115        { 
     
    201197        } 
    202198 
    203         public static void ShouldHaveSameElementsAs<T>(this IEnumerable<T> r1, IEnumerable<T> r2) 
    204         { 
    205             var enumerator1 = r1.GetEnumerator(); 
    206             var enumerator2 = r2.GetEnumerator(); 
     199        public static IEnumerable<T> ShouldHaveSameElementsAs<T>(this IEnumerable<T> actual, IEnumerable<T> expected) 
     200        { 
     201            var enumerator1 = actual.GetEnumerator(); 
     202            var enumerator2 = expected.GetEnumerator(); 
    207203            bool moveNext1 = false, moveNext2 = false; 
    208204            while (((moveNext1 = enumerator1.MoveNext()) & (moveNext2 = enumerator2.MoveNext())) 
     
    213209            enumerator1.Dispose(); 
    214210            enumerator2.Dispose(); 
     211            return actual; 
    215212        } 
    216213 
  • trunk/src/core/OpenRasta.Tests.Unit/Codecs/MultipartFormDataCodec_Specification.cs

    r420 r426  
    263263        public static string TELEPHONE_FIELD_UTF8_QUOTED = @" 
    264264--boundary42 
    265 Content-Disposition: form-data; name=""=?UTF-8?Q?T=C3=A9l=C3=A9phone?="" 
     265Content-Disposition: form-data; name==?UTF-8?Q?T=C3=A9l=C3=A9phone?= 
    266266 
    267267077 777 7777 
     
    269269        public static string TELEPHONE_FIELD_UTF8_BASE64 = @" 
    270270--boundary42 
    271 Content-Disposition: form-data; name=""=?UTF-8?B?VMOpbMOpcGhvbmU=?="" 
     271Content-Disposition: form-data; name==?UTF-8?B?VMOpbMOpcGhvbmU=?= 
    272272 
    273273077 777 7777 
     
    275275        public static string TELEPHONE_FIELD_ISO88591_QUOTED = @" 
    276276--boundary42 
    277 Content-Disposition: form-data; name=""=?ISO-8859-1?Q?T=E9l=E9phone?="" 
     277Content-Disposition: form-data; name==?ISO-8859-1?Q?T=E9l=E9phone?= 
    278278 
    279279077 777 7777 
  • trunk/src/core/OpenRasta.Tests.Unit/IO/MultipartWriter_Specification.cs

    r362 r426  
    6666                @" 
    6767--boundary 
    68 Content-Disposition: form-data; name=""user"" 
     68Content-Disposition: form-data; name=user 
    6969 
    7070username 
  • trunk/src/core/OpenRasta.Tests.Unit/OpenRasta.Tests.Unit.csproj

    r421 r426  
    3636    <ErrorReport>prompt</ErrorReport> 
    3737    <WarningLevel>4</WarningLevel> 
     38    <Optimize>true</Optimize> 
     39    <AllowUnsafeBlocks>true</AllowUnsafeBlocks> 
    3840  </PropertyGroup> 
    3941  <ItemGroup> 
     
    113115    <Compile Include="Security\RequiresRoleInterceptor_Specification.cs" /> 
    114116    <Compile Include="Text\Rfc2231Encoding_Specification.cs" /> 
     117    <Compile Include="Text\StringBuilderExtensions_Spec.cs" /> 
     118    <Compile Include="Text\Tokenizers\Izers.cs" /> 
    115119    <Compile Include="TypeSystem\Members_Specification.cs" /> 
    116120    <Compile Include="TypeSystem\Instances_Specification.cs" /> 
  • trunk/src/core/OpenRasta.Tests.Unit/Text/Rfc2231Encoding_Specification.cs

    r421 r426  
    88namespace Rfc2231Encoding_Specification 
    99{ 
     10     
    1011    public class parameters : context 
    1112    { 
  • trunk/src/core/OpenRasta.Tests.Unit/Web/Headers/HttpHeaders_Specification.cs

    r421 r426  
    1 #region License 
     1#region License 
    22/* Authors: 
    33 *      Sebastien Lambla (seb@serialseb.com) 
     
    9696    } 
    9797 
    98     public class whettn_parsing_content_disposition : context 
     98    public class when_parsing_content_disposition : context 
    9999    { 
    100         [Test] 
     100        [Test, Ignore("Depreciated behavior in latest http bis")] 
    101101        public void a_parameter_value_without_quotes_results_in_an_error() 
    102102        { 
     
    142142            var header = new ContentDispositionHeader("form-data ; name= \"hi\";"); 
    143143            header.FieldValue. 
    144                 ShouldBe("form-data; name=\"hi\""); 
     144                ShouldBe("form-data; name=hi"); 
    145145        } 
    146146 
     
    155155        public void inlonly() 
    156156        { 
    157             new ContentDispositionHeader("inline"); 
     157            new ContentDispositionHeader("inline") 
     158                .Disposition.ShouldBe("inline"); 
    158159        } 
    159160        [Test] 
    160161        public void inlwithasciifilename() 
    161162        { 
    162             new ContentDispositionHeader(@"inline; filename=""foo.html"""); 
     163            var h = new ContentDispositionHeader(@"inline; filename=""foo.html"""); 
     164            h.Disposition.ShouldBe("inline"); 
     165            h.FileName.ShouldBe("foo.html"); 
    163166 
    164167        } 
     
    166169        public void inlwithasciifilenamepdf() 
    167170        { 
    168             new ContentDispositionHeader(@"inline; filename=""foo.pdf"""); 
     171            var h = new ContentDispositionHeader(@"inline; filename=""foo.pdf"""); 
     172            h.Disposition.ShouldBe("inline"); 
     173            h.FileName.ShouldBe("foo.pdf"); 
    169174 
    170175        } 
     
    207212             
    208213        } 
    209         [Test] 
     214        [Test, Ignore("Outdated by draft, dot is compat with token def")] 
    210215        public void attwithasciifilenamenq() 
    211216        { 
    212217            Executing(() => new ContentDispositionHeader(@"attachment; filename=foo.html")) 
    213218                .ShouldThrow<FormatException>(); 
    214  
    215219        } 
    216220        [Test] 
     
    249253        { 
    250254            new ContentDispositionHeader(@"attachment; filename*=UTF-8''foo-%c3%a4-%e2%82%ac.html") 
    251                 .FileName.ShouldBe("foo-ä-€.html"); 
     255                .FileName.ShouldBe("foo-ä-.html"); 
    252256 
    253257        } 
     
    256260        { 
    257261            new ContentDispositionHeader(@"attachment; filename*=UTF-8''foo-a%cc%88.html") 
    258                 .FileName.ShouldBe("foo-ä.html"); 
    259  
    260         } 
    261         [Test] 
     262                .FileName.ShouldBe("foo-.html"); 
     263 
     264        } 
     265        [Test, Ignore("UTF8 code points but still parses as windows-western")] 
    262266        public void attwithfn2231utf8_bad() 
    263267        { 
    264             Executing(() => new ContentDispositionHeader(@"attachment; filename*=iso-8859-1''foo-%c3%a4-%e2%82%ac.html")) 
    265                 .ShouldThrow<FormatException>(); 
    266         } 
    267         [Test] 
     268            new ContentDispositionHeader(@"attachment; filename*=iso-8859-1''foo-%c3%a4-%e2%82%ac.html") 
     269            .FileName.ShouldBeNull(); 
     270        } 
     271        [Test, Ignore("Spaces supported for compat reason")] 
    268272        public void attwithfn2231ws1() 
    269273        { 
    270             Executing(() => new ContentDispositionHeader(@"attachment; filename *=UTF-8''foo-%c3%a4.html")) 
    271                 .ShouldThrow<FormatException>(); 
     274            new ContentDispositionHeader(@"attachment; filename *=UTF-8''foo-%c3%a4.html") 
     275            .FileName.ShouldBeNull(); 
    272276        } 
    273277        [Test] 
     
    287291        public void attwithfn2231quot() 
    288292        { 
    289             Executing(() => new ContentDispositionHeader(@"attachment; filename*=""UTF-8''foo-%c3%a4.html""")) 
    290                 .ShouldThrow<FormatException>(); 
    291  
    292  
     293            new ContentDispositionHeader(@"attachment; filename*=""UTF-8''foo-%c3%a4.html""") 
     294                .FileName.ShouldBeNull(); 
    293295        } 
    294296        [Test] 
    295297        public void attwithfn2231encmissing() 
    296298        { 
    297             Executing(() => new ContentDispositionHeader(@"attachment; filename*=''foo-%c3%a4.html")) 
    298                 .ShouldThrow<FormatException>(); 
    299  
    300  
    301         } 
    302         [Test] 
     299            new ContentDispositionHeader(@"attachment; filename*=''foo-%c3%a4.html") 
     300                .FileName.ShouldBeNull(); 
     301 
     302 
     303        } 
     304        [Test, Ignore("Depreciated in draft spec")] 
    303305        public void attfncont() 
    304306        { 
     
    307309 
    308310        } 
    309         [Test] 
     311        [Test, Ignore("Depreciated in draft spec")] 
    310312        public void attfncontenc() 
    311313        { 
  • trunk/src/core/OpenRasta.Tests.Unit/Web/Pipeline/Contributors/HandlerMethodInvoker_Specification.cs

    r362 r426  
    124124    //        Context.ServerErrors[0] 
    125125    //            .ShouldBeOfType<ErrorFrom<HandlerMethodInvoker>>() 
    126     //            .Message 
     126    //            .DiagnosticsMessage 
    127127    //            .ShouldContain("InvalidOperationException"); 
    128128    //    } 
  • trunk/src/core/OpenRasta/Collections/NullBehaviorDictionary.cs

    r362 r426  
    99#endregion 
    1010 
     11using System.Collections; 
    1112using System.Collections.Generic; 
    1213 
     
    2728        { 
    2829        } 
    29  
     30        public NullBehaviorDictionary(IEnumerable<KeyValuePair<TKey, TValue>> source, IEqualityComparer<TKey> comparer) 
     31            : base(comparer) 
     32        { 
     33            foreach (var key in source) 
     34                ((ICollection<KeyValuePair<TKey, TValue>>)this).Add(key); 
     35        } 
    3036        public override TValue this[TKey key] 
    3137        { 
  • trunk/src/core/OpenRasta/Diagnostics/ILogger.cs

    r362 r426  
    1414namespace OpenRasta.Diagnostics 
    1515{ 
     16    /// <summary> 
     17    /// Provides the logging interfaces used by OpenRasta to communicate the state of various diagnostics information to the rest of the system. 
     18    /// </summary> 
     19    /// <remarks> 
     20    /// Should you wish to collect some of those events your self, </remarks> 
    1621    public interface ILogger 
    1722    { 
     23 
    1824        IDisposable Operation(object source, string name); 
    1925 
     
    3339    public interface ILogSource 
    3440    { 
     41    } 
     42    public interface IDiagnosticsListener 
     43    { 
     44        void Received(Error errorMessage); 
     45        void Received(Warning warningMessage); 
     46        void Received(Information infoMessage); 
     47        void Received(DebugInfo debugMessage); 
    3548    } 
    3649// ReSharper restore UnusedTypeParameter 
  • trunk/src/core/OpenRasta/Error.cs

    r383 r426  
    11using System; 
     2using OpenRasta.Diagnostics; 
    23 
    34namespace OpenRasta 
    45{ 
    5     public class Error 
     6    public class Error : DiagnosticsMessage 
    67    { 
    7         public string Title { get; set; } 
    8         public string Message { get; set; } 
    98        public Exception Exception { get; set; } 
    109        public override string ToString() 
  • trunk/src/core/OpenRasta/Hosting/HttpListener/HttpListenerResponse.cs

    r420 r426  
    22using System.Collections.Generic; 
    33using System.IO; 
    4 using System.Linq; 
    54using OpenRasta.Web; 
    65using OpenRasta.Web.Headers; 
     
    1110    public class HttpListenerResponse : IResponse 
    1211    { 
     12        static readonly Dictionary<Type, Action<IHttpHeader, System.Net.HttpListenerResponse>> HEADER_FACTORIES; 
    1313        readonly HttpListenerCommunicationContext _context; 
    1414        readonly System.Net.HttpListenerResponse _nativeResponse; 
    1515 
    1616        readonly MemoryStream _tempStream = new MemoryStream(); 
    17         static readonly Dictionary<Type, Action<IHttpHeader, System.Net.HttpListenerResponse>> HEADER_FACTORIES; 
    1817 
    1918        static HttpListenerResponse() 
     
    4746                throw new InvalidOperationException("The headers have already been sent."); 
    4847            _nativeResponse.Headers.Clear(); 
    49             foreach(var header in Headers) 
     48            foreach (var header in Headers) 
    5049            { 
    5150                if (header == null) continue; 
     
    6968                } 
    7069            } 
     70 
    7171            HeadersSent = true; 
    7272 
  • trunk/src/core/OpenRasta/OpenRasta.csproj

    r421 r426  
    3333    <PlatformTarget>AnyCPU</PlatformTarget> 
    3434    <ErrorReport>prompt</ErrorReport> 
     35    <Optimize>false</Optimize> 
    3536  </PropertyGroup> 
    3637  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 
     
    4041    <ErrorReport>prompt</ErrorReport> 
    4142    <WarningLevel>4</WarningLevel> 
     43    <DebugSymbols>true</DebugSymbols> 
    4244  </PropertyGroup> 
    4345  <PropertyGroup Condition="'$(RuntimeTargetFrameworkVersion)' == 'v2.0'"> 
     
    6062      <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    6163    </Reference> 
     64    <Reference Include="System.Windows.Forms" /> 
    6265    <Reference Include="System.Xml" /> 
    6366    <Reference Include="System.Core" Condition="'$(TargetFrameworkVersion)' == 'v3.5'" /> 
     
    138141    <Compile Include="Diagnostics\LogCategoryAttribute.cs" /> 
    139142    <Compile Include="Diagnostics\LogSource.cs" /> 
     143    <Compile Include="Diagnostics\DiagnosticsMessage.cs" /> 
    140144    <Compile Include="Diagnostics\NullErrorCollector.cs" /> 
    141145    <Compile Include="Linq\ExpressionExtensions.cs" /> 
     
    243247    <Compile Include="Security\RequiresRoleAttribute.cs" /> 
    244248    <Compile Include="Security\RequiresRoleInterceptor.cs" /> 
     249    <Compile Include="Text\StringBuilderExtensions.cs" /> 
     250    <Compile Include="Text\Tokenizers\Ch.cs" /> 
     251    <Compile Include="Text\Tokenizers\CharacterMatcherExtensions.cs" /> 
     252    <Compile Include="Text\Tokenizers\CharacterRange.cs" /> 
     253    <Compile Include="Text\Tokenizers\CharacterSet.cs" /> 
     254    <Compile Include="Text\Tokenizers\HttpTokenizerExtensions.cs" /> 
     255    <Compile Include="Text\Tokenizers\Http.cs" /> 
     256    <Compile Include="Text\Tokenizers\ICharacterMatcher.cs" /> 
     257    <Compile Include="Text\Tokenizers\ITokenizerState.cs" /> 
     258    <Compile Include="Text\Tokenizers\Minus.cs" /> 
     259    <Compile Include="Text\Tokenizers\AbnfIzers.cs" /> 
     260    <Compile Include="Text\Tokenizers\Rfc3234Tokenizers.cs" /> 
     261    <Compile Include="Text\Tokenizers\UriIzers.cs" /> 
     262    <Compile Include="Text\Tokenizers\StringBasedState.cs" /> 
     263    <Compile Include="Text\Tokenizers\Tokenizer.cs" /> 
     264    <Compile Include="Text\Tokenizers\TokenizerExtensions.cs" /> 
     265    <Compile Include="Text\Tokenizers\Izers.cs" /> 
     266    <Compile Include="Text\Tokenizers\Union.cs" /> 
    245267    <Compile Include="TypeSystem\INativeMember.cs" /> 
    246268    <Compile Include="TypeSystem\IParameter.cs" /> 
  • trunk/src/core/OpenRasta/Web/Headers/Entity/ContentDispositionHeader.cs

    r421 r426  
    1313using System.Text; 
    1414using OpenRasta.Text; 
     15using OpenRasta.Text.Tokenizers; 
    1516 
    1617namespace OpenRasta.Web.Headers 
     
    1819    public class ContentDispositionHeader : HttpHeader<ContentDispositionHeader> 
    1920    { 
    20         public ContentDispositionHeader(string value) : this() 
     21        ContentDispositionHeaderData _headerData; 
     22 
     23        public ContentDispositionHeader(string value) 
     24            : base(HttpHeaderFieldNames.CONTENT_DISPOSITION) 
    2125        { 
    2226            FieldValue = value; 
    2327        } 
    24         public ContentDispositionHeader() : base(HttpHeaderFieldNames.CONTENT_DISPOSITION) 
     28 
     29        public ContentDispositionHeader() 
     30            : base(HttpHeaderFieldNames.CONTENT_DISPOSITION) 
    2531        { 
     32            _headerData = new ContentDispositionHeaderData(); 
    2633        } 
    2734 
    28         public string Disposition { get; set; } 
    29         public string FileName { get; set; } 
    30         public string Name { get; set; } 
     35        public string Disposition 
     36        { 
     37            get { return _headerData.Disposition; } 
     38            set { _headerData.Disposition = value; } 
     39        } 
    3140 
    3241        public override string FieldValue 
     
    3544            { 
    3645                var header = new StringBuilder(); 
    37                 header.Append(Disposition); 
    38                 if (Name != null) 
    39                     header.Append("; name=\"").Append(Name).Append("\""); 
    40                 if (FileName != null) 
    41                     header.Append("; filename=\"").Append(FileName).Append("\""); 
     46                header.Append(Disposition.ToLowerInvariant()); 
     47                foreach (var parameter in Parameters) 
     48                    header.AppendHttpParameter(parameter.Key, parameter.Value); 
     49                    
    4250                return header.ToString(); 
    4351            } 
     52 
    4453            set 
    4554            { 
     
    5059                } 
    5160 
    52                 var fragments = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); 
    53                 if (fragments.Length == 0) 
    54                     throw new FormatException("The header value {0} is invalid for Content-Disposition.".With(value)); 
    55                 Disposition = fragments[0].Trim(); 
     61                _headerData = HttpHeaders.ContentDisposition.Parse(value); 
    5662 
    57                 for (int i = 1; i < fragments.Length; i++) 
    58                 { 
    59                     var parameter = ParseParameter(fragments[i]); 
    60                     if (string.Compare(parameter.Key, "filename", StringComparison.OrdinalIgnoreCase) == 0) 
    61                         FileName = parameter.Value; 
    62                     else if (string.Compare(parameter.Key, "name", StringComparison.OrdinalIgnoreCase) == 0) 
    63                         Name = Rfc2047Encoding.DecodeTextToken(parameter.Value); 
    64                 } 
     63                // var fragments = value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); 
     64                // if (fragments.Length == 0) 
     65                // throw new FormatException("The header value {0} is invalid for Content-Disposition.".With(value)); 
     66                // Disposition = fragments[0].Trim(); 
     67 
     68                // for (int i = 1; i < fragments.Length; i++) 
     69                // { 
     70                // var parameter = ParseParameter(fragments[i]); 
     71                // if (string.Compare(parameter.Key, "filename", StringComparison.OrdinalIgnoreCase) == 0) 
     72                // FileName = parameter.Value; 
     73                // else if (string.Compare(parameter.Key, "name", StringComparison.OrdinalIgnoreCase) == 0) 
     74                // Name = Rfc2047Encoding.DecodeTextToken(parameter.Value); 
     75                // } 
    6576            } 
    6677        } 
    67         KeyValuePair<string, string> ParseParameter(string fragment) 
     78 
     79        public string FileName 
    6880        { 
    69             int equalIndex = fragment.IndexOf('='); 
    70             if (equalIndex == -1) 
    71                 throw new FormatException(); 
    72             string key = fragment.Substring(0, equalIndex).Trim(); 
    73             int beginningValue = fragment.IndexOf('"', equalIndex + 1); 
    74             if (beginningValue == -1) 
    75                 throw new FormatException(); 
    76             int endValue = fragment.IndexOf('"', beginningValue + 1); 
    77             if (endValue == -1) 
    78                 throw new FormatException(); 
     81            get { return _headerData.Parameters["filename"]; } 
     82            set { _headerData.Parameters["filename"] = value; } 
     83        } 
    7984 
    80             return new KeyValuePair<string, string>(key, fragment.Substring(beginningValue + 1, endValue - beginningValue - 1)); 
     85 
     86        public string Name 
     87        { 
     88            get { return _headerData.Parameters["name"]; } 
     89            set { _headerData.Parameters["name"] = value; } 
    8190        } 
     91 
     92        public IDictionary<string, string> Parameters 
     93        { 
     94            get { return _headerData.Parameters; } 
     95        } 
     96 
     97        // KeyValuePair<string, string> ParseParameter(string fragment) 
     98        // { 
     99        // int equalIndex = fragment.IndexOf('='); 
     100        // if (equalIndex == -1) 
     101        // throw new FormatException(); 
     102        // string key = fragment.Substring(0, equalIndex).Trim(); 
     103        // int beginningValue = fragment.IndexOf('"', equalIndex + 1); 
     104        // if (beginningValue == -1) 
     105        // throw new FormatException(); 
     106        // int endValue = fragment.IndexOf('"', beginningValue + 1); 
     107        // if (endValue == -1) 
     108        // throw new FormatException(); 
     109 
     110        // return new KeyValuePair<string, string>(key, fragment.Substring(beginningValue + 1, endValue - beginningValue - 1)); 
     111        // } 
    82112    } 
    83113} 
  • trunk/src/core/OpenRasta/Web/OperationResult.cs

    r420 r426  
    6060            context.Response.StatusCode = StatusCode; 
    6161            if (RedirectLocation != null) 
    62                 context.Response.Headers["Location"] = RedirectLocation.ToString(); 
     62                context.Response.Headers["Location"] = RedirectLocation.OriginalString; 
    6363 
    6464            OnExecute(context); 
  • trunk/src/core/core.sln

    r421 r426  
    2828                ..\..\build\openbastard.proj = ..\..\build\openbastard.proj 
    2929                ..\..\build\sharpview.proj = ..\..\build\sharpview.proj 
     30                ..\..\build\unity.proj = ..\..\build\unity.proj 
    3031                ..\..\build\vside.proj = ..\..\build\vside.proj 
    3132        EndProjectSection