|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | | -using System.IO; |
4 | 3 | using System.Linq; |
5 | 4 | using System.Security.Cryptography; |
6 | 5 | using System.Security.Cryptography.X509Certificates; |
@@ -273,31 +272,32 @@ private async Task ValidateOrderAsync(string[] domains, IOrderContext order) |
273 | 272 |
|
274 | 273 | var challengeExceptions = nonNullChallengeValidationResponses |
275 | 274 | .Where(x => x.Status == ChallengeStatus.Invalid) |
276 | | - .Select(x => new Exception($"{x.Error.Type}: {x.Error.Detail} (challenge type {x.Type})")) |
| 275 | + .Select(x => new Exception($"{x.Error?.Type ?? "errortype null"}: {x.Error?.Detail ?? "null errordetails"} (challenge type {x.Type ?? "null"})")) |
277 | 276 | .ToArray(); |
278 | 277 |
|
279 | | - if (challengeExceptions.Length > 0) |
| 278 | + if (challengeExceptions.Length > 0) |
280 | 279 | throw new OrderInvalidException( |
281 | 280 | "One or more LetsEncrypt orders were invalid. Make sure that LetsEncrypt can contact the domain you are trying to request an SSL certificate for, in order to verify it.", |
282 | 281 | new AggregateException(challengeExceptions)); |
| 282 | + |
283 | 283 | } |
284 | 284 | finally |
285 | 285 | { |
286 | 286 | await _persistenceService.DeleteChallengesAsync(challengeDtos); |
287 | 287 | } |
288 | 288 | } |
289 | 289 |
|
290 | | - private static async Task<Challenge[]> ValidateChallengesAsync(IEnumerable<IChallengeContext> challengeContexts) |
| 290 | + private async Task<Challenge[]> ValidateChallengesAsync(IEnumerable<IChallengeContext> challengeContexts) |
291 | 291 | { |
292 | 292 | var challenges = await Task.WhenAll( |
293 | 293 | challengeContexts.Select(x => x.Validate())); |
294 | 294 |
|
295 | 295 | while (true) |
296 | 296 | { |
297 | | - if (!challenges.Any(x => x.Status == ChallengeStatus.Pending || x.Status == ChallengeStatus.Processing)) |
| 297 | + if (challenges.Any(x => x.Status == ChallengeStatus.Valid) || challenges.All(x => x.Status == ChallengeStatus.Invalid)) |
298 | 298 | break; |
299 | | - |
300 | | - await Task.Delay(1000); |
| 299 | + |
| 300 | + await Task.Delay(1000); |
301 | 301 | challenges = await Task.WhenAll(challengeContexts.Select(x => x.Resource())); |
302 | 302 | } |
303 | 303 |
|
|
0 commit comments