-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relax record terminate char spec #46
Conversation
Codecov Report
@@ Coverage Diff @@
## master #46 +/- ##
==========================================
+ Coverage 63.98% 64.08% +0.10%
==========================================
Files 11 11
Lines 1080 1086 +6
==========================================
+ Hits 691 696 +5
- Misses 297 298 +1
Partials 92 92
Continue to review full report at Codecov.
|
a6dc5d0
to
99a7e4d
Compare
unmarshal_test.go
Outdated
// The expected value looks a bit different for the same reason as mentioned | ||
// above regarding RepeatTimes. | ||
TimeZonesSDP = TimingSDP + | ||
"r=2882844526 -1h 2898848070 0\r\n" | ||
"z=2882844526 -1h 2898848070 0\r\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure, but I think TimeZone should be z=
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you find the reference for this in the RFC? I am pretty sure it was r
. Other than that the PR seems fine and the unittests are passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://tools.ietf.org/html/rfc4566#section-5.11
TimeZones field is z=
, but in
Lines 240 to 253 in 2fd3281
func TestUnmarshalTimeZones(t *testing.T) { | |
sd := &SessionDescription{} | |
if err := sd.Unmarshal([]byte(TimeZonesSDP)); err != nil { | |
t.Errorf("error: %v", err) | |
} | |
actual, err := sd.Marshal() | |
if got, want := err, error(nil); got != want { | |
t.Fatalf("Marshal(): err=%v, want %v", got, want) | |
} | |
if string(actual) != TimeZonesSDPExpected { | |
t.Errorf("error:\n\nEXPECTED:\n%v\nACTUAL:\n%v", TimeZonesSDPExpected, actual) | |
} | |
} |
z=
is never appeared. I'm not very sure what was intended in this test originally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So looking quickly through the rfc it looks liker=
in section 5.10 has to do with time repeating. I inplemented this stuff almost a year ago so I really don't remember. My vote is to not touch this in this PR if it is not durectly broken or breaks something specific for your usecase. It looks like this PR is related only to CRLF termination so I would keep it this way. Maybe separate this fix into a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I touched this because I wanted to have a test case that ends with TimeZones
and extra CRLF to cover s13
's EOF handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add another const for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted TimeZonesSDP
and added TimeZonesSDP2
for now.
Allow single '\n' as a record termination since RFC 4566 says: > parsers SHOULD be tolerant and also accept records terminated with > a single newline character. Allow to have empty lines. Other SDP parsers (e.g. one in VLC media player) allow empty lines.
99a7e4d
to
0bffc66
Compare
@trivigy reverted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Allow single '\n' as a record termination since RFC 4566 says:
Allow to have empty lines.
Other SDP parsers (e.g. one in VLC media player) allow empty lines.
Reference issue
Fixes #44