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

◆ TryParseProxyConfigPart()

static bool System.Net.Http.MultiProxy.TryParseProxyConfigPart ( ReadOnlySpan< char > proxyString,
bool secure,
[NotNullWhen(true)] out Uri uri,
out int charactersConsumed )
inlinestaticprivate

Definition at line 136 of file MultiProxy.cs.

137 {
138 int num = (secure ? 1 : 2);
139 int length = proxyString.Length;
140 while (true)
141 {
142 int i;
143 for (i = 0; i < proxyString.Length && Array.IndexOf(s_proxyDelimiters, proxyString[i]) >= 0; i++)
144 {
145 }
146 if (i == proxyString.Length)
147 {
148 break;
149 }
150 proxyString = proxyString.Slice(i);
151 int num2 = 3;
152 if (proxyString.StartsWith("http="))
153 {
154 num2 = 2;
155 proxyString = proxyString.Slice("http=".Length);
156 }
157 else if (proxyString.StartsWith("https="))
158 {
159 num2 = 1;
160 proxyString = proxyString.Slice("https=".Length);
161 }
162 if (proxyString.StartsWith("http://"))
163 {
164 num2 = 2;
165 proxyString = proxyString.Slice("http://".Length);
166 }
167 else if (proxyString.StartsWith("https://"))
168 {
169 num2 = 1;
170 proxyString = proxyString.Slice("https://".Length);
171 }
172 i = proxyString.IndexOfAny(s_proxyDelimiters);
173 if (i < 0)
174 {
175 i = proxyString.Length;
176 }
177 if ((num2 & num) != 0 && Uri.TryCreate("http://" + proxyString.Slice(0, i), UriKind.Absolute, out uri))
178 {
179 charactersConsumed = length - proxyString.Length + i;
180 return true;
181 }
182 proxyString = proxyString.Slice(i);
183 }
184 uri = null;
185 charactersConsumed = length;
186 return false;
187 }
UriKind
Definition UriKind.cs:4
static readonly char[] s_proxyDelimiters
Definition MultiProxy.cs:7
ReadOnlySpan< T > Slice(int start)

References System.Array.IndexOf(), System.length, System.ReadOnlySpan< T >.Length, System.Net.Http.MultiProxy.s_proxyDelimiters, System.ReadOnlySpan< T >.Slice(), and System.Uri.TryCreate().

Referenced by System.Net.Http.MultiProxy.Parse(), and System.Net.Http.MultiProxy.ReadNextHelper().