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

Commit

Permalink
Use proper header delimiter (#14)
Browse files Browse the repository at this point in the history
* Use proper header delimiter.
  • Loading branch information
grouma authored Sep 12, 2019
1 parent 1d4acba commit a886dc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
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

0 comments on commit a886dc6

Please sign in to comment.