Not able to read complete cookie in perl

前端 未结 1 1342
北荒
北荒 2021-01-26 16:08

I am receiving below cookie from my source system

ExternalAccess=unixtime=1593603710&oracletime=01-jul-20 
12:41:50_Hash_thNnmggU2ex3L5XXeMNfxf8Wl8STcVZTxscSF         


        
相关标签:
1条回答
  • 2021-01-26 16:13

    First of all, that's not a valid cookie. Spaces are not allowed in the value of cookies. Ref.

    Secondly, that's not a correctly formatted cookie for CGI.pm's ->cookie. ->cookie is designed to handle cookies created using CGI.pm's ->cookie. The cookie value in question was not created with that method, and the cookie can't be handled (correctly) by that method.

    To get the desired string from ->cookie, either construct the cookie using ->cookie, or otherwise create a cookie with the URI-encoding the value you wish ->cookie to return.

    For example, the desired string will be returned for a cookie with the value

    unixtime%3D1593603710%26oracletime%3D01-jul-20%2012%3A41%3A50_Hash_thNnmggU2ex3L5XXeMNfxf8Wl8STcVZTxscSFEKSxa0
    

    CGI's approach allows cookies to have multiple values, and gets around the problem of spaces being forbidden in the values of cookies.

    0 讨论(0)
提交回复
热议问题