Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Commit

Permalink
[FastCGI] Avoid problems converting the header names.
Browse files Browse the repository at this point in the history
	Avoid problems with Substring when parsing and converting headers.
	This fixes bug #626131.
  • Loading branch information
gonzalop committed Dec 2, 2010
1 parent b241882 commit 3dd0e9a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Mono.WebServer.FastCgi/WorkerRequest.cs
Expand Up @@ -458,9 +458,18 @@ private static string HostNameFromString (string host)
private static string ReformatHttpHeader (string header)
{
string [] parts = header.Substring (5).Split ('_');
for (int i = 0; i < parts.Length; i ++)
parts [i] = parts [i].Substring (0, 1).ToUpper ()
+ parts [i].Substring (1).ToLower ();
for (int i = 0; i < parts.Length; i ++) {
string s = parts [i];
if (String.IsNullOrEmpty (s)) {
parts [i] = "";
continue;
}

s = s.ToLower ();
char [] a = s.ToCharArray ();
a [0] = Char.ToUpper (a[0]);
parts [i] = new String (a);
}

return string.Join ("-", parts);
}
Expand Down

0 comments on commit 3dd0e9a

Please sign in to comment.