Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
HttpRequestMessage.cs
Go to the documentation of this file.
3using System.Text;
5
6namespace System.Net.Http;
7
9{
10 private int _sendStatus;
11
13
15
17
19
21
23
24 private bool _disposed;
25
27
29
30 internal static HttpVersionPolicy DefaultVersionPolicy => HttpVersionPolicy.RequestVersionOrLower;
31
33 {
34 get
35 {
36 return _version;
37 }
38 set
39 {
40 if (value == null)
41 {
42 throw new ArgumentNullException("value");
43 }
46 }
47 }
48
50 {
51 get
52 {
53 return _versionPolicy;
54 }
55 set
56 {
59 }
60 }
61
62 public HttpContent? Content
63 {
64 get
65 {
66 return _content;
67 }
68 set
69 {
71 if (System.Net.NetEventSource.Log.IsEnabled())
72 {
73 if (value == null)
74 {
76 }
77 else
78 {
79 System.Net.NetEventSource.Associate(this, value, "Content");
80 }
81 }
83 }
84 }
85
87 {
88 get
89 {
90 return _method;
91 }
92 set
93 {
94 if (value == null)
95 {
96 throw new ArgumentNullException("value");
97 }
99 _method = value;
100 }
101 }
102
104 {
105 get
106 {
107 return _requestUri;
108 }
109 set
110 {
113 }
114 }
115
117
118 internal bool HasHeaders => _headers != null;
119
120 [Obsolete("HttpRequestMessage.Properties has been deprecated. Use Options instead.")]
122
124
126 : this(HttpMethod.Get, (Uri?)null)
127 {
128 }
129
137
142
143 public override string ToString()
144 {
146 stringBuilder.Append("Method: ");
147 stringBuilder.Append(_method);
148 stringBuilder.Append(", RequestUri: '");
149 stringBuilder.Append((_requestUri == null) ? "<null>" : _requestUri.ToString());
150 stringBuilder.Append("', Version: ");
151 stringBuilder.Append(_version);
152 stringBuilder.Append(", Content: ");
153 stringBuilder.Append((_content == null) ? "<null>" : _content.GetType().ToString());
154 stringBuilder.AppendLine(", Headers:");
156 return stringBuilder.ToString();
157 }
158
159 internal bool MarkAsSent()
160 {
161 return Interlocked.CompareExchange(ref _sendStatus, 1, 0) == 0;
162 }
163
164 internal bool WasSentByHttpClient()
165 {
166 return (_sendStatus & 1) != 0;
167 }
168
169 internal void MarkAsRedirected()
170 {
171 _sendStatus |= 2;
172 }
173
174 internal bool WasRedirected()
175 {
176 return (_sendStatus & 2) != 0;
177 }
178
179 protected virtual void Dispose(bool disposing)
180 {
181 if (disposing && !_disposed)
182 {
183 _disposed = true;
184 if (_content != null)
185 {
187 }
188 }
189 }
190
191 public void Dispose()
192 {
193 Dispose(disposing: true);
194 GC.SuppressFinalize(this);
195 }
196
197 private void CheckDisposed()
198 {
199 if (_disposed)
200 {
201 throw new ObjectDisposedException(GetType().ToString());
202 }
203 }
204}
static void SuppressFinalize(object obj)
Definition GC.cs:202
Definition GC.cs:8
static readonly Version Version11
Definition HttpVersion.cs:9
static void DumpHeaders(StringBuilder sb, params HttpHeaders[] headers)
virtual void Dispose(bool disposing)
IDictionary< string, object?> Properties
HttpRequestMessage(HttpMethod method, string? requestUri)
static HttpVersionPolicy DefaultVersionPolicy
HttpRequestMessage(HttpMethod method, Uri? requestUri)
virtual void Dispose(bool disposing)
static readonly System.Net.NetEventSource Log
static void Associate(object first, object second, [CallerMemberName] string memberName=null)
static void ContentNull(object obj)
static int CompareExchange(ref int location1, int value, int comparand)
override string ToString()
Definition Uri.cs:1119
UriKind
Definition UriKind.cs:4