Skip to content

Commit a886dc6

Browse files
authored
Use proper header delimiter (flutter#14)
* Use proper header delimiter.
1 parent 1d4acba commit a886dc6

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.1
2+
3+
- Use proper headers delimiter.
4+
15
## 2.1.0
26

37
- Support Firefox.

lib/server/sse_handler.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ import 'package:pedantic/pedantic.dart';
1111
import 'package:shelf/shelf.dart' as shelf;
1212
import 'package:stream_channel/stream_channel.dart';
1313

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

2223
/// A bi-directional SSE connection between server and browser.
2324
class SseConnection extends StreamChannelMixin<String> {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sse
2-
version: 2.1.0
2+
version: 2.1.1
33
author: Dart Team <[email protected]>
44
homepage: https://github.com/dart-lang/sse
55
description: >-

0 commit comments

Comments
 (0)