[Mono-list] bug in HttpServerUtility.Execute (includes corrected code)

Rich Alimi rich@velvetsea.net
Tue, 19 Aug 2003 17:43:21 -0400


I was working with the Server.Execute method and I have found a bug in
the HttpServerUtility's Execute method:

public void Execute (string path, TextWriter)
{
	// ...
	if (qmark != 1) {
		// the order of these two statements should be swapped
		// As they are, the string.Substring method produces an
		// ArgumentOutOfRange exception on the "query = ..."
statement
		path = path.Substring (0, qmark);
		query = path.Substring (qmark + 1);
	} else {
		query = "";
	}
	// ...
}

The corrected version:

public void Execute (string path, TextWriter)
{
	// ...
	if (qmark != 1) {
		query = path.Substring (qmark + 1);
		path = path.Substring (0, qmark);
	} else {
		query = "";
	}
	// ...
}

Hope this helps,
Rich