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

Diferent behaviour between quarkus-resteasy and quarkus-resteasy-reactive with @QueryParam with special characters #24974

Open
martincalvodaniel opened this issue Apr 16, 2022 · 4 comments
Labels
area/housekeeping Issue type for generalized tasks not related to bugs or enhancements area/rest

Comments

@martincalvodaniel
Copy link

martincalvodaniel commented Apr 16, 2022

Description

I have found people talking about this issue with the quarkus-rest-client-reactive but no one talking about the server side.

I have pushed this project to GitHub with the following two examples.

Any thoughts?

quarkus-resteasy

As it is, the quarkus-resteasy server can be executed like this:

$ ./gradlew -p quarkus-resteasy quarkusDev                                                                                                                                                                                                                                                                                                                                                                                        ─╯

> Task :quarkus-resteasy:quarkusDev
Listening for transport dt_socket at address: 5005
Press [h] for more options>
Tests paused
Press [r] to resume testing, [h] for more options>
Press [r] to resume testing, [o] Toggle test output, [h] for more options>
 __             __             __      __   ___  __  ___  ___       __
/  \ |  |  /\  |__) |__/ |  | /__` __ |__) |__  /__`  |  |__   /\  /__` \ /
\__X \__/ /~~\ |  \ |  \ \__/ .__/    |  \ |___ .__/  |  |___ /~~\ .__/  |

                                              Powered by Quarkus 2.8.0.Final
2022-04-16 09:33:32,316 INFO  [io.quarkus] (Quarkus Main Thread) quarkus-resteasy 1.0-SNAPSHOT on JVM (powered by Quarkus 2.8.0.Final) started in 1.463s. Listening on: http://0.0.0.0:8080
2022-04-16 09:33:32,320 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-04-16 09:33:32,320 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx

This server exposes the following simple endpoint:

@Path("/hello")
public class ExampleResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello(@QueryParam("queryParam") String queryParam) {
        return format("Hello RESTEasy CLASSIC. This was your received queryParam: %s", queryParam);
    }
}

If you query the server endpoint with arg;123 as the queryParam value the server answers with the same value:

$ curl 'localhost:8080/hello?queryParam=arg;123'
Hello RESTEasy CLASSIC. This was your received queryParam: arg;123

If you query the server endpoint with arg;123 url-encoded (arg%3B123) as the queryParam value the server answers with the same no url-encoded value:

$ curl 'localhost:8080/hello?queryParam=arg%3B123'
Hello RESTEasy CLASSIC. This was your received queryParam: arg;123

quarkus-resteasy-reactive

As it is, the quarkus-resteasy-reactive server can be executed like this:

$ ./gradlew -p quarkus-resteasy-reactive quarkusDev                                                                                                                                                                                                                                                                                                                                                                               ─╯

> Task :quarkus-resteasy-reactive:quarkusDev
Listening for transport dt_socket at address: 5005
Press [h] for more options>
Tests paused
Press [r] to resume testing, [h] for more options>
Press [r] to resume testing, [o] Toggle test output, [h] for more options>
 __             __             __      __   ___  __  ___  ___       __          __   ___       __  ___         ___
/  \ |  |  /\  |__) |__/ |  | /__` __ |__) |__  /__`  |  |__   /\  /__` \ / __ |__) |__   /\  /  `  |  | \  / |__
\__X \__/ /~~\ |  \ |  \ \__/ .__/    |  \ |___ .__/  |  |___ /~~\ .__/  |     |  \ |___ /~~\ \__,  |  |  \/  |___

                                                                                    Powered by Quarkus 2.8.0.Final
2022-04-16 09:32:27,178 INFO  [io.quarkus] (Quarkus Main Thread) quarkus-resteasy-reactive 1.0-SNAPSHOT on JVM (powered by Quarkus 2.8.0.Final) started in 1.437s. Listening on: http://0.0.0.0:8080
2022-04-16 09:32:27,182 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-04-16 09:32:27,183 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-openapi, swagger-ui, vertx]

This server exposes the following simple endpoint:

@Path("/hello")
public class ExampleResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello(@QueryParam("queryParam") String queryParam) {
        return format("Hello RESTEasy REACTIVE. This was your received queryParam: %s", queryParam);
    }
}

If you query the server endpoint with arg;123 as the queryParam value the server answers only with the content preceding the ; character:

$ curl 'localhost:8080/hello?queryParam=arg;123'
Hello RESTEasy REACTIVE. This was your received queryParam: arg

If you query the server endpoint with arg;123 url-encoded (arg%3B123) as the queryParam value the server answers with the same no url-encoded value:

$ curl 'localhost:8080/hello?queryParam=arg%3B123'
Hello RESTEasy REACTIVE. This was your received queryParam: arg;123

Implementation ideas

No response

@martincalvodaniel martincalvodaniel added the area/housekeeping Issue type for generalized tasks not related to bugs or enhancements label Apr 16, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 16, 2022

/cc @FroMage, @geoand, @stuartwdouglas

@geoand
Copy link
Contributor

geoand commented Apr 16, 2022

@FroMage, @michalszynkiewicz didn't we consider something similar in the past?

@FroMage
Copy link
Member

FroMage commented May 10, 2022

Looks like a bug that we stop at ; in query strings when I don't think they're reserved or special or need to be encoded there. In both cases the endpoint should receive arg;123

@geoand
Copy link
Contributor

geoand commented May 10, 2022

We are relying on Vert.x to do the query param parsing, we are not doing it ourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/housekeeping Issue type for generalized tasks not related to bugs or enhancements area/rest
Projects
None yet
Development

No branches or pull requests

3 participants