[ 
https://issues.apache.org/jira/browse/KUDU-3543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17872086#comment-17872086
 ] 

ASF subversion and git services commented on KUDU-3543:
-------------------------------------------------------

Commit 7ecad355065e4d0eb891c87813f347bb7d6819b2 in kudu's branch 
refs/heads/master from Marton Greber
[ https://gitbox.apache.org/repos/asf?p=kudu.git;h=7ecad3550 ]

KUDU-3543 Fix Content-Type headers

This patch addresses an issue with the webserver's Content-Type headers.
The problem lies in the webserver's handler functions, where we use a
boolean variable called 'is_styled' to decide on the style mode.

In the root Webserver::RunPathHandler function, only StyleMode::STYLED
or StyleMode::UNSTYLED are returned. Although SendResponse is invoked
with a use_style variable of type StyleMode, we only end up with
StyleMode::STYLED or StyleMode::UNSTYLED in the subsequent code paths.
Consequently, we never utilize StyleMode::BINARY. This means that the
master's /ipki-ca-cert-der endpoint does not have the expected
application/octet-stream content-type header; instead, it has text/plain.
(See KUDU-3543 for evidence).

This patch replaces the 'is_styled' boolean with the StyleMode enum
entirely. I have added test cases to verify the Content-Type headers of
the Master and TServer endpoints.

[1] 
https://github.com/apache/kudu/blob/master/src/kudu/server/webserver.cc#L686-L687

Change-Id: I746dcfbaadb2fb95292c2d4047cb7adb9971b42f
Reviewed-on: http://gerrit.cloudera.org:8080/20868
Tested-by: Marton Greber <[email protected]>
Reviewed-by: Zoltan Chovan <[email protected]>
Reviewed-by: Alexey Serbin <[email protected]>


> Fix Content-Type headers
> ------------------------
>
>                 Key: KUDU-3543
>                 URL: https://issues.apache.org/jira/browse/KUDU-3543
>             Project: Kudu
>          Issue Type: Bug
>            Reporter: Marton Greber
>            Assignee: Marton Greber
>            Priority: Major
>         Attachments: ipki-ca-cert-der.png, metrics.png
>
>
> The Content-Type headers are not correctly set in the webserver.
> Some time ago only 'text/html' and 'text/plain' were implemented.
> Then 'application/octet-stream' has been added. But this was not wired in.
> Find attached screenshots for proof.
> As a sidenote the metrics endpoint should have 'application/json' if we are 
> already touching this part of the codebase.
> (This came up while working on the service discovery endpoint for Prometheus, 
> which would requre 'application/json' on that endpoint)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to