Cookie module issues

Đang mở
#194 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
erlang
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu bằng cách xem xét module hackney_cookie và entry point hackney:cookies(Headers), bao gồm cả hành vi được đề cập trong PR #193. So sánh parser và builder với RFC6265, sau đó kiểm tra các biểu diễn cookie khác nhau được sử dụng trong dự án. Công việc được xem là hoàn tất khi việc parsing Set-Cookie và xây dựng Cookie là chính xác, đồng thời có một biểu diễn nhất quán đã được thống nhất.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Erlang
Star
1.4k
Fork
458
Merge trung bình
11 giờ 32 phút
Pull request đã merge (30 ngày)
47

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của benoitc/hackney

Tất cả issue của benoitc/hackney

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.