internal unsafe void SetServerTimeout(int[] timeouts, uint minSendRate)
 {
     UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_LIMIT_INFO http_timeout_limit_info = new UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_LIMIT_INFO {
         Flags = UnsafeNclNativeMethods.HttpApi.HTTP_FLAGS.HTTP_INITIALIZE_SERVER,
         DrainEntityBody = (ushort) timeouts[1],
         EntityBody = (ushort) timeouts[0],
         RequestQueue = (ushort) timeouts[2],
         IdleConnection = (ushort) timeouts[3],
         HeaderWait = (ushort) timeouts[4],
         MinSendRate = minSendRate
     };
     IntPtr info = new IntPtr((void*) &http_timeout_limit_info);
     this.SetUrlGroupProperty(UnsafeNclNativeMethods.HttpApi.HTTP_SERVER_PROPERTY.HttpServerTimeoutsProperty, info, (uint) Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_LIMIT_INFO)));
 }
Exemplo n.º 2
0
        internal void SetServerTimeout(int[] timeouts, uint minSendBytesPerSecond) {
            ValidateV2Property(); // CheckDispose and initilize HttpListener in the case of app.config timeouts

            UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_LIMIT_INFO timeoutinfo =
                new UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_LIMIT_INFO();

            timeoutinfo.Flags = UnsafeNclNativeMethods.HttpApi.HTTP_FLAGS.HTTP_PROPERTY_FLAG_PRESENT;
            timeoutinfo.DrainEntityBody = 
                (ushort)timeouts[(int)UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_TYPE.DrainEntityBody];
            timeoutinfo.EntityBody =
                (ushort)timeouts[(int)UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_TYPE.EntityBody];
            timeoutinfo.RequestQueue =
                (ushort)timeouts[(int)UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_TYPE.RequestQueue];
            timeoutinfo.IdleConnection =
                (ushort)timeouts[(int)UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_TYPE.IdleConnection];
            timeoutinfo.HeaderWait =
                (ushort)timeouts[(int)UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_TYPE.HeaderWait];
            timeoutinfo.MinSendRate = minSendBytesPerSecond;                

            IntPtr infoptr = new IntPtr(&timeoutinfo);

            SetUrlGroupProperty(
                UnsafeNclNativeMethods.HttpApi.HTTP_SERVER_PROPERTY.HttpServerTimeoutsProperty,
                infoptr, (uint)Marshal.SizeOf(typeof(UnsafeNclNativeMethods.HttpApi.HTTP_TIMEOUT_LIMIT_INFO)));
        }