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

◆ ReadCore()

unsafe int System.Net.HttpRequestStream.ReadCore ( byte[] buffer,
int offset,
int size )
inlineprivate

Definition at line 221 of file HttpRequestStream.cs.

222 {
223 uint num = 0u;
224 if (_dataChunkIndex != -1)
225 {
227 }
228 if (_dataChunkIndex == -1 && num < size)
229 {
230 if (System.Net.NetEventSource.Log.IsEnabled())
231 {
232 System.Net.NetEventSource.Info(this, "size:" + size + " offset:" + offset, "ReadCore");
233 }
234 uint num2 = 0u;
235 uint bytesReturned = 0u;
236 offset += (int)num;
237 size -= (int)num;
238 if (size > 131072)
239 {
240 size = 131072;
241 }
242 fixed (byte* ptr = buffer)
243 {
244 if (System.Net.NetEventSource.Log.IsEnabled())
245 {
246 System.Net.NetEventSource.Info(this, "Calling Interop.HttpApi.HttpReceiveRequestEntityBody", "ReadCore");
247 }
248 uint flags = 0u;
249 if (!_inOpaqueMode)
250 {
251 flags = 1u;
252 }
253 num2 = global::Interop.HttpApi.HttpReceiveRequestEntityBody(_httpContext.RequestQueueHandle, _httpContext.RequestId, flags, ptr + offset, (uint)size, out bytesReturned, null);
254 num += bytesReturned;
255 if (System.Net.NetEventSource.Log.IsEnabled())
256 {
257 System.Net.NetEventSource.Info(this, "Call to Interop.HttpApi.HttpReceiveRequestEntityBody returned:" + num2 + " dataRead:" + num, "ReadCore");
258 }
259 }
260 if (num2 != 0 && num2 != 38)
261 {
262 Exception ex = new HttpListenerException((int)num2);
263 if (System.Net.NetEventSource.Log.IsEnabled())
264 {
265 System.Net.NetEventSource.Error(this, ex.ToString(), "ReadCore");
266 }
267 throw ex;
268 }
269 UpdateAfterRead(num2, num);
270 }
271 if (System.Net.NetEventSource.Log.IsEnabled())
272 {
273 System.Net.NetEventSource.DumpBuffer(this, buffer, offset, (int)num, "ReadCore");
274 System.Net.NetEventSource.Info(this, "returning dataRead:" + num, "ReadCore");
275 }
276 return (int)num;
277 }
readonly HttpListenerContext _httpContext
void UpdateAfterRead(uint statusCode, uint dataRead)
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static void DumpBuffer(object thisOrContextObject, byte[] buffer, int offset, int count, [CallerMemberName] string memberName=null)

References System.Net.HttpRequestStream._dataChunkIndex, System.Net.HttpRequestStream._dataChunkOffset, System.Net.HttpRequestStream._httpContext, System.Net.HttpRequestStream._inOpaqueMode, System.buffer, System.Net.NetEventSource.DumpBuffer(), System.Net.NetEventSource.Error(), System.Net.NetEventSource.Info(), System.Net.NetEventSource.Log, System.offset, System.Net.HttpListenerRequest.OriginalBlobAddress, System.Net.HttpListenerContext.Request, System.Net.HttpListenerRequest.RequestBuffer, System.Net.HttpListenerContext.RequestId, System.Net.HttpListenerContext.RequestQueueHandle, System.Exception.ToString(), and System.Net.HttpRequestStream.UpdateAfterRead().

Referenced by System.Net.HttpRequestStream.Read().