Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to make headers in request/response case-insensitive #673

Merged
merged 1 commit into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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