Skip to content

Commit

Permalink
- Issue 7: A patch for server/Html/Connect.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Katharine committed Mar 20, 2008
1 parent 7e17e78 commit 99a1053
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions server/Contributors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]: Issue 7
18 changes: 12 additions & 6 deletions server/Html/Connect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,7 @@ public void OnFileRequested(HttpRequest request, IDirectory directory)
// The session doesn't exist. Get upset.
if (!this.users.ContainsKey(key))
{
Hashtable response = new Hashtable();
response.Add("success", false);
response.Add("message", "The session '" + key.ToString("D") + "' does not exist.\nTry reloading the page.");
JsonSerializer s = new JsonSerializer();
s.Serialize(textWriter, response);
textWriter.Flush();
this.invalidSessionID(key, textWriter);
return;
}
lock (this.users)
Expand Down Expand Up @@ -218,5 +213,16 @@ public IDirectory Parent
return this.parent;
}
}

private void invalidSessionID(Guid key, StreamWriter textWriter)
{
Hashtable response = new Hashtable();
response.Add("success", false);
// Guid::ToString("D") outputs the Guid in standard printable format:
// 00000000-0000-0000-0000-000000000000
response.Add("message", "The session '" + key.ToString("D") + "' does not exist.\nTry reloading the page.");
textWriter.Write(MakeJson.FromHashtable(response));
textWriter.Flush();
}
}
}

0 comments on commit 99a1053

Please sign in to comment.