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

ASF subversion and git services commented on IMPALA-12294:
----------------------------------------------------------

Commit 749d664c60e2ce2e5f7eada86e5635fdea536c18 in impala's branch 
refs/heads/master from Andrew Sherman
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=749d664c6 ]

IMPALA-12294 Fix Cookie handling for Impala Shell with python 3

Impala Shell gets cookies from an HTTMessage object formed from a
response to an HTTP message. The format of cookies in the message
differs across the python versions. In Python 2 the HTTPMessage is a
mimetools.Message object, and the Set-Cookie values all appear in a
single header, separated by newlines. In Python 3 the HTTPMessage is an
email.message.Message, and the Set-Cookie values appear as duplicate
headers.

Add platform dependent code to get_all_matching_cookies() that loads
cookies from all the Set-Cookie headers.

TESTING:
    Changed test_get_all_matching_cookies() to build the HTTPMessage
    using a new utility method that creates Set-Cookie headers in
    the appropriate format for the platform.

    Validated that the KNOX_BACKEND-IMPALA cookies is correctly set in
    Impala Shell on a Red Hat 9 system using Python 3 (which is how
    the problem was first observed).

Change-Id: I057b5c2b9d78e36f32865537d091c4ac0e80d37f
Reviewed-on: http://gerrit.cloudera.org:8080/20216
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Cookie handling broken In Impala Shell with python 3
> ----------------------------------------------------
>
>                 Key: IMPALA-12294
>                 URL: https://issues.apache.org/jira/browse/IMPALA-12294
>             Project: IMPALA
>          Issue Type: Bug
>            Reporter: Andrew Sherman
>            Assignee: Andrew Sherman
>            Priority: Critical
>
> If more than one cookie is set in a http response ten only the first one is 
> used in python3. In ImpalaHttpClient the http headers of the response are 
> stored in an HTTPMessage object. This is deceptive as in Python2 the 
> HTTPMessage is a mimetools.Message object, while in python3 it is an 
> email.message.Message. An important difference is that when a header appears 
> multiple times, as can happen with a ‘Set-Cookie’ header, the  
> mimetools.Message merges the headers internally, while the 
> email.message.Message keeps them separate.



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

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

Reply via email to