Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetViaLength()

static int System.Net.Http.Headers.ViaHeaderValue.GetViaLength ( string input,
int startIndex,
out object parsedValue )
inlinestaticpackage

Definition at line 125 of file ViaHeaderValue.cs.

126 {
127 parsedValue = null;
128 if (string.IsNullOrEmpty(input) || startIndex >= input.Length)
129 {
130 return 0;
131 }
132 int protocolEndIndex = GetProtocolEndIndex(input, startIndex, out var protocolName, out var protocolVersion);
133 if (protocolEndIndex == startIndex || protocolEndIndex == input.Length)
134 {
135 return 0;
136 }
137 string host;
138 int hostLength = HttpRuleParser.GetHostLength(input, protocolEndIndex, allowToken: true, out host);
139 if (hostLength == 0)
140 {
141 return 0;
142 }
143 protocolEndIndex += hostLength;
144 protocolEndIndex += HttpRuleParser.GetWhitespaceLength(input, protocolEndIndex);
145 string comment = null;
146 if (protocolEndIndex < input.Length && input[protocolEndIndex] == '(')
147 {
148 int length = 0;
149 if (HttpRuleParser.GetCommentLength(input, protocolEndIndex, out length) != 0)
150 {
151 return 0;
152 }
153 comment = input.Substring(protocolEndIndex, length);
154 protocolEndIndex += length;
155 protocolEndIndex += HttpRuleParser.GetWhitespaceLength(input, protocolEndIndex);
156 }
157 parsedValue = new ViaHeaderValue(protocolVersion, host, protocolName, comment);
158 return protocolEndIndex - startIndex;
159 }
static int GetProtocolEndIndex(string input, int startIndex, out string protocolName, out string protocolVersion)
ViaHeaderValue(string protocolVersion, string receivedBy)

References System.Net.Http.Headers.ViaHeaderValue.ViaHeaderValue(), System.Net.Http.HttpRuleParser.GetCommentLength(), System.Net.Http.HttpRuleParser.GetHostLength(), System.Net.Http.Headers.ViaHeaderValue.GetProtocolEndIndex(), System.Net.Http.HttpRuleParser.GetWhitespaceLength(), System.input, System.length, and System.startIndex.