Exemplo n.º 1
0
        private static void InitHttpApi(ushort majorVersion, ushort minorVersion)
        {
            version.HttpApiMajorVersion = majorVersion;
            version.HttpApiMinorVersion = minorVersion;

            var statusCode = HttpInitialize(version, (uint)(HTTP_FLAGS.HTTP_INITIALIZE_SERVER | HTTP_FLAGS.HTTP_INITIALIZE_CONFIG), null);

            supported = statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS;

            if (supported)
            {
                HttpApiModule          = SafeLibraryHandle.Open(HTTPAPI);
                HttpSetRequestProperty = HttpApiModule.GetProcAddress <HttpSetRequestPropertyInvoker>("HttpSetRequestProperty", throwIfNotFound: false);
                SupportsReset          = HttpSetRequestProperty != null;
                SupportsTrailers       = IsFeatureSupported(HTTP_FEATURE_ID.HttpFeatureResponseTrailers);
                SupportsDelegation     = IsFeatureSupported(HTTP_FEATURE_ID.HttpFeatureDelegateEx);
            }
        }
Exemplo n.º 2
0
        private static void InitHttpApi(ushort majorVersion, ushort minorVersion)
        {
            version.HttpApiMajorVersion = majorVersion;
            version.HttpApiMinorVersion = minorVersion;

            var statusCode = HttpInitialize(version, (uint)HTTP_FLAGS.HTTP_INITIALIZE_SERVER, null);

            supported = statusCode == UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS;

            if (supported)
            {
                HttpApiModule          = SafeLibraryHandle.Open(HTTPAPI);
                HttpSetRequestProperty = HttpApiModule.GetProcAddress <HttpSetRequestPropertyInvoker>("HttpSetRequestProperty", throwIfNotFound: false);

                SupportsReset = HttpSetRequestProperty != null;
                // Trailers support was added in the same release as Reset, but there's no method we can export to check it directly.
                SupportsTrailers = SupportsReset;
            }
        }