Skip to content
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

Fix partial match #622

Merged
merged 7 commits into from
Oct 24, 2024
Merged

Fix partial match #622

merged 7 commits into from
Oct 24, 2024

Conversation

NavidJalali
Copy link
Contributor

I hit this case in a test and it threw. I am not sure if when trailer.headers is empty, it should return None or a parsed frame with empty headers but I figured the guard was there for a reason

@pjfanning
Copy link
Contributor

  • seems sensible to change this
  • is there an easy way to get to add a unit test?

@NavidJalali
Copy link
Contributor Author

@pjfanning I am honestly not sure what this code is really doing so I am a bit hesitant to assert things about this. I will have a look at the related tests to see if I can confidently test it

@NavidJalali
Copy link
Contributor Author

@pjfanning can you take another look when you get the time?

Copy link
Contributor

@mdedetrich mdedetrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is just one minor thing regarding imports but otherwise lgtm.

I also triggered the CI run

import pekko.http.scaladsl.model.{ ContentTypes, DateTime, HttpHeader, TransferEncodings }

import scala.collection.immutable.Seq
import pekko.http.scaladsl.model._
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the imports in some order - why are you changing the order of these imports?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've committed a change to the PR branch to try to order the imports

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit too slow 😄

Copy link
Contributor

@mdedetrich mdedetrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is lgtm now, @pjfanning also check as well

@pjfanning pjfanning merged commit 750e8f9 into apache:main Oct 24, 2024
10 checks passed
@pjfanning pjfanning added this to the 1.1.1 milestone Oct 24, 2024
@pjfanning
Copy link
Contributor

Thanks @NavidJalali - merging

@pjfanning
Copy link
Contributor

@mdedetrich this looks useful to backport to 1.0.x - wdyt?

Comment on lines 100 to +102
case Some(trailer) if trailer.headers.nonEmpty =>
OptionVal.Some(ParsedHeadersFrame(streamId, endStream = true, trailer.headers, None))
case None => OptionVal.None
case _ => OptionVal.None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the question here is if someone added a AttributeKeys.trailer but it contained no headers, should we produce a ParsedHeadersFrame here? Looking at Http2SubStream/OutStreamImpl, it does seem safe (it will produce an empty DataFrame with endStream = true if necessary). It seems unlikely that any downstream implementation would rely on receiving an empty frame of trailing headers.

All in all I think this is OK, though adding a AttributeKeys.trailer without any headers seems strange, the code that caused that might deserve a closer look.

@pjfanning
Copy link
Contributor

@raboof this relates to apache/pekko-grpc#391

@NavidJalali NavidJalali deleted the fix-partial-match branch October 24, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants