Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Use proper header delimiter #14

Merged
merged 2 commits into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.1

- Use proper headers delimiter.

## 2.1.0

- Support Firefox.
Expand Down
13 changes: 7 additions & 6 deletions lib/server/sse_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import 'package:pedantic/pedantic.dart';
import 'package:shelf/shelf.dart' as shelf;
import 'package:stream_channel/stream_channel.dart';

// RFC 2616 requires carriage return delimiters.
String _sseHeaders(String origin) => 'HTTP/1.1 200 OK\r\n'
'Content-Type: text/event-stream\n\n'
'Cache-Control: no-cache\n\n'
'Connection: keep-alive\n\n'
'Access-Control-Allow-Credentials: true\n\n'
'Access-Control-Allow-Origin: $origin\n\n'
'\n\n';
'Content-Type: text/event-stream\r\n'
'Cache-Control: no-cache\r\n'
'Connection: keep-alive\r\n'
'Access-Control-Allow-Credentials: true\r\n'
'Access-Control-Allow-Origin: $origin\r\n'
'\r\n\r\n';

/// A bi-directional SSE connection between server and browser.
class SseConnection extends StreamChannelMixin<String> {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sse
version: 2.1.0
version: 2.1.1
author: Dart Team <[email protected]>
homepage: https://github.com/dart-lang/sse
description: >-
Expand Down