Closed trampoline closed 13 years ago
The BOM fix that's been applied to ntlm.rb breaks with error:
/pyu-ntlm-http-0.1.3.1/lib/net/ntlm.rb:104:in `gsub': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-16BE string) (Encoding::CompatibilityError)
You probably need to do something like this to resolve:
regex = Regexp.new(Kconv.kconv("^\376\377", Kconv::UTF16, Kconv::ASCII))
swap16(Kconv.kconv(str, Kconv::UTF16, Kconv::ASCII).gsub(regex,''))
I'm on Ruby 1.9.2 running on Windows 7.
hey ping. can we have this issue re-opened?
hmm. my first thought is that that fix won't work, since the regex will match two UTF-16 characters, whereas we want to match the first two bytes of the binary encoding... so
Kconv.kconv(str.gsub(Regexp.new("^\376\377".force_encoding("ASCII-8BIT")),''), Kconv::UTF16, Kconv::ASCII)
i will test this out
duh. not enough coffee :) that still won't work, 'cos i gotta do the match after the kconv. will investigate
here's a fix for this problem : https://github.com/pyu10055/ntlm-http/pull/7
net/ntlm worked fine while testing on 1.9.2, but i encountered other problems with the net/http patches in ntlm_http.rb... only way i could authenticate was to use httpclient (i used latest : 2.2.0.2) for the http conversation, and pyu-ntlm-http with this patch for net/ntlm
Good work guys... well Trampoline :)
hi,
i've fixed up ntlm.rb a little here to make it work with httpclient under JRuby
:c