System.Net.Browser.ClientHttpWebRequest.CheckProtocolViolation C# (CSharp) Method

CheckProtocolViolation() protected method

protected CheckProtocolViolation ( ) : void
return void
		protected override void CheckProtocolViolation ()
		{
			if (Headers.ContainsKey ("Cache-Control"))
				throw new SecurityException ();

			bool is_get = (String.Compare (Method, "GET", StringComparison.OrdinalIgnoreCase) == 0);

			// most headers are checked when set, but some are checked much later
			foreach (string header in bad_get_headers) {
				// case insensitive check to internal Headers dictionary
				if (Headers.ContainsKey (header)) {
					if (is_get)
						throw new ProtocolViolationException ();
					else
						throw new SecurityException ();
				}
			}
		}
	}