kuenishi opened a new pull request #2999:
URL: https://github.com/apache/ozone/pull/2999


   ## What changes were proposed in this pull request?
   
   Currently in some cases where the authorization header is wrong, S3Gateway 
returns wrong status code. For example,
   
   1. 500 for no such bucket, or
   2. 404 for malformed request.
   
   Some cases are not reproducible for me, but it's apparently wrong in code. 
1. is because OS3Exception is doubly wrapped by WebApplicationError and thus 
failing to catch in the `catch (OS3Exception ex)`  clause and goes through to 
`catch (Exception ex)` clause. 2. just comes from wrong definition in 
S3ErrorTable.
   
   Here are some examples against our production cluster for case 1:
   
   ```sh
   $ curl -H "Authorization: invalid" https://ozone.example.com/no-such-bucket
   <html>
   <head>
   <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
   <title>Error 500 Internal Server Error</title>
   </head>
   <body><h2>HTTP ERROR 500 Internal Server Error</h2>
   <table>
   <tr><th>URI:</th><td>/no-such-bucket</td></tr>
   <tr><th>STATUS:</th><td>500</td></tr>
   <tr><th>MESSAGE:</th><td>Internal Server Error</td></tr>
   <tr><th>SERVLET:</th><td>jaxrs</td></tr>
   </table>
   
   </body>
   </html>
   $ curl -H "Authorization: " https://ozoene.example.com/no-such-bucket
   <html>
   <head>
   <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
   <title>Error 500 Internal Server Error</title>
   </head>
   <body><h2>HTTP ERROR 500 Internal Server Error</h2>
   <table>
   <tr><th>URI:</th><td>/no-such-bucket</td></tr>
   <tr><th>STATUS:</th><td>500</td></tr>
   <tr><th>MESSAGE:</th><td>Internal Server Error</td></tr>
   <tr><th>SERVLET:</th><td>jaxrs</td></tr>
   </table>
   
   </body>
   </html>
   [kuenishi@nausicaa ozone-master]$ curl 
https://ozone.example.com/no-such-bucket
   <html>
   <head>
   <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
   <title>Error 500 Internal Server Error</title>
   </head>
   <body><h2>HTTP ERROR 500 Internal Server Error</h2>
   <table>
   <tr><th>URI:</th><td>/no-such-bucket</td></tr>
   <tr><th>STATUS:</th><td>500</td></tr>
   <tr><th>MESSAGE:</th><td>Internal Server Error</td></tr>
   <tr><th>SERVLET:</th><td>jaxrs</td></tr>
   </table>
   
   </body>
   </html>
   ```
   
   ## What is the link to the Apache JIRA
   
   HDDS-6204
   
   ## How was this patch tested?
   
   - Unit test added
   - Manual tests with IntelliJ
   - Production environment
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to