Cookie module issues

未关闭
#194 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
erlang
领域
api, backend

调研方向

首先检查 hackney_cookie 模块和 hackney:cookies(Headers) 入口点,包括 PR #193 所涉及的行为。将 parser 和 builder 与 RFC6265 进行比较,然后检查项目中使用的不同 cookie 表示形式。完成的标准是正确解析 Set-Cookie 和构建 Cookie,并就一致的表示形式达成共识。

由索引模型根据 Issue 内容生成。

描述

api enhancement http http11 lib rfc

It seems that cookie parser in hackney_cookie uses 'Cookie' parser to parse 'Set-Cookie' header and 'Set-Cookie' builder to build 'Cookie' header. Also code seems to be outdated as it tries to parse comma as valid separator, that not the case in last RFC6265.
As one particular problem that I'm run into is parser failing to proceed set-cookie with Expires attribute. If you try to request https://ya.ru it sets yandexuid cookie and removes S cookie (with Expires in past), but hackney:cookie silently ignores this:

> {ok, Status, Headers, Client} = hackney:request(get, "https://ya.ru", [], <<>>, []).
...
> Headers.
[{<<"Server">>,<<"nginx">>},
 {<<"Date">>,<<"Fri, 12 Jun 2015 11:21:05 GMT">>},
 {<<"Content-Type">>,<<"text/html; charset=UTF-8">>},
 {<<"Content-Length">>,<<"9627">>},
 {<<"Connection">>,<<"close">>},
 {<<"Cache-Control">>,
  <<"no-cache,no-store,max-age=0,must-revalidate">>},
 {<<"Expires">>,<<"Fri, 12 Jun 2015 11:21:05 GMT">>},
 {<<"Last-Modified">>,<<"Fri, 12 Jun 2015 11:21:05 GMT">>},
 {<<"P3P">>,
  <<"policyref=\"/w3c/p3p.xml\", CP=\"NON DSP ADM DEV PSD IVDo OUR IND STP PHY P"...>>},
 {<<"Set-Cookie">>,
  <<"S=; Expires=Tue, 14-Jun-2005 11:21:05 GMT; Path=/">>},
 {<<"Set-Cookie">>,
  <<"yandexuid=6091834691434108065; Expires=Mon, 09-Jun-2025 11:21:05"...>>},
 {<<"X-Frame-Options">>,<<"DENY">>}]

> hackney:cookies(Headers).
[]

This particular problem addressed in PR #193.
But I think cookie module need more attention to implement proper 'Set-Cookie' parser and 'Cookie' builder with respect to RFC6265.
Another issue is that different cookies representations are used across project like {Name, Value}, {Name, [{Name,Value}|Attrs]}, {Name, Value, Attrs}. This adds complexity to lib usage and can be source of errors, maybe it make sense to go with some unified representation based on record or map.

主要语言
Erlang
星标
1.4k
派生
458
平均合并
11 小时 32 分钟
30 天内合并 PR
47

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

benoitc/hackney 的其他 Issue

查看 benoitc/hackney 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。