play-ws icon indicating copy to clipboard operation
play-ws copied to clipboard

WS response interceptor does not support URI special characters(%2F)?

Open biwugang opened this issue 8 years ago • 2 comments

I looks like that the WS response interceptor does not support URI special characters

the issue step is as following

1. client send WS request

2. service response: 307 Temporary Redirect

the redirest location is: https://docker-images-prod.s3.amazonaws.com/registry-v2/docker/registry/v2/blobs/sha256/ca/ca4f61b1923c10e9eb81228bd46bee1dfba02b9c7dac1844527a734752688ede/data?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAIQF2R62EC73X2HOA%2F20171224%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20171224T034443Z&X-Amz-Expires=1200&X-Amz-SignedHeaders=host&X-Amz-Signature=b482baf75c9c3895279843a59483e8ea1bf6b3e3451f80ba7f741959150c7f7a

3. org.asynchttpclient.netty.handler.intercept.Redirect30xInterceptor will start

it looks like that Redirect30xInterceptor can not handle the sepcial character(%2F) correct

4. server response: 400 Bad Request

My question is

  1. can the http intercept support the special character (%2F)?
  2. how to config or disable the WS response intercept?

biwugang avatar Dec 24 '17 04:12 biwugang

Can you provide a project with a test case showing this?

wsargent avatar Dec 26 '17 16:12 wsargent

@wsargent, Thanks for your reply. As I analyse and test, the issue is not caused by the special character (%2F), it is caused by the Authorization header.

the first request include the Authorization header, then server response 307 Temporary Redirect. the re-direct location including the authentication information, so it does not need add Authorization header. using the default Interceptor, a new request will send to the re-direction location but also including Authorization header same as the first request. then server will response 400 bad request.

I disable the default Interceptor using wSRequest.setFollowRedirects(false); and make a new request to re-direct location without the Authorization header, then it works.

biwugang avatar Dec 29 '17 06:12 biwugang