예제 #1
0
 private ViaHeaderValue(ViaHeaderValue source)
 {
     this.protocolName = source.protocolName;
     this.protocolVersion = source.protocolVersion;
     this.receivedBy = source.receivedBy;
     this.comment = source.comment;
 }
예제 #2
0
 internal static int GetViaLength(string input, int startIndex, out object parsedValue)
 {
     parsedValue = null;
     if (string.IsNullOrEmpty(input) || (startIndex >= input.Length))
     {
         return 0;
     }
     string protocolName = null;
     string protocolVersion = null;
     int num = GetProtocolEndIndex(input, startIndex, out protocolName, out protocolVersion);
     if ((num == startIndex) || (num == input.Length))
     {
         return 0;
     }
     string host = null;
     int num2 = HttpRuleParser.GetHostLength(input, num, true, out host);
     if (num2 == 0)
     {
         return 0;
     }
     num += num2;
     num += HttpRuleParser.GetWhitespaceLength(input, num);
     string str4 = null;
     if ((num < input.Length) && (input[num] == '('))
     {
         int length = 0;
         if (HttpRuleParser.GetCommentLength(input, num, out length) != HttpParseResult.Parsed)
         {
             return 0;
         }
         str4 = input.Substring(num, length);
         num += length;
         num += HttpRuleParser.GetWhitespaceLength(input, num);
     }
     ViaHeaderValue value2 = new ViaHeaderValue {
         protocolVersion = protocolVersion,
         protocolName = protocolName,
         receivedBy = host,
         comment = str4
     };
     parsedValue = value2;
     return (num - startIndex);
 }
예제 #3
0
 /// <summary>Determines whether a string is valid <see cref="T:NMasters.Silverlight.Net.Http.Headers.ViaHeaderValue" /> information.</summary>
 /// <returns>Returns <see cref="T:System.Boolean" />.true if <paramref name="input" /> is valid <see cref="T:NMasters.Silverlight.Net.Http.Headers.ViaHeaderValue" /> information; otherwise, false.</returns>
 /// <param name="input">The string to validate.</param>
 /// <param name="parsedValue">The <see cref="T:NMasters.Silverlight.Net.Http.Headers.ViaHeaderValue" /> version of the string.</param>
 public static bool TryParse(string input, out ViaHeaderValue parsedValue)
 {
     object obj2;
     int index = 0;
     parsedValue = null;
     if (GenericHeaderParser.SingleValueViaParser.TryParseValue(input, null, ref index, out obj2))
     {
         parsedValue = (ViaHeaderValue) obj2;
         return true;
     }
     return false;
 }