Skip to content

[EventSource] Is Last-Event-ID header value allowed to contain any-char? #689

Closed

Description

@yutakahirano

A Last-Event-ID header value is set to the last event ID string which can contain any chars except CR and LF. On the other hand, the Fetch spec requires that a header value consists of field-content octets. The former allows non-CRLF control octets while the latter doesn't.

Activity

  1. yutakahirano commented on Feb 12, 2016

    @yutakahirano
    MemberAuthor
  2. annevk commented on Feb 12, 2016

    @annevk
    Member

    See also whatwg/fetch#115. I'm happy to align this with whatever implementations implement. @hiroshige-g did not get back to me on that yet.

  3. yutakahirano commented on Feb 12, 2016

    @yutakahirano
    MemberAuthor

    Chrome:

    • When the ID contains "\f", the reconnection request contains a Last-Event-ID header with the received ID.
    • When the ID contains "\0", the reconnection request contains a Last-Event-ID header with a trimmed value (e.g. If "abc\0def" was received, "abc" will be sent).

    Firefox:

    • When the ID contains "\f", the reconnection request contains a Last-Event-ID header with the received ID.
    • When the ID contains "\0", the reconnection request doesn't contain a Last-Event-ID header.
  4. yutakahirano commented on Feb 12, 2016

    @yutakahirano
    MemberAuthor

    I would like to ignore an ID value including any control characters when parsing it.

  5. annevk commented on Mar 14, 2016

    @annevk
    Member

    Control being anything less than 0x20 or higher than 0x7E?

  6. annevk commented on Mar 14, 2016

    @annevk
    Member

    Ooh, seems like the specification allows for non-ASCII values.

  7. yutakahirano commented on Mar 15, 2016

    @yutakahirano
    MemberAuthor

    The EventSource spec allows any octet composing a valid utf-8 string other than \r and \n while the HTTP spec allows only us-ascii printable chars (VCHAR).

  8. annevk commented on Mar 15, 2016

    @annevk
    Member

    You preference would be that we require VCHAR in the specification instead and ignore anything outside?

  9. annevk commented on Mar 15, 2016

    @annevk
    Member

    @wanderview, do you know who to ask from Mozilla about this?

  10. yutakahirano commented on Mar 17, 2016

    @yutakahirano
    MemberAuthor

    Both are acceptable, but I'm leaning towards ignoring an id field containing non-VCHARs. It looks consistent with the fact that we ignore an invalid retry field and other unrecognized fields.

  11. overholt commented on Mar 28, 2016

    @overholt

    @mcmanus can probably comment from Mozilla's standpoint.

  12. annevk commented on Jul 18, 2017

    @annevk
    Member

    @yutakahirano given what we decided for https://fetch.spec.whatwg.org/#concept-header-value I think UTF-8 bytes except for 0x00, 0x0A, and 0x0D is the way to go. Let me know if you disagree.

  13. yutakahirano commented on Jul 18, 2017

    @yutakahirano
    MemberAuthor

    Does it mean Firefox's behavior in #689 (comment)?

  14. annevk commented on Jul 18, 2017

    @annevk
    Member

    Yeah, ignoring altogether if it doesn't meet the criteria seems best. Dropping part of the value seems more dangerous.

  15. 2 remaining items

  16. annevk commented on Jul 19, 2017

    @annevk
    Member

    @yutakahirano I think it would be even better if we didn't set evt.lastEventId at all if the id field contained U+0000. It does seem however that current implementation do include it and I also cannot reproduce your Chrome behavior (it does not appear to trim the value). See web-platform-tests/wpt#6584 for my test.

  17. annevk commented on Jul 19, 2017

    @annevk
    Member

    (It's also odd that browsers do not have the U+0000 restriction on header values here while they do have that in other APIs...)

  18. added a commit that references this issue on Jul 19, 2017
    0008143
  19. annevk commented on Jul 19, 2017

    @annevk
    Member

    #2849 has my proposal for how to change the HTML Standard. It would require changes by all implementations though, so feedback appreciated.

  20. added
    topic: eventsource
    and removed
    topic: eventsource
    on Jul 19, 2017
  21. added a commit that references this issue on Aug 3, 2017
    e0d4e9e
  22. added a commit that references this issue on Jan 8, 2019
    f2602a3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

topic: eventsource

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions