I have a problem in which hive believes the HTTP Authorization header is empty or null, when it in fact is not.
It appears to throw the exception in ThriftHttpServlet, specifically…
private String getAuthHeader(HttpServletRequest request, String authType)
throws HttpAuthenticationException
{
String authHeader = request.getHeader("Authorization");
if ((authHeader == null) || (authHeader.isEmpty())) {
throw new HttpAuthenticationException("Authorization header received from the client is empty.");
}
int beginIndex;
int beginIndex;
if (isKerberosAuthMode(authType)) {
beginIndex = "Negotiate ".length();
} else {
beginIndex = "Basic ".length();
}
String authHeaderBase64String = authHeader.substring(beginIndex);
if ((authHeaderBase64String == null) || (authHeaderBase64String.isEmpty())) {
throw new HttpAuthenticationException("Authorization header received from the client does not contain any data.");
}
return authHeaderBase64String;
}
…with the following strace output for the knox gateway…
12529 15:21:24.113187
sendto(161,
"POST /cliservice?doAs=guest
HTTP/1.1
Accept: application/x-thrift
Content-Type: application/x-thrift
Connection: keep-alive
User-Agent: Java/THttpClient/HC
Transfer-Encoding: chunked
Host: hdp.howard.local:10001
Authorization: Negotiate YIIFbAYGKwYBBQUCoIIFYDCCBVygDTALBgkqhkiG9xIBAgKhBAMCAfaiggVDBIIFP2CCBTsGC
…and from the hive process…
25209 15:32:40.210151 read(493, "POST /cliservice?doAs=guest HTTP/1.1\r\nAccept: application/x-thrift\r\nContent-Type: application/x-thrift\r\nConnection: keep-alive\r\nUser-Agent: Java/THttpClient/HC\r\nTransfer-Encoding: chunked\r\nHost: hdp.howard.local:10001\r\nAuthorization: Negotiate YIIFMQYGKwYBBQUCoIIFJTCCBSGgDTALBgkqhkiG9xIBAgKhBAMCAfaiggUIBIIFBGCCBQAGCSqGSIb3EgECAgEAboIE7
Yes, these are from two different straces, but the results is the same; namely, the exception about the Authorization header not containing any data is thrown.
Any ideas as to where to start?