maxwell icon indicating copy to clipboard operation
maxwell copied to clipboard

If there are Multiple set-cookie Maxwell could only get one of them

Open jackalcooper opened this issue 7 years ago • 4 comments

Set-Cookie: mx_access_token=UEex53L7ZWRYYr1slF65uH7UpY9XkkdPCpyB7T8j4VBHsYwz; path=/mxpp; HttpOnly
Set-Cookie: mx_network_id=2; path=/mxpp; HttpOnly
Set-Cookie: mx_sso_token=5QIAAOIO6buxYtioPreShjssnd-tsFLHvfcAXYmqzYk-Yi1N; path=/; HttpOnly
Set-Cookie: _session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWQ2ZjQ3MDk3OGM1MjRlZjVhMjhjODQ2ZDFjYmJjYzdjBjsAVEkiHHdhcmRlbi51c2VyLmFjY291bnQua2V5BjsAVGkCaAI%3D--5d25e670ea13c0addd8d98cd764c843cc8473802; path=/; HttpOnly

Multiple set-cookies but the resp_headers is a Map

jackalcooper avatar Mar 29 '17 02:03 jackalcooper

we need add resp_cookies, req_cookies in conn, and implement put_req_cookies/3 and get_resp_cookies/2, just like: https://github.com/elixir-lang/plug/blob/master/lib/plug/conn.ex#L849 Any other solution ? But I don't have time to implement this right now, a PR will be appreciated. :)

zhongwencool avatar Mar 30 '17 07:03 zhongwencool

RFC 2616 specifies multiple copies of the same header may be present in a request. The right solution here (regardless of the above cookie suggestion) is to switch Maxwell.Conn to use a keyword list instead of a map for headers. This is what Plug.Conn does.

See here for Plug: https://hexdocs.pm/plug/Plug.Conn.html#t:headers/0

doughsay avatar Apr 03 '17 23:04 doughsay

@doughsay Thanks for your advice. Do you have time to help implement this feature? Welcome to Maxwell. :)

zhongwencool avatar Apr 05 '17 01:04 zhongwencool

I'll take a look, but probably won't be able to get to it until next weekend, but yeah I'll try and give it a shot! ;)

On Tue, Apr 4, 2017, 6:52 PM 某文 [email protected] wrote:

@doughsay https://github.com/doughsay Thanks for your advice. Do you have time to help implement this feature? Welcome to Maxwell. :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zhongwencool/maxwell/issues/54#issuecomment-291710828, or mute the thread https://github.com/notifications/unsubscribe-auth/AANh_UAHA38bhuvAAlml2jDQF358dgrIks5rsvPhgaJpZM4Msanw .

doughsay avatar Apr 05 '17 02:04 doughsay