Hi Kevin

I will try to reproduce this later because currently I lost he clue where to 
find my test cases.
I only  remember we use knox0.6 for testing. And we use our custom Dispatch, 
which extends DefaultDispatch , to show the inboud requests and found the the 
file:/// in url becomes file:/ .

Thanks
Tony







At 2016-03-05 01:10:42, "Kevin Minder" <[email protected]> wrote:

Tony,


Can you add some more context about what you are doing specifically.  I can't 
seem to reproduce this other than the merging of multiple /'s which is 
debatable as an issue.


For example if I try with WebHDFS you can see from the in "File 
/user/guest/file:/files does not exist." that is seems to be doing the right 
thing.


curl -ku guest:guest-password 
'https://localhost:8443/gateway/sandbox/webhdfs/v1/~/file:////files?op=LISTSTATUS'


"RemoteException":{"exception":"FileNotFoundException","javaClassName":"java.io.FileNotFoundException","message":"File
 /user/guest/file:/files does not exist."}}~/Projects/knox-clean>




If I try creating a "dummy" custom service definition and point it at something 
like MockServer it logs the output below.  You can see from the "path" : 
"/root/~/file:/files" that seems to have done the correct thing.


curl -iku guest:guest-password 
'https://localhost:8443/gateway/sandbox/dummy/~/file:////files'


11:55:49.763 [nioEventLoopGroup-3-3] INFO  o.m.mockserver.MockServerHandler - 
returning response:


{
 "statusCode" : 404
}


 for request:


{
 "method" : "GET",
 "path" : "/root/~/file:/files",
 "queryStringParameters" : [ {
   "name" : "user.name",
   "values" : [ "guest" ]
 } ],
 "headers" : [ {
   "name" : "X-Forwarded-For",
   "values" : [ "0:0:0:0:0:0:0:1" ]
 }, {
   "name" : "X-Forwarded-Proto",
   "values" : [ "https" ]
 }, {
   "name" : "X-Forwarded-Port",
   "values" : [ "8443" ]
 }, {
   "name" : "X-Forwarded-Host",
   "values" : [ "localhost:8443" ]
 }, {
   "name" : "X-Forwarded-Server",
   "values" : [ "localhost" ]
 }, {
   "name" : "X-Forwarded-Context",
   "values" : [ "/gateway/sandbox" ]
 }, {
   "name" : "User-Agent",
   "values" : [ "curl/7.43.0" ]
 }, {
   "name" : "Accept",
   "values" : [ "*/*" ]
 }, {
   "name" : "Host",
   "values" : [ "localhost:1080" ]
 }, {
   "name" : "Accept-Encoding",
   "values" : [ "gzip,deflate" ]
 }, {
   "name" : "Content-Length",
   "values" : [ "0" ]
 } ],
 "keepAlive" : true,
 "secure" : false
}


Kevin.


From: hdp <[email protected]>
Reply-To: "[email protected]" <[email protected]>
Date: Thursday, March 3, 2016 at 2:03 AM
To: "[email protected]" <[email protected]>
Subject: Re:Troubleshooting malformed UTF-8 json responses.




I meet similar problems.

And also when I send request with 
http://knox:port/gateway/default/~/file:///files ,the requested url after knox 
becomes  http://knox:port/gateway/default/~/file:%xx%xx%xxfiles to my service 
endpoint


Thanks
Tony










At 2016-03-03 12:33:22, "Christopher Jackson" 
<[email protected]> wrote:
>Hi All,
>
>We have a REST API sitting behind Knox and some of the endpoints in our API 
>return JSON with utf-8. Specifically we are prefixing some labels with UTF-8 
>charcters to test translation capabilities.  I am noticing that when we access 
>these endpoints through knox our UTF-8 characters are malformed. When we 
>access our API directly there is no issues. 
>
>I turned up logging in knox to see if I could capture what was going wrong but 
>I didn’t find much. I see that the request is made to the knox gateway, it’s 
>properly forwarded to the end point behind the gateway. Looking at the data on 
>the wire I see that the correct utf-8 encodings are being returned from our 
>end point. I don’t see any logging for what was returned after knox rewrote 
>the response. Is there anyway to enable this logging? 
>
>Here is a snippet of the log showing the encoding:
>
>2016-03-02 23:00:55,269 DEBUG http.wire (Wire.java:wire(72)) - http-outgoing-3 
><< "HTTP/1.1 200 OK[\r][\n]"
>2016-03-02 23:00:55,269 DEBUG http.wire (Wire.java:wire(72)) - http-outgoing-3 
><< "X-Powered-By: Servlet/3.0[\r][\n]"
>2016-03-02 23:00:55,270 DEBUG http.wire (Wire.java:wire(72)) - http-outgoing-3 
><< "Content-Type: application/json[\r][\n]"
>2016-03-02 23:00:55,270 DEBUG http.wire (Wire.java:wire(72)) - http-outgoing-3 
><< "Content-Length: 17560[\r][\n]"
>2016-03-02 23:00:55,270 DEBUG http.wire (Wire.java:wire(72)) - http-outgoing-3 
><< "Date: Thu, 03 Mar 2016 04:00:55 GMT[\r][\n]"
>2016-03-02 23:00:55,270 DEBUG http.wire (Wire.java:wire(72)) - http-outgoing-3 
><< "[\r][\n]"
>2016-03-02 23:00:55,271 DEBUG http.wire (Wire.java:wire(86)) - http-outgoing-3 
><< 
>"[{"numBuckets":3,"version":1,"standardizedAttributes":[{"version":1,"cmproleId":451,"stdrole1":29,"stdrole2":0,"dvdargs":"","minwgtfreq":20,"cmprole2Id":0,"stdfuncId":292,"attributeId":331,"equistrcodeId":0,"stdfuncLabel":"[0xc3][0x9f]_Person","anonstrcodeId":4654,"cmapstrcodeId":4662,"attributeLabel":"Per
> Business……..
>
>
>Below is a sample of how the labels are being malformed:
>
>Without Knox (expected output):
>“ß_Person"
>
>Through Knox:
>"ß_Person”
>
>-------------
>
>LATIN SMALL LETTER SHARP S
>"\u00DF" 
>
>is becoming 
>
>LATIN CAPITAL LETTER A WITH TILDE
>"\u00C3"       
>
>Any thoughts on how I might resolve this? Or best way to troubleshoot this 
>further? Let me know if you require more information about my knox setup and 
>rewrite rules.
>
>Regards,
>
>Christopher Jackson





 

Reply via email to