@@ -169,12 +169,18 @@ private void writeRequest(HttpRequest request) {
169
169
// Done writing so remove the idle write timeout handler
170
170
ChannelUtils .removeIfExists (channel .pipeline (), WriteTimeoutHandler .class );
171
171
if (wireCall .isSuccess ()) {
172
- if (!context .executeRequest ().fullDuplex ()) {
173
- // Starting read so add the idle read timeout handler, removed when channel is released
172
+ if (context .executeRequest ().fullDuplex ()) {
173
+ return ;
174
+ }
175
+
176
+ // if it is 100ContinueExpected request, then we do not need to add another ReadTimeoutHandler
177
+ if (!is100ContinueExpected ()) {
174
178
channel .pipeline ().addFirst (new ReadTimeoutHandler (context .configuration ().readTimeoutMillis (),
175
179
TimeUnit .MILLISECONDS ));
176
- channel .read ();
177
180
}
181
+
182
+ channel .read ();
183
+
178
184
} else {
179
185
// TODO: Are there cases where we can keep the channel open?
180
186
closeAndRelease (channel );
@@ -198,11 +204,15 @@ private void writeRequest(HttpRequest request) {
198
204
* @return true if it should explicitly read from channel
199
205
*/
200
206
private boolean shouldExplicitlyTriggerRead () {
201
- boolean is100ContinueExpected = context .executeRequest ().request ()
202
- .firstMatchingHeader ("Expect" )
203
- .filter (b -> b .equalsIgnoreCase ("100-continue" )).isPresent ();
207
+ return context .executeRequest ().fullDuplex () || is100ContinueExpected ();
208
+ }
204
209
205
- return context .executeRequest ().fullDuplex () || is100ContinueExpected ;
210
+ private boolean is100ContinueExpected () {
211
+ return context .executeRequest ()
212
+ .request ()
213
+ .firstMatchingHeader ("Expect" )
214
+ .filter (b -> b .equalsIgnoreCase ("100-continue" ))
215
+ .isPresent ();
206
216
}
207
217
208
218
private URI endpoint () {
0 commit comments