Skip to content

Commit d0e7df4

Browse files
Martin Bauligakoeplinger
authored andcommitted
[System]: Enable some System.Net.Requests tests from CoreFX. (#7339)
Backport of #7080
1 parent 28c171a commit d0e7df4

18 files changed

Lines changed: 282 additions & 267 deletions

File tree

‎mcs/build/library.make‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,5 +394,5 @@ ifneq ($(RESX_STRINGS),)
394394
endif
395395

396396
update-corefx-sr: $(RESX_RESOURCE_STRING) $(XTEST_RESX_RESOURCE_STRING)
397-
make SR_OUTPUT=corefx/SR.cs RESX_STRINGS=$(RESX_RESOURCE_STRING) update-corefx-sr-generic \
397+
make SR_OUTPUT=corefx/SR.cs RESX_STRINGS="$(RESX_RESOURCE_STRING)" update-corefx-sr-generic \
398398
&& make SR_OUTPUT=corefx/SR.tests.cs RESX_STRINGS=$(XTEST_RESX_RESOURCE_STRING) update-corefx-sr-generic

‎mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public void CancelRequestViaProxy ()
276276
httpClient.PostAsync (restRequest.RequestUri, restRequest.Content).Wait (WaitTimeout);
277277
Assert.Fail ("#1");
278278
} catch (AggregateException e) {
279-
Assert.IsTrue (e.InnerException is TaskCanceledException, "#2");
279+
Assert.That (e.InnerException, Is.InstanceOf<TaskCanceledException> (), "#2");
280280
}
281281
}
282282

@@ -680,16 +680,15 @@ public void Send_Complete_CustomHeaders_SpecialSeparators ()
680680
#endif
681681
public void Send_Complete_CustomHeaders_Host ()
682682
{
683-
bool? failed = null;
683+
Exception error = null;
684684
var port = NetworkHelpers.FindFreePort ();
685685
var listener = CreateListener (l => {
686686
var request = l.Request;
687687

688688
try {
689689
Assert.AreEqual ("customhost", request.Headers["Host"], "#1");
690-
failed = false;
691-
} catch {
692-
failed = true;
690+
} catch (Exception ex) {
691+
error = ex;
693692
}
694693
}, port);
695694

@@ -704,7 +703,7 @@ public void Send_Complete_CustomHeaders_Host ()
704703

705704
Assert.AreEqual ("", response.Content.ReadAsStringAsync ().Result, "#100");
706705
Assert.AreEqual (HttpStatusCode.OK, response.StatusCode, "#101");
707-
Assert.AreEqual (false, failed, "#102");
706+
Assert.IsNull (error, "#102");
708707
} finally {
709708
listener.Abort ();
710709
listener.Close ();

‎mcs/class/System/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ RESX_RESOURCE_STRING = \
2020
../../../external/corefx/src/System.Buffers/src/Resources/Strings.resx \
2121
../../../external/corefx/src/System.Private.Uri/src/Resources/Strings.resx \
2222
../../../external/corefx/src/System.IO.Ports/src/Resources/Strings.resx \
23-
../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx
23+
../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx \
24+
../../../external/corefx/src/System.Net.Requests/src/Resources/Strings.resx
2425

2526
TEST_RESOURCES = \
2627
Test/System/test-uri-props.txt \

‎mcs/class/System/ReferenceSources/SR.cs‎

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -312,73 +312,36 @@ partial class SR
312312
public const string net_nonClsCompliantException = "A non-CLS Compliant Exception (i.e. an object that does not derive from System.Exception) was thrown.";
313313
public const string net_illegalConfigWith = "The '{0}' attribute cannot appear when '{1}' is present.";
314314
public const string net_illegalConfigWithout = "The '{0}' attribute can only appear when '{1}' is present.";
315-
public const string net_baddate = "The value of the date string in the header is invalid.";
316-
public const string net_writestarted = "This property cannot be set after writing has started.";
317-
public const string net_reqsubmitted = "This operation cannot be performed after the request has been submitted.";
318-
public const string net_ftp_no_http_cmd = "The requested FTP command is not supported when using HTTP proxy.";
319-
public const string net_ftp_invalid_method_name = "FTP Method names cannot be null or empty.";
320-
public const string net_ftp_invalid_renameto = "The RenameTo filename cannot be null or empty.";
321-
public const string net_ftp_no_defaultcreds = "Default credentials are not supported on an FTP request.";
322-
public const string net_ftpnoresponse = "This type of FTP request does not return a response stream.";
323-
public const string net_ftp_response_invalid_format = "The response string '{0}' has invalid format.";
324-
public const string net_ftp_no_offsetforhttp = "Offsets are not supported when sending an FTP request over an HTTP proxy.";
325-
public const string net_ftp_invalid_uri = "The requested URI is invalid for this FTP command.";
326-
public const string net_ftp_invalid_status_response = "The status response ({0}) is not expected in response to '{1}' command.";
327-
public const string net_ftp_server_failed_passive = "The server failed the passive mode request with status response ({0}).";
328-
public const string net_ftp_active_address_different = "The data connection was made from an address that is different than the address to which the FTP connection was made.";
329-
public const string net_ftp_proxy_does_not_support_ssl = "SSL cannot be enabled when using a proxy.";
330-
public const string net_ftp_invalid_response_filename = "The server returned the filename ({0}) which is not valid.";
331-
public const string net_ftp_unsupported_method = "This method is not supported.";
332315
public const string net_resubmitcanceled = "An error occurred on an automatic resubmission of the request.";
333316
public const string net_redirect_perm = "WebPermission demand failed for redirect URI.";
334317
public const string net_resubmitprotofailed = "Cannot handle redirect from HTTP/HTTPS protocols to other dissimilar ones.";
335-
public const string net_needchunked = "TransferEncoding requires the SendChunked property to be set to true.";
336-
public const string net_connarg = "Keep-Alive and Close may not be set using this property.";
337-
public const string net_no100 = "100-Continue may not be set using this property.";
338-
public const string net_fromto = "The From parameter cannot be less than To.";
339-
public const string net_rangetoosmall = "The From or To parameter cannot be less than 0.";
340318
public const string net_invalidversion = "This protocol version is not supported.";
341-
public const string net_toosmall = "The specified value must be greater than 0.";
342319
public const string net_toolong = "The size of {0} is too long. It cannot be longer than {1} characters.";
343320
public const string net_connclosed = "The underlying connection was closed: {0}.";
344-
public const string net_servererror = "The remote server returned an error: {0}.";
345-
public const string net_nouploadonget = "Cannot send a content-body with this verb-type.";
346321
public const string net_mutualauthfailed = "The requirement for mutual authentication was not met by the remote server.";
347322
public const string net_invasync = "Cannot block a call on this socket while an earlier asynchronous call is in progress.";
348323
public const string net_inasync = "An asynchronous call is already in progress. It must be completed or canceled before you can call this method.";
349324
public const string net_mustbeuri = "The {0} parameter must represent a valid Uri (see inner exception).";
350325
public const string net_format_shexp = "The shell expression '{0}' could not be parsed because it is formatted incorrectly.";
351326
public const string net_cannot_load_proxy_helper = "Failed to load the proxy script runtime environment from the Microsoft.JScript assembly.";
352-
public const string net_invalid_host = "The specified value is not a valid Host header string.";
353-
public const string net_repcall = "Cannot re-call BeginGetRequestStream/BeginGetResponse while a previous call is still in progress.";
354-
public const string net_badmethod = "Cannot set null or blank methods on request.";
355-
public const string net_io_timeout_use_ge_zero = "Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value >= 0.";
356-
public const string net_io_timeout_use_gt_zero = "Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value > 0.";
357327
public const string net_io_no_0timeouts = "NetworkStream does not support a 0 millisecond timeout, use a value greater than zero for the timeout instead.";
358-
public const string net_requestaborted = "The request was aborted: {0}.";
359328
public const string net_tooManyRedirections = "Too many automatic redirections were attempted.";
360329
public const string net_authmodulenotregistered = "The supplied authentication module is not registered.";
361330
public const string net_authschemenotregistered = "There is no registered module for this authentication scheme.";
362331
public const string net_proxyschemenotsupported = "The ServicePointManager does not support proxies with the {0} scheme.";
363332
public const string net_maxsrvpoints = "The maximum number of service points was exceeded.";
364-
public const string net_unknown_prefix = "The URI prefix is not recognized.";
365333
public const string net_notconnected = "The operation is not allowed on non-connected sockets.";
366334
public const string net_notstream = "The operation is not allowed on non-stream oriented sockets.";
367-
public const string net_timeout = "The operation has timed out.";
368335
public const string net_nocontentlengthonget = "Content-Length or Chunked Encoding cannot be set for an operation that does not write data.";
369336
public const string net_contentlengthmissing = "When performing a write operation with AllowWriteStreamBuffering set to false, you must either set ContentLength to a non-negative number or set SendChunked to true.";
370337
public const string net_nonhttpproxynotallowed = "The URI scheme for the supplied IWebProxy has the illegal value '{0}'. Only 'http' is supported.";
371-
public const string net_nottoken = "The supplied string is not a valid HTTP token.";
372-
public const string net_rangetype = "A different range specifier has already been added to this request.";
373338
public const string net_need_writebuffering = "This request requires buffering data to succeed.";
374-
public const string net_securityprotocolnotsupported = "The requested security protocol is not supported.";
375339
public const string net_nodefaultcreds = "Default credentials cannot be supplied for the {0} authentication scheme.";
376340
public const string net_stopped = "Not listening. You must call the Start() method before calling this method.";
377341
public const string net_udpconnected = "Cannot send packets to an arbitrary host while connected.";
378342
public const string net_no_concurrent_io_allowed = "The stream does not support concurrent IO read or write operations.";
379343
public const string net_needmorethreads = "There were not enough free threads in the ThreadPool to complete the operation.";
380344
public const string net_MethodNotSupportedException = "This method is not supported by this class.";
381-
public const string net_PropertyNotSupportedException = "This property is not supported by this class.";
382345
public const string net_ProtocolNotSupportedException = "The '{0}' protocol is not supported by this class.";
383346
public const string net_SelectModeNotSupportedException = "The '{0}' select mode is not supported by this class.";
384347
public const string net_InvalidSocketHandle = "The socket handle is not valid.";
@@ -389,7 +352,6 @@ partial class SR
389352
public const string net_invalidPingBufferSize = "The buffer length must not exceed 65500 bytes.";
390353
public const string net_cant_perform_during_shutdown = "This operation cannot be performed while the AppDomain is shutting down.";
391354
public const string net_cant_create_environment = "Unable to create another web proxy script environment at this time.";
392-
public const string net_completed_result = "This operation cannot be performed on a completed asynchronous result object.";
393355
public const string net_protocol_invalid_family = "'{0}' Client can only accept InterNetwork or InterNetworkV6 addresses.";
394356
public const string net_protocol_invalid_multicast_family = "Multicast family is not the same as the family of the '{0}' Client.";
395357
public const string net_empty_osinstalltype = "The Registry value '{0}' was either empty or not a string type.";
@@ -443,8 +405,6 @@ partial class SR
443405
public const string net_WebResponseParseError_InvalidChunkFormat = "Response chunk format is invalid";
444406
public const string net_WebResponseParseError_UnexpectedServerResponse = "Unexpected server response received";
445407
public const string net_webstatus_Success = "Status success";
446-
public const string net_webstatus_NameResolutionFailure = "The remote name could not be resolved";
447-
public const string net_webstatus_ConnectFailure = "Unable to connect to the remote server";
448408
public const string net_webstatus_ReceiveFailure = "An unexpected error occurred on a receive";
449409
public const string net_webstatus_SendFailure = "An unexpected error occurred on a send";
450410
public const string net_webstatus_PipelineFailure = "A pipeline failure occurred";
@@ -458,25 +418,7 @@ partial class SR
458418
public const string net_webstatus_MessageLengthLimitExceeded = "The message length limit was exceeded";
459419
public const string net_webstatus_CacheEntryNotFound = "The request cache-only policy does not allow a network request and the response is not found in cache";
460420
public const string net_webstatus_RequestProhibitedByCachePolicy = "The request could not be satisfied using a cache-only policy";
461-
public const string net_webstatus_Timeout = "The operation has timed out";
462421
public const string net_webstatus_RequestProhibitedByProxy = "The IWebProxy object associated with the request did not allow the request to proceed";
463-
public const string net_InvalidStatusCode = "The server returned a status code outside the valid range of 100-599.";
464-
public const string net_ftpstatuscode_ServiceNotAvailable = "Service not available, closing control connection";
465-
public const string net_ftpstatuscode_CantOpenData = "Can't open data connection";
466-
public const string net_ftpstatuscode_ConnectionClosed = "Connection closed; transfer aborted";
467-
public const string net_ftpstatuscode_ActionNotTakenFileUnavailableOrBusy = "File unavailable (e.g., file busy)";
468-
public const string net_ftpstatuscode_ActionAbortedLocalProcessingError = "Local error in processing";
469-
public const string net_ftpstatuscode_ActionNotTakenInsufficentSpace = "Insufficient storage space in system";
470-
public const string net_ftpstatuscode_CommandSyntaxError = "Syntax error, command unrecognized";
471-
public const string net_ftpstatuscode_ArgumentSyntaxError = "Syntax error in parameters or arguments";
472-
public const string net_ftpstatuscode_CommandNotImplemented = "Command not implemented";
473-
public const string net_ftpstatuscode_BadCommandSequence = "Bad sequence of commands";
474-
public const string net_ftpstatuscode_NotLoggedIn = "Not logged in";
475-
public const string net_ftpstatuscode_AccountNeeded = "Need account for storing files";
476-
public const string net_ftpstatuscode_ActionNotTakenFileUnavailable = "File unavailable (e.g., file not found, no access)";
477-
public const string net_ftpstatuscode_ActionAbortedUnknownPageType = "Page type unknown";
478-
public const string net_ftpstatuscode_FileActionAborted = "Exceeded storage allocation (for current directory or data set)";
479-
public const string net_ftpstatuscode_ActionNotTakenFilenameNotAllowed = "File name not allowed";
480422
public const string net_httpstatuscode_NoContent = "No Content";
481423
public const string net_httpstatuscode_NonAuthoritativeInformation = "Non Authoritative Information";
482424
public const string net_httpstatuscode_ResetContent = "Reset Content";
@@ -516,8 +458,6 @@ partial class SR
516458
public const string net_headers_req = "This collection holds response headers and cannot contain the specified request header.";
517459
public const string net_headers_rsp = "This collection holds request headers and cannot contain the specified response header.";
518460
public const string net_headers_toolong = "Header values cannot be longer than {0} characters.";
519-
public const string net_WebHeaderInvalidCRLFChars = "Specified value has invalid CRLF characters.";
520-
public const string net_WebHeaderInvalidHeaderChars = "Specified value has invalid HTTP Header characters.";
521461
public const string net_WebHeaderInvalidNonAsciiChars = "Specified value has invalid non-ASCII characters.";
522462
public const string net_WebHeaderMissingColon = "Specified value does not have a ':' separator.";
523463
public const string net_headerrestrict = "The '{0}' header must be modified using the appropriate property or method.";

‎mcs/class/System/ReferenceSources/SR2.cs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@ partial class SR
1515
public const string net_log_set_socketoption_reuseport_default_on = "net_log_set_socketoption_reuseport_default_on";
1616
public const string net_log_set_socketoption_reuseport_not_supported = "net_log_set_socketoption_reuseport_not_supported";
1717
public const string net_log_set_socketoption_reuseport = "net_log_set_socketoption_reuseport";
18-
19-
public const string net_reqaborted = "The request was aborted: The request was canceled.";
2018
}

0 commit comments

Comments
 (0)