You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/02/26 04:32:25 UTC
[GitHub] [helix] pkuwm opened a new issue #810: Zookeeper REST endpoint
still prepends slash when path already has leading slash
pkuwm opened a new issue #810: Zookeeper REST endpoint still prepends slash when path already has leading slash
URL: https://github.com/apache/helix/issues/810
If path has leading slash in Zookeeper REST endpoint: `/zookeeper//tmp/folder`, response is incorrect: response status code is 400.
This endpoint should be able to handle the case correctly.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on issue #810: Zookeeper REST endpoint
still prepends slash when path already has leading slash
Posted by GitBox <gi...@apache.org>.
narendly commented on issue #810: Zookeeper REST endpoint still prepends slash when path already has leading slash
URL: https://github.com/apache/helix/issues/810#issuecomment-591562299
I don't think this PR is necessary because it is the caller's responsibility to correctly format the URL. With the correct URL, it has already been verified and tested that these endpoints work as expected.
You're drawing a parallel to a REST resource concept, but clearly we aren't treating zookeeper paths as resource necessarily. Another way to do this is to treat the path variable as a query param, but to make the usage more fluid for users, we have decided to use regex.
In short, I do not think there's an issue with the way it is implemented.
One edge case though - can you see if you could getChildren on "/" (the root path) to work? That might be something that we could handle (if it doesn't work).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly commented on issue #810: Zookeeper REST endpoint
still prepends slash when path already has leading slash
Posted by GitBox <gi...@apache.org>.
narendly commented on issue #810: Zookeeper REST endpoint still prepends slash when path already has leading slash
URL: https://github.com/apache/helix/issues/810#issuecomment-591530630
@pkuwm Why would users input a path with two leading slashes? It is not that the response is incorrect; it seems like it's a case of incorrect **usage**.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] narendly edited a comment on issue #810: Zookeeper REST
endpoint still prepends slash when path already has leading slash
Posted by GitBox <gi...@apache.org>.
narendly edited a comment on issue #810: Zookeeper REST endpoint still prepends slash when path already has leading slash
URL: https://github.com/apache/helix/issues/810#issuecomment-591562299
I don't think this issue/PR is necessary because it is the caller's responsibility to correctly format the URL. With the correct URL, it has already been verified and tested that these endpoints work as expected.
You're drawing a parallel to a REST resource concept, but clearly we aren't treating zookeeper paths as resource necessarily. Another way to do this is to treat the path variable as a query param, but to make the usage more fluid for users, we have decided to use regex.
In short, I do not think there's an issue with the way it is implemented.
One edge case though - can you see if you could getChildren on "/" (the root path) to work? That might be something that we could handle (if it doesn't work).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] pkuwm edited a comment on issue #810: Zookeeper REST
endpoint still prepends slash when path already has leading slash
Posted by GitBox <gi...@apache.org>.
pkuwm edited a comment on issue #810: Zookeeper REST endpoint still prepends slash when path already has leading slash
URL: https://github.com/apache/helix/issues/810#issuecomment-591556618
> @pkuwm Why would users input a path with two leading slashes? It is not that the response is incorrect; it seems like it's a case of incorrect **usage**.
@narendly
- Statement: I **don't** think `/zookeeper//tmp/aa/bb` is a case of incorrect usage. I do believe it is a **valid** request. I think we can correctly serve both cases.
- Reasons:
Typically, a REST endpoint is like `/resources`. If I would like to query a particular resource, I would do `/resources/{identifier}`. In code implementation, I would do
```
RESOURCES_ENDPOINT = "/resources"; // already defined somewhere as an endpoint constant
identifier = "123";
uri = RESOURCES_ENDPOINT + "/" + identifier; // Is this a correct usage??
request(uri);
```
So, likewise, can I do the same?
```
ZOOKEEPER_ENDPOINT = "/zookeeper"; // already defined somewhere as an endpoint constant
path = "/tmp/aa/bb/cc";
uri = ZOOKEEPER_ENDPOINT + "/" + path; // Is this a correct usage??
request(uri);
```
But current response gives bad request 400 for the request: `uri = ZOOKEEPER_ENDPOINT + "/" + path;`
I would ask, did I do it wrong? Why? I would say this is definitely correct. But why could the service not handle my **correct** request?
Vice versa, let's transform the request back: `/zookeeper/tmp/aa/bb` -> `/zookeeper{path}` -> `/resources{identifier}`. Is `/resources{identifier}` a correct REST design?
The reason why zookeeperAccessor gets pathparam at `tmp/aa/bb` for request `/zookeeper/tmp/aa/bb` is, REST defines/expects `/resources/{id}` and `/zookeeper//tmp/aa/bb` so REST could parse correct path.
I definitely understand why we don't want 2 slashes: when `/zookeeper//tmp/aa/bb` is manually requested and seen by people, it looks strange and we do want to make it look normal to users. Looking strange is because people usually see single slash, but it does not mean two slashes especially for this case is incorrect.
On the other side, if the request is on code level and people don't see it, would it matter? No. But I would expect my correct code to work successfully.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
[GitHub] [helix] pkuwm commented on issue #810: Zookeeper REST endpoint
still prepends slash when path already has leading slash
Posted by GitBox <gi...@apache.org>.
pkuwm commented on issue #810: Zookeeper REST endpoint still prepends slash when path already has leading slash
URL: https://github.com/apache/helix/issues/810#issuecomment-591556618
> @pkuwm Why would users input a path with two leading slashes? It is not that the response is incorrect; it seems like it's a case of incorrect **usage**.
@narendly
- Statement: I **don't** think `/zookeeper//tmp/aa/bb` is a case of incorrect usage. I do believe it is a **valid** request.
- Reasons:
Typically, a REST endpoint is like `/resources`. If I would like to query a particular resource, I would do `/resources/{identifier}`. In code implementation, I would do
```
RESOURCES_ENDPOINT = "/resources"; // already defined somewhere as an endpoint constant
identifier = "123";
uri = RESOURCES_ENDPOINT + "/" + identifier; // Is this a correct usage??
request(uri);
```
So, likewise, can I do the same?
```
ZOOKEEPER_ENDPOINT = "/zookeeper"; // already defined somewhere as an endpoint constant
path = "/tmp/aa/bb/cc";
uri = ZOOKEEPER_ENDPOINT + "/" + path; // Is this a correct usage??
request(uri);
```
But current response gives bad request 400 for the request: `uri = ZOOKEEPER_ENDPOINT + "/" + path;`
I would ask, did I do it wrong? Why? I would say this is definitely correct. But why could the service not handle my **correct** request?
Vice versa, let's transform the request back: `/zookeeper/tmp/aa/bb` -> `/zookeeper{path}` -> `/resources{identifier}`. Is `/resources{identifier}` a correct REST design?
The reason why zookeeperAccessor gets pathparam at `tmp/aa/bb` for request `/zookeeper/tmp/aa/bb` is, REST defines/expects `/resources/{id}` and `/zookeeper//tmp/aa/bb` so REST could parse correct path.
I definitely understand why we don't want 2 slashes: when `/zookeeper//tmp/aa/bb` is manually requested and seen by people, it looks strange and we do want to make it look normal to users. Looking strange is because people usually see single slash, but it does not mean two slashes especially for this case is incorrect.
On the other side, if the request is on code level and people don't see it, would it matter? No. But I would expect my correct code to work successfully.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org