Skip to content

Commit

Permalink
#672: fix to make headers in request/response case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Badgerati committed Jan 24, 2021
1 parent 6dae027 commit e0a8a71
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Listener/PodeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public PodeContext(Socket socket, PodeSocket podeSocket, PodeListener listener)
PodeSocket = podeSocket;
Listener = listener;
Timestamp = DateTime.UtcNow;
Data = new Hashtable();
Data = new Hashtable(StringComparer.InvariantCultureIgnoreCase);

Type = PodeContextType.Unknown;
State = PodeContextState.New;
Expand Down
2 changes: 1 addition & 1 deletion src/Listener/PodeHttpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private int ParseHeaders(string[] reqLines, string newline)
ProtocolVersion = Regex.Split(Protocol, "/")[1];

// headers
Headers = new Hashtable();
Headers = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
var bodyIndex = 0;
var h_index = 0;
var h_line = string.Empty;
Expand Down
3 changes: 2 additions & 1 deletion src/Listener/PodeResponseHeaders.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;

namespace Pode
Expand All @@ -17,7 +18,7 @@ public object this[string name]

public PodeResponseHeaders()
{
Headers = new Dictionary<string, IList<object>>();
Headers = new Dictionary<string, IList<object>>(StringComparer.InvariantCultureIgnoreCase);
}

public bool ContainsKey(string name)
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/PodeSmtpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected override void Parse(byte[] bytes)
public void Reset()
{
CanProcess = false;
Headers = new Hashtable();
Headers = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
From = string.Empty;
To = new List<string>();
Body = string.Empty;
Expand All @@ -175,7 +175,7 @@ private string ParseEmail(string value)

private void ParseHeaders(string value)
{
Headers = new Hashtable();
Headers = new Hashtable(StringComparer.InvariantCultureIgnoreCase);

var lines = value.Split(new string[] { PodeHelpers.NEW_LINE }, StringSplitOptions.None);
var match = default(Match);
Expand Down

0 comments on commit e0a8a71

Please sign in to comment.