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

◆ BuildServiceNames()

string[] System.Net.ServiceNameStore.BuildServiceNames ( string uriPrefix)
inline

Definition at line 220 of file ServiceNameStore.cs.

221 {
223 IPAddress address = null;
224 if (string.Equals(text, "*", StringComparison.OrdinalIgnoreCase) || string.Equals(text, "+", StringComparison.OrdinalIgnoreCase) || IPAddress.TryParse(text, out address))
225 {
226 try
227 {
228 string hostName = Dns.GetHostEntry(string.Empty).HostName;
229 return new string[1] { "HTTP/" + hostName };
230 }
231 catch (SocketException)
232 {
233 return Array.Empty<string>();
234 }
235 catch (SecurityException)
236 {
237 return Array.Empty<string>();
238 }
239 }
240 if (!text.Contains('.'))
241 {
242 try
243 {
244 string hostName2 = Dns.GetHostEntry(text).HostName;
245 return new string[2]
246 {
247 "HTTP/" + text,
248 "HTTP/" + hostName2
249 };
250 }
251 catch (SocketException)
252 {
253 return new string[1] { "HTTP/" + text };
254 }
255 catch (SecurityException)
256 {
257 return new string[1] { "HTTP/" + text };
258 }
259 }
260 return new string[1] { "HTTP/" + text };
261 }
string ExtractHostname(string uriPrefix, bool allowInvalidUriStrings)

References System.Net.Equals, System.Net.ServiceNameStore.ExtractHostname(), System.Net.Dns.GetHostEntry(), System.text, and System.Net.IPAddress.TryParse().

Referenced by System.Net.ServiceNameStore.Add().