private void GetAllServerVars() { if (base._ecb != IntPtr.Zero) { RecyclableByteBuffer buffer = new RecyclableByteBuffer(); int num = UnsafeNativeMethods.PMGetAllServerVariables(base._ecb, buffer.Buffer, buffer.Buffer.Length); while (num < 0) { buffer.Resize(-num); num = UnsafeNativeMethods.PMGetAllServerVariables(base._ecb, buffer.Buffer, buffer.Buffer.Length); } if (num == 0) { throw new HttpException(System.Web.SR.GetString("Cannot_retrieve_request_data")); } string[] strArray = buffer.GetDecodedTabSeparatedStrings(Encoding.Default, 0x1f, 1); buffer.Dispose(); this._serverVars = new Hashtable(0x20, StringComparer.OrdinalIgnoreCase); this._serverVars.Add("APPL_MD_PATH", HttpRuntime.AppDomainAppIdInternal); for (int i = 1; i < 0x20; i++) { this._serverVars.Add(_serverVarNames[i], strArray[i - 1]); } } }
private string[] ReadBasics(int[] contentInfo) { RecyclableByteBuffer buffer = new RecyclableByteBuffer(); int num = this.GetBasicsCore(buffer.Buffer, buffer.Buffer.Length, contentInfo); while (num < 0) { buffer.Resize(-num); num = this.GetBasicsCore(buffer.Buffer, buffer.Buffer.Length, contentInfo); } if (num == 0) { throw new HttpException(System.Web.SR.GetString("Cannot_retrieve_request_data")); } string[] strArray = buffer.GetDecodedTabSeparatedStrings(Encoding.Default, 6, 0); buffer.Dispose(); return(strArray); }
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(); } } }
// // Private helpers // private String[] ReadBasics(int[] contentInfo) { // call getbasics RecyclableByteBuffer buf = new RecyclableByteBuffer(); int r = GetBasicsCore(buf.Buffer, buf.Buffer.Length, contentInfo); while (r < 0) { buf.Resize(-r); // buffer not big enough r = GetBasicsCore(buf.Buffer, buf.Buffer.Length, contentInfo); } if (r == 0) throw new HttpException(SR.GetString(SR.Cannot_retrieve_request_data)); // convert to characters and split the buffer into strings String[] ss = buf.GetDecodedTabSeparatedStrings(Encoding.Default, 6, 0); // recycle buffers buf.Dispose(); return ss; }
private void GetAllServerVars() { if (_ecb == IntPtr.Zero) return; RecyclableByteBuffer buf = new RecyclableByteBuffer(); int r = UnsafeNativeMethods.PMGetAllServerVariables(_ecb, buf.Buffer, buf.Buffer.Length); while (r < 0) { buf.Resize(-r); // buffer not big enough r = UnsafeNativeMethods.PMGetAllServerVariables(_ecb, buf.Buffer, buf.Buffer.Length); } if (r == 0) throw new HttpException(SR.GetString(SR.Cannot_retrieve_request_data)); // stub out first server var is it could contain non-UTF8 data // convert to characters and split the buffer into strings using default request encoding String[] ss = buf.GetDecodedTabSeparatedStrings(Encoding.Default, _numServerVars-1, 1); // recycle buffers buf.Dispose(); // fill in the hashtable _serverVars = new Hashtable(_numServerVars, StringComparer.OrdinalIgnoreCase); _serverVars.Add("APPL_MD_PATH", HttpRuntime.AppDomainAppId); for (int i = 1; i < _numServerVars; i++) { // starting with 1 to skip APPL_MD_PATH _serverVars.Add(_serverVarNames[i], ss[i-1]); } }
// 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; }
private string[] ReadBasics(int[] contentInfo) { RecyclableByteBuffer buffer = new RecyclableByteBuffer(); int num = this.GetBasicsCore(buffer.Buffer, buffer.Buffer.Length, contentInfo); while (num < 0) { buffer.Resize(-num); num = this.GetBasicsCore(buffer.Buffer, buffer.Buffer.Length, contentInfo); } if (num == 0) { throw new HttpException(System.Web.SR.GetString("Cannot_retrieve_request_data")); } string[] strArray = buffer.GetDecodedTabSeparatedStrings(Encoding.Default, 6, 0); buffer.Dispose(); return strArray; }
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(); } } }
private void GetAllServerVars() { if (base._ecb != IntPtr.Zero) { RecyclableByteBuffer buffer = new RecyclableByteBuffer(); int num = UnsafeNativeMethods.PMGetAllServerVariables(base._ecb, buffer.Buffer, buffer.Buffer.Length); while (num < 0) { buffer.Resize(-num); num = UnsafeNativeMethods.PMGetAllServerVariables(base._ecb, buffer.Buffer, buffer.Buffer.Length); } if (num == 0) { throw new HttpException(System.Web.SR.GetString("Cannot_retrieve_request_data")); } string[] strArray = buffer.GetDecodedTabSeparatedStrings(Encoding.Default, 0x1f, 1); buffer.Dispose(); this._serverVars = new Hashtable(0x20, StringComparer.OrdinalIgnoreCase); this._serverVars.Add("APPL_MD_PATH", HttpRuntime.AppDomainAppIdInternal); for (int i = 1; i < 0x20; i++) { this._serverVars.Add(_serverVarNames[i], strArray[i - 1]); } } }