Cookie module issues

Offen
#194 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
erlang
Bereich
api, backend

Rechercherichtung

Beginne mit der Untersuchung des hackney_cookie-Moduls und des hackney:cookies(Headers)-Einstiegspunkts, einschließlich des durch PR #193 behandelten Verhaltens. Vergleiche Parser und Builder mit RFC6265 und untersuche anschließend die verschiedenen im Projekt verwendeten Cookie-Repräsentationen. Als abgeschlossen gilt die korrekte Set-Cookie-Analyse und das korrekte Erstellen von Cookie sowie eine abgestimmte konsistente Repräsentation.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Erlang
Sterne
1.4k
Forks
458
Ø Merge
11 Std. 32 Min.
Gemergte PRs (30 T.)
47

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus benoitc/hackney

Alle Issues in benoitc/hackney

Ähnliche Issues

Weitere Issues zu Backend & API Design

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.