Skip to content
Permalink
Browse files

Land #11945, Make auto_cl more selective based on HTTP method

Merge branch 'land-11945' into upstream-master
  • Loading branch information...
bwatters-r7 authored and msjenkins-r7 committed Jun 4, 2019
1 parent b6f2000 commit fb4a26878d07466444f8328358da5fb799115051
Showing with 9 additions and 3 deletions.
  1. +5 −3 lib/rex/proto/http/packet.rb
  2. +4 −0 lib/rex/proto/http/request.rb
@@ -203,11 +203,13 @@ def output_packet(ignore_chunk=false)
end

unless ignore_chunk
if (self.auto_cl == true && self.transfer_chunked == true)
if self.auto_cl && self.transfer_chunked
raise RuntimeError, "'Content-Length' and 'Transfer-Encoding: chunked' are incompatible"
elsif self.auto_cl == true && content.length > 0
end

if self.auto_cl
self.headers['Content-Length'] = content.length
elsif self.transfer_chunked == true
elsif self.transfer_chunked
if self.proto != '1.1'
raise RuntimeError, 'Chunked encoding is only available via 1.1'
end
@@ -63,6 +63,10 @@ def initialize(method = 'GET', uri = '/', proto = DefaultProtocol)
self.chunk_max_size = 10
self.uri_encode_mode = 'hex-normal'

if self.method == 'GET' || self.method == 'CONNECT'
self.auto_cl = false
end

update_uri_parts
end

0 comments on commit fb4a268

Please sign in to comment.
You can’t perform that action at this time.