Fix substring off by one error in URL parsing.

Second parameter of substring() is exclusive. (Note: The second substring below is correct since length() doesn't correspond to last index.)