Exemple #1
0
        protected virtual string GetServerVariableCore(string name)
        {
            if (base._ecb == IntPtr.Zero)
            {
                return(null);
            }
            string decodedString        = null;
            RecyclableByteBuffer buffer = new RecyclableByteBuffer();
            int len = UnsafeNativeMethods.EcbGetServerVariable(base._ecb, name, buffer.Buffer, buffer.Buffer.Length);

            while (len < 0)
            {
                buffer.Resize(-len);
                len = UnsafeNativeMethods.EcbGetServerVariable(base._ecb, name, buffer.Buffer, buffer.Buffer.Length);
            }
            if (len > 0)
            {
                decodedString = buffer.GetDecodedString(Encoding.UTF8, len);
            }
            buffer.Dispose();
            return(decodedString);
        }
Exemple #2
0
 protected virtual void GetAdditionalServerVariables()
 {
     if ((base._ecb != IntPtr.Zero) && (this._additionalServerVars == null))
     {
         this._additionalServerVars = new string[0x17];
         for (int i = 0; i < this._additionalServerVars.Length; i++)
         {
             int nameIndex = i + 12;
             RecyclableByteBuffer buffer = new RecyclableByteBuffer();
             int len = UnsafeNativeMethods.EcbGetServerVariableByIndex(base._ecb, nameIndex, buffer.Buffer, buffer.Buffer.Length);
             while (len < 0)
             {
                 buffer.Resize(-len);
                 len = UnsafeNativeMethods.EcbGetServerVariableByIndex(base._ecb, nameIndex, buffer.Buffer, buffer.Buffer.Length);
             }
             if (len > 0)
             {
                 this._additionalServerVars[i] = buffer.GetDecodedString(Encoding.UTF8, len);
             }
             buffer.Dispose();
         }
     }
 }
    // ISAPIWorkerRequestInProc
    protected virtual void GetAdditionalServerVariables() {
        if (_ecb == IntPtr.Zero)
            return;

        // _additionalServerVars should only be initialized once
        Debug.Assert(_additionalServerVars == null);
        if (_additionalServerVars != null)
            return;

        _additionalServerVars = new string[NUM_ADDITIONAL_SERVER_VARIABLES];

        for(int i = 0; i < _additionalServerVars.Length; i++) {
            int nameIndex = i + NUM_BASIC_SERVER_VARIABLES;

            RecyclableByteBuffer buf = new RecyclableByteBuffer();

            int retVal = UnsafeNativeMethods.EcbGetServerVariableByIndex(_ecb, nameIndex, buf.Buffer, buf.Buffer.Length);

            while (retVal < 0) {
                buf.Resize(-retVal);     // buffer not big enough
                retVal = UnsafeNativeMethods.EcbGetServerVariableByIndex(_ecb, nameIndex, buf.Buffer, buf.Buffer.Length);
            }

            if (retVal > 0)
                _additionalServerVars[i] = buf.GetDecodedString(Encoding.UTF8, retVal);

            buf.Dispose();
        }
    }
    // ISAPIWorkerRequestInProc
    protected virtual String GetServerVariableCore(String name) {
        if (_ecb == IntPtr.Zero)
            return null;

        String value = null;

        RecyclableByteBuffer buf = new RecyclableByteBuffer();

        int retVal = UnsafeNativeMethods.EcbGetServerVariable(_ecb, name, buf.Buffer, buf.Buffer.Length);

        while (retVal < 0) {
            buf.Resize(-retVal);     // buffer not big enough
            retVal = UnsafeNativeMethods.EcbGetServerVariable(_ecb, name, buf.Buffer, buf.Buffer.Length);
        }

        if (retVal > 0)
            value = buf.GetDecodedString(Encoding.UTF8, retVal);

        buf.Dispose();

        return value;
    }
 protected virtual string GetServerVariableCore(string name)
 {
     if (base._ecb == IntPtr.Zero)
     {
         return null;
     }
     string decodedString = null;
     RecyclableByteBuffer buffer = new RecyclableByteBuffer();
     int len = UnsafeNativeMethods.EcbGetServerVariable(base._ecb, name, buffer.Buffer, buffer.Buffer.Length);
     while (len < 0)
     {
         buffer.Resize(-len);
         len = UnsafeNativeMethods.EcbGetServerVariable(base._ecb, name, buffer.Buffer, buffer.Buffer.Length);
     }
     if (len > 0)
     {
         decodedString = buffer.GetDecodedString(Encoding.UTF8, len);
     }
     buffer.Dispose();
     return decodedString;
 }
 protected virtual void GetAdditionalServerVariables()
 {
     if ((base._ecb != IntPtr.Zero) && (this._additionalServerVars == null))
     {
         this._additionalServerVars = new string[0x17];
         for (int i = 0; i < this._additionalServerVars.Length; i++)
         {
             int nameIndex = i + 12;
             RecyclableByteBuffer buffer = new RecyclableByteBuffer();
             int len = UnsafeNativeMethods.EcbGetServerVariableByIndex(base._ecb, nameIndex, buffer.Buffer, buffer.Buffer.Length);
             while (len < 0)
             {
                 buffer.Resize(-len);
                 len = UnsafeNativeMethods.EcbGetServerVariableByIndex(base._ecb, nameIndex, buffer.Buffer, buffer.Buffer.Length);
             }
             if (len > 0)
             {
                 this._additionalServerVars[i] = buffer.GetDecodedString(Encoding.UTF8, len);
             }
             buffer.Dispose();
         }
     }
 }