-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finagle-http: Handle last empty chunks more thoughtfully
Problem / Solution We're not doing anything special about last empty chunks (both trailers and payload are empty) although they are fairly popular in our pipelines. Let's handle them explicitly and save some allocations. JIRA Issues: CSL-7728 Differential Revision: https://phabricator.twitter.biz/D284623
- Loading branch information
1 parent
472b447
commit 7aec813
Showing
4 changed files
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
finagle-base-http/src/main/scala/com/twitter/finagle/http/EmptyHeaderMap.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.twitter.finagle.http | ||
|
||
/** | ||
* An empty and read-only [[HeaderMap]]. Use [[HeaderMap.Empty]] for a singleton instance. | ||
*/ | ||
private final class EmptyHeaderMap extends HeaderMap { | ||
def getAll(key: String): Seq[String] = Nil | ||
def get(key: String): Option[String] = None | ||
def add(k: String, v: String): HeaderMap = this | ||
def addUnsafe(k: String, v: String): HeaderMap = this | ||
def set(k: String, v: String): HeaderMap = this | ||
def setUnsafe(k: String, v: String): HeaderMap = this | ||
|
||
def +=(kv: (String, String)): this.type = this | ||
def -=(key: String): this.type = this | ||
def iterator: Iterator[(String, String)] = Iterator.empty | ||
|
||
override def isEmpty: Boolean = true | ||
override def toString: String = "EmptyHeaderMap" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters