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

◆ GetHostLength()

static int System.Net.Http.HttpRuleParser.GetHostLength ( string input,
int startIndex,
bool allowToken,
out string host )
inlinestaticpackage

Definition at line 140 of file HttpRuleParser.cs.

141 {
142 host = null;
143 if (startIndex >= input.Length)
144 {
145 return 0;
146 }
147 int i = startIndex;
148 bool flag;
149 bool num;
150 for (flag = true; i < input.Length; flag = num, i++)
151 {
152 char c = input[i];
153 switch (c)
154 {
155 case '/':
156 return 0;
157 default:
158 num = flag && IsTokenChar(c);
159 continue;
160 case '\t':
161 case '\r':
162 case ' ':
163 case ',':
164 break;
165 }
166 break;
167 }
168 int num2 = i - startIndex;
169 if (num2 == 0)
170 {
171 return 0;
172 }
173 string text = input.Substring(startIndex, num2);
174 if ((!allowToken || !flag) && !IsValidHostName(text))
175 {
176 return 0;
177 }
178 host = text;
179 return num2;
180 }
static bool IsValidHostName(string host)
static bool IsTokenChar(char character)

References System.input, System.Net.Http.HttpRuleParser.IsTokenChar(), System.Net.Http.HttpRuleParser.IsValidHostName(), System.startIndex, and System.text.

Referenced by System.Net.Http.Headers.WarningHeaderValue.CheckAgent(), System.Net.Http.Headers.ViaHeaderValue.CheckReceivedBy(), System.Net.Http.Headers.ViaHeaderValue.GetViaLength(), System.Net.Http.Headers.GenericHeaderParser.ParseHost(), and System.Net.Http.Headers.WarningHeaderValue.TryReadAgent().