Skip to content

Commit 46b812b

Browse files
mconnewStephenBonikowsky
authored andcommitted
Adding support for Expect:100-Continue header and removing extra HEAD request when not using UAP
1 parent 32ebead commit 46b812b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/System.Private.ServiceModel/src/System/ServiceModel/Channels/HttpChannelFactory.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ public async Task SendRequestAsync(Message message, TimeoutHelper timeoutHelper)
10361036
httpRequestMessage.Content = MessageContent.Create(_factory, request, _timeoutHelper);
10371037
}
10381038

1039+
#if FEATURE_NETNATIVE // UAP doesn't support Expect Continue so we do a HEAD request to get authentication done before sending the real request
10391040
try
10401041
{
10411042
// There is a possibility that a HEAD pre-auth request might fail when the actual request
@@ -1044,6 +1045,7 @@ public async Task SendRequestAsync(Message message, TimeoutHelper timeoutHelper)
10441045
await SendPreauthenticationHeadRequestIfNeeded();
10451046
}
10461047
catch { /* ignored */ }
1048+
#endif
10471049

10481050
bool success = false;
10491051
var timeoutToken = await _timeoutHelper.GetCancellationTokenAsync();
@@ -1294,6 +1296,13 @@ private bool PrepareMessageHeaders(Message message)
12941296
}
12951297
}
12961298

1299+
#if !FEATURE_NETNATIVE // Expect continue not correctly supported on UAP
1300+
if (AuthenticationSchemeMayRequireResend())
1301+
{
1302+
_httpRequestMessage.Headers.ExpectContinue = true;
1303+
}
1304+
#endif
1305+
12971306
if (action != null)
12981307
{
12991308
if (message.Version.Envelope == EnvelopeVersion.Soap11)

0 commit comments

Comments
 (0)