Clone the URI before mutating it. #184

Merged
merged 1 commit into from May 21, 2012

Conversation

Projects
None yet
2 participants
@jonleighton
Contributor

jonleighton commented May 17, 2012

The #build_request_signature method was mutating the URI if there were
any @req.query options. This means that if the request does actually get
sent, em-http-request appends the query to the URI a second time, and
the parameters are repeated.

For example:

EventMachine::HttpRequest.new('http://example.com/').get(:query => { :a => '1' })

would result in the follow URI being used for a live request:

http://example.com/?a=1&a=1

Clone the URI before mutating it.
The #build_request_signature method was mutating the URI if there were
any @req.query options. This means that if the request does actually get
sent, em-http-request appends the query to the URI a second time, and
the parameters are repeated.

For example:

EventMachine::HttpRequest.new('http://example.com/').get(:query => { :a => '1' })

would result in the follow URI being used for a live request:

http://example.com/?a=1&a=1

bblimke added a commit that referenced this pull request May 21, 2012

Merge pull request #184 from jonleighton/dont_mutate_uri
Clone the URI before mutating it.

@bblimke bblimke merged commit 887bf32 into bblimke:master May 21, 2012

@bblimke

This comment has been minimized.

Show comment Hide comment
@bblimke

bblimke May 21, 2012

Owner

Looks good, it will be included in the next patch release this week.

Owner

bblimke commented May 21, 2012

Looks good, it will be included in the next patch release this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment