Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Work around URI encode limitations in RestClient #9946

Closed
wants to merge 1 commit into from

Conversation

javanna
Copy link
Member

@javanna javanna commented Mar 2, 2015

We've been relying on URI for url encoding, but it turns out it has some problems. For instance '+' stays as is while it should be encoded to %2B. If we go and manually encode query params we have to be careful though not to run into double encoding ('+'=>'%2B'=>'%252B'). The applied solution relies on URI encoding for the url path, but manual url encoding for the query parameters. We prevent URI from double encoding query params by using its single argument constructor that leaves everything as is.

We can also revert back the expression script REST test that revealed this to its original content (which contains an addition).

Closes #9769

@javanna javanna added >test Issues or PRs that are addressing/adding tests review v1.5.0 v1.4.0 v2.0.0-beta1 v1.4.5 >bug and removed v1.4.0 labels Mar 2, 2015
@javanna
Copy link
Member Author

javanna commented Mar 2, 2015

@spinscale can you have a look please?

@spinscale
Copy link
Contributor

LGTM

@javanna javanna removed the review label Mar 3, 2015
We've been relying on URI for url encoding, but it turns out it has some problems. For instance '+' stays as is while it should be encoded to `%2B`. If we go and manually encode query params we have to be careful though not to run into double encoding ('+'=>'%2B'=>'%252B'). The applied solution relies on URI encoding for the url path, but manual url encoding for the query parameters. We prevent URI from double encoding query params by using its single argument constructor that leaves everything as is.

We can also revert back the expression script REST test that revealed this to its original content (which contains an addition).

Closes elastic#9769
Closes elastic#9946
@javanna javanna force-pushed the test/rest_client_uri_encode branch from 2dd0e7f to 45ce7a1 Compare March 3, 2015 09:12
javanna added a commit that referenced this pull request Mar 3, 2015
We've been relying on URI for url encoding, but it turns out it has some problems. For instance '+' stays as is while it should be encoded to `%2B`. If we go and manually encode query params we have to be careful though not to run into double encoding ('+'=>'%2B'=>'%252B'). The applied solution relies on URI encoding for the url path, but manual url encoding for the query parameters. We prevent URI from double encoding query params by using its single argument constructor that leaves everything as is.

We can also revert back the expression script REST test that revealed this to its original content (which contains an addition).

Closes #9769
Closes #9946
javanna added a commit that referenced this pull request Mar 3, 2015
We've been relying on URI for url encoding, but it turns out it has some problems. For instance '+' stays as is while it should be encoded to `%2B`. If we go and manually encode query params we have to be careful though not to run into double encoding ('+'=>'%2B'=>'%252B'). The applied solution relies on URI encoding for the url path, but manual url encoding for the query parameters. We prevent URI from double encoding query params by using its single argument constructor that leaves everything as is.

We can also revert back the expression script REST test that revealed this to its original content (which contains an addition).

Closes #9769
Closes #9946
@javanna javanna closed this in 4ad33c3 Mar 3, 2015
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
We've been relying on URI for url encoding, but it turns out it has some problems. For instance '+' stays as is while it should be encoded to `%2B`. If we go and manually encode query params we have to be careful though not to run into double encoding ('+'=>'%2B'=>'%252B'). The applied solution relies on URI encoding for the url path, but manual url encoding for the query parameters. We prevent URI from double encoding query params by using its single argument constructor that leaves everything as is.

We can also revert back the expression script REST test that revealed this to its original content (which contains an addition).

Closes elastic#9769
Closes elastic#9946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>test Issues or PRs that are addressing/adding tests v1.4.5 v1.5.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Testing: RestClient does not escape source HTTP parameter correctly
3 participants