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

◆ MarshalAndVerifyHttpHeader()

static void System.Net.WebSockets.WebSocketProtocolComponent.MarshalAndVerifyHttpHeader ( IntPtr httpHeaderPtr,
ref global::Interop::WebSocket::HttpHeader httpHeader )
inlinestaticprivate

Definition at line 298 of file WebSocketProtocolComponent.cs.

299 {
300 IntPtr intPtr = Marshal.ReadIntPtr(httpHeaderPtr);
301 IntPtr ptr = IntPtr.Add(httpHeaderPtr, IntPtr.Size);
302 int num = Marshal.ReadInt32(ptr);
303 if (intPtr != IntPtr.Zero)
304 {
305 httpHeader.Name = Marshal.PtrToStringAnsi(intPtr, num);
306 }
307 if ((httpHeader.Name == null && num != 0) || (httpHeader.Name != null && num != httpHeader.Name.Length))
308 {
309 throw new AccessViolationException();
310 }
311 int offset = 2 * IntPtr.Size;
312 int offset2 = 3 * IntPtr.Size;
313 IntPtr ptr2 = Marshal.ReadIntPtr(IntPtr.Add(httpHeaderPtr, offset));
314 ptr = IntPtr.Add(httpHeaderPtr, offset2);
315 num = Marshal.ReadInt32(ptr);
316 httpHeader.Value = Marshal.PtrToStringAnsi(ptr2, num);
317 if ((httpHeader.Value == null && num != 0) || (httpHeader.Value != null && num != httpHeader.Value.Length))
318 {
319 throw new AccessViolationException();
320 }
321 }
static IntPtr ReadIntPtr(object ptr, int ofs)
Definition Marshal.cs:976
static int ReadInt32(object ptr, int ofs)
Definition Marshal.cs:59
static unsafe? string PtrToStringAnsi(IntPtr ptr)
Definition Marshal.cs:630

References System.IntPtr.Add(), System.offset, System.Runtime.InteropServices.Marshal.PtrToStringAnsi(), System.Runtime.InteropServices.Marshal.ReadInt32(), System.Runtime.InteropServices.Marshal.ReadIntPtr(), System.IntPtr.Size, and System.IntPtr.Zero.

Referenced by System.Net.WebSockets.WebSocketProtocolComponent.MarshalHttpHeaders().