taf2/curb

Not possible to remove the Host header

incubus opened this issue · 1 comments

Hi!

Is there any way to remove the Host header from the request?

$ ruby -rsocket -e "trap('SIGINT') { exit }; Socket.tcp_server_loop(8080) { |s,_| puts s.readpartial(1024); puts; s.puts 'HTTP/1.1 200'; s.close }

> Curl.post('http://localhost:8080')
=> #<Curl::Easy http://localhost:8080>
POST / HTTP/1.1
Host: localhost:8080
Accept: */*
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
> Curl.post('http://localhost:8080') { _1.headers = { 'Content-Type' => '', 'Content-Length' => '', 'Accept' => '', 'Host' => '' } }
=> #<Curl::Easy http://localhost:8080>

POST / HTTP/1.1
Host:

With curl:

$ curl -d '' -H 'User-Agent:' -H 'Content-Type:' -H 'Accept:' -H 'Content-Length:' -H 'Host:' http://127.0.0.1:8080

POST / HTTP/1.1

taf2 commented

Thank you for reporting this fix is in master now