From 05c0e3b154e5d47c2b2ec79d1d76ea0ace1e50fa Mon Sep 17 00:00:00 2001 From: KelvinSRV Date: Fri, 28 Jan 2022 11:24:41 -0300 Subject: [PATCH] parsing add sensitive headers with '@' --- lib/net/http/header.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb index a8901e79..60c0fb97 100644 --- a/lib/net/http/header.rb +++ b/lib/net/http/header.rb @@ -218,7 +218,15 @@ def each_capitalized alias canonical_each each_capitalized def capitalize(name) - name.to_s.split(/-/).map {|s| s.capitalize }.join('-') + #Because in some applications the header is sensitive, + #for this, if I pass an '@', I make the same value in header, without capitalize. + #For example, I have a request for API make in C#, him break if I pass 'Token' but + #worked if I pass 'token', because he not follow the RFC. + if(name[0] == '@') + name.gsub('@', '') + else + name.to_s.split(/-/).map {|s| s.capitalize }.join('-') + end end private :capitalize