Skip to content

Commit

Permalink
Fix #111 w/ bad variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj committed Nov 7, 2017
1 parent e9f268c commit cce51ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ function Request(m::HTTP.Method, uri::URI, userheaders::Dict, b;
else
body = FIFOBuffer(b)
end
if iscompressed(body) && length(body) > get(opts, :chunksize, 0)
opts.chunksize = length(body) + 1
if iscompressed(body) && length(body) > get(options, :chunksize, 0)
options.chunksize = length(body) + 1
end
if !haskey(headers, "Content-Type") && length(body) > 0 && !isa(body, Form)
sn = sniff(body)
Expand Down

3 comments on commit cce51ca

@samoconnor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious about what this feature is for.
It's saying that if body is compressed always transfer as a single chunk?

@xiuliren
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly, my test byte vector was gzip compressed output.

@samoconnor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jingpengw, yeah I noticed when you sent your report your data has a gz header.
I guess my question for @quinnj is why are we overriding the chunksize option for data where we've sniffed a compression header?

The only place the chunksize option seems to be used is here in body(io::IO, ...) where we do read(r.body) if chunksize is zsero or read(r.body, chunksize) otherwise. However, it seems like the two types of read have the same behaviour because we've set chunksize = length(body) + 1.

i.e., wouldn't this have the same effect?

if iscompressed(body)
    options.chunksize = 0
end

Please sign in to comment.