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SAlJRRUBckj1ufuBFMKKd6hkn1qaZUX1fPrCfNVJ7pzVT66tRurqF4HvX8JIKiC/BTPN5ZAw5fkIUJKn+H7x5o1XG9WMFO/AQ/lUVstaB8/hjY+JC6bZapKwsNj

在 perl 中使用:

%cookies = CGI::Cookie->fetch;
$ticket = $cookies{$ticketKey}->value;
print STDERR $ticket;

我得到:

V7S9qwSUTlYYX0gTVO5edmBVyPZkNyMecr6LuABwN3KSgwTyasj1 0pGiN2OJ6s4Jja9ma BJ0GCCiCFUc8k/uNk/4hIwsZv0KyHVVjOHFHtOq PHMFaBKg5wRfXReI3LDmiDnIM6h0Z9hrEO5wYha/RadNqIqfJzUTOQl7q33RqQGcx/aLoiizm3tHs05InbAkUqwusJ1E4HFVLFqyvhEunFWrRO1Y/TfrZR7GvCzNiVYGO6O6E1yhup7CAaM6Lc22TjxNfKp1jGJy4NMQUvbMqCOlWZ75sFA4H3jeuNg0RcIC2zCT7l1JU8ZECGPDqf75FoL4qi 9rO0mgdEGgZL3cFk3dSyIApxXYeAR7RlKGsB0vqd4zxdSjTz5LRWK  SPyVNBsKMcVFfHDv7tv4PAUhK4sDT7bfBow9lIwV1f8slchXEcCgLNI2TYZsr/j/GoqnSb9mxp7VGmL7Z4s7cqWdpNsXEpQ3dMM7k4n1lVKOk2qCrzBrqvJRE7mNeaAz6RVjQuroOj0tJOhLUsZeukVbCxORY6k01fNgwPc1v7xGh7y0x6906WOHlcgti4 ofaSxG4AxwWeaf55loL6vN5d5/UEICGlRuxEjpM8X5og2RYhxr/qQWGVBbiZFBkDDd7esG3rXML63cRJ011Du03UzoS2DxKhFeDmrJM7QinuDEAr0UF1p90kj6hN PqYqfsRONFXjUS8BqjAMJVEoVnnX5uiAAu1MCZc/xDNDzhu10eiib4Tr 7y6yePw7TQm bunMMFqYVSMMCIapiAsCS70B96UPSgRQHRbzNzeee9ulDvdtXFxdswf89Bi6LwMaPNdcVdq/Cd5KMziRzwqsCli8jkFF7qATgo5E9wU9OueGPlXCnJzdUBu2BG1JaJEZcsDdfczD3vfrVZXy/xQ66OMbwWUn/R02mr3LTiGU5T6pbcsTNbTQyWwc9gNZsjshqBNh5oJ9ScMBI947Gkatf3fkhlH1NJpXX0GNPQ6OqSg RALq7EEqBRmy4pszu/9BDmmKck6luJzihaAfeFyZC/SwlcUbg/epGmOSAlJRRUBckj1ufuBFMKKd6hkn1qaZUX1fPrCfNVJ7pzVT66tRurqF4HvX8JIKiC/BTPN5ZAw5fkIUJKn H7x5o1XG9WMFO/AQ/lUVstaB8/hjY JC6bZapKwsNj

注意到+字符的丢失了吗?这可能是什么原因造成的?我们将 perl v5.8.5 与 Apache/2.0.52 一起使用

4

2 回答 2

5

Cookie 值是 url 转义的,这意味着空格被替换为+字符,其他标点符号被替换为%xx代码。该CGI::Cookie::fetch方法对值进行解码,并恢复 cookie 值中的空格。

raw_fetch如果您不希望对 cookie 值进行解码,可以使用该方法。

于 2013-06-13T14:32:35.753 回答
0

在您的代码中尝试 Request.ServerVariables["HTTP_COOKIE"] 值,它提供 RAW cookie(不删除 cookie 数据中的 + 或 = 字符)

于 2013-12-26T14:51:09.663 回答