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

◆ Host

string System.Net.HttpWebRequest.Host
getset

Definition at line 323 of file HttpWebRequest.cs.

324 {
325 get
326 {
327 Uri uri = _hostUri ?? Address;
328 if ((!(_hostUri == null) && _hostHasPort) || !Address.IsDefaultPort)
329 {
330 return uri.Host + ":" + uri.Port;
331 }
332 return uri.Host;
333 }
334 set
335 {
337 {
339 }
340 if (value == null)
341 {
342 throw new ArgumentNullException("value");
343 }
344 if (value.Contains('/') || !TryGetHostUri(value, out var hostUri))
345 {
346 throw new ArgumentException(System.SR.net_invalid_host, "value");
347 }
350 {
351 _hostHasPort = true;
352 return;
353 }
354 if (!value.Contains(':'))
355 {
356 _hostHasPort = false;
357 return;
358 }
359 int num = value.IndexOf(']');
360 _hostHasPort = num == -1 || value.LastIndexOf(':') > num;
361 }
362 }
bool TryGetHostUri(string hostName, [NotNullWhen(true)] out Uri hostUri)
static string net_writestarted
Definition SR.cs:20
static string net_invalid_host
Definition SR.cs:144
Definition SR.cs:7
bool IsDefaultPort
Definition Uri.cs:333

Referenced by System.Net.HttpWebRequest.SendRequest().