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

◆ GetExpressionLength()

static HttpParseResult System.Net.Http.HttpRuleParser.GetExpressionLength ( string input,
int startIndex,
char openChar,
char closeChar,
bool supportsNesting,
int nestedCount,
out int length )
inlinestaticprivate

Definition at line 207 of file HttpRuleParser.cs.

208 {
209 length = 0;
210 if (input[startIndex] != openChar)
211 {
212 return HttpParseResult.NotParsed;
213 }
214 int num = startIndex + 1;
215 while (num < input.Length)
216 {
217 int length2 = 0;
218 if (num + 2 < input.Length && GetQuotedPairLength(input, num, out length2) == HttpParseResult.Parsed)
219 {
220 num += length2;
221 continue;
222 }
223 char c = input[num];
224 if (c == '\r' || c == '\n')
225 {
226 return HttpParseResult.InvalidFormat;
227 }
228 if (supportsNesting && c == openChar)
229 {
230 if (nestedCount > 5)
231 {
232 return HttpParseResult.InvalidFormat;
233 }
234 int length3 = 0;
235 switch (GetExpressionLength(input, num, openChar, closeChar, supportsNesting, nestedCount + 1, out length3))
236 {
237 case HttpParseResult.Parsed:
238 num += length3;
239 break;
240 case HttpParseResult.InvalidFormat:
241 return HttpParseResult.InvalidFormat;
242 }
243 }
244 else
245 {
246 if (input[num] == closeChar)
247 {
248 length = num - startIndex + 1;
249 return HttpParseResult.Parsed;
250 }
251 num++;
252 }
253 }
254 return HttpParseResult.InvalidFormat;
255 }
static HttpParseResult GetExpressionLength(string input, int startIndex, char openChar, char closeChar, bool supportsNesting, int nestedCount, out int length)
static HttpParseResult GetQuotedPairLength(string input, int startIndex, out int length)

References System.Net.Http.HttpRuleParser.GetExpressionLength(), System.Net.Http.HttpRuleParser.GetQuotedPairLength(), System.input, System.length, System.length2, System.length3, and System.startIndex.

Referenced by System.Net.Http.HttpRuleParser.GetCommentLength(), System.Net.Http.HttpRuleParser.GetExpressionLength(), and System.Net.Http.HttpRuleParser.GetQuotedStringLength().