@@ -24,10 +24,9 @@ public enum Publish
24
24
Off
25
25
}
26
26
27
- public enum ClearCache
27
+ public enum startNew
28
28
{
29
29
On ,
30
- Off ,
31
30
Ignore
32
31
}
33
32
@@ -44,6 +43,12 @@ public enum All
44
43
Done
45
44
}
46
45
46
+ public enum ignoreMismatch
47
+ {
48
+ On ,
49
+ Off
50
+ }
51
+
47
52
public SSLLabsApiService ( string apiUrl ) : this ( apiUrl , new SSLLabsApi ( ) )
48
53
{
49
54
}
@@ -89,10 +94,10 @@ public Info Info()
89
94
public Analyze Analyze ( string host )
90
95
{
91
96
// overloaded method to provide a default set of options
92
- return Analyze ( host , Publish . Off , ClearCache . On , FromCache . Ignore , All . On ) ;
97
+ return Analyze ( host , Publish . Off , startNew . On , FromCache . Ignore , null , All . On , ignoreMismatch . Off ) ;
93
98
}
94
99
95
- public Analyze Analyze ( string host , Publish publish , ClearCache clearCache , FromCache fromCache , All all )
100
+ public Analyze Analyze ( string host , Publish publish , startNew startNew , FromCache fromCache , int ? maxHours , All all , ignoreMismatch ignoreMismatch )
96
101
{
97
102
var analyzeModel = new Analyze ( ) ;
98
103
@@ -105,8 +110,8 @@ public Analyze Analyze(string host, Publish publish, ClearCache clearCache, From
105
110
}
106
111
107
112
// Building request model
108
- var requestModel = _requestModelFactory . NewAnalyzeRequestModel ( ApiUrl , "analyze" , host , publish . ToString ( ) . ToLower ( ) , clearCache . ToString ( ) . ToLower ( ) ,
109
- fromCache . ToString ( ) . ToLower ( ) , all . ToString ( ) . ToLower ( ) ) ;
113
+ var requestModel = _requestModelFactory . NewAnalyzeRequestModel ( ApiUrl , "analyze" , host , publish . ToString ( ) . ToLower ( ) , startNew . ToString ( ) . ToLower ( ) ,
114
+ fromCache . ToString ( ) . ToLower ( ) , maxHours , all . ToString ( ) . ToLower ( ) , ignoreMismatch . ToString ( ) . ToLower ( ) ) ;
110
115
111
116
try
112
117
{
@@ -132,25 +137,26 @@ public Analyze AutomaticAnalyze(string host)
132
137
133
138
public Analyze AutomaticAnalyze ( string host , int maxWaitInterval , int sleepInterval )
134
139
{
135
- return AutomaticAnalyze ( host , Publish . Off , ClearCache . On , FromCache . Ignore , All . On , maxWaitInterval , sleepInterval ) ;
140
+ return AutomaticAnalyze ( host , Publish . Off , startNew . On , FromCache . Ignore , null , All . On , ignoreMismatch . Off , maxWaitInterval , sleepInterval ) ;
136
141
}
137
142
138
- public Analyze AutomaticAnalyze ( string host , Publish publish , ClearCache clearCache , FromCache fromCache , All all , int maxWaitInterval , int sleepInterval )
143
+ public Analyze AutomaticAnalyze ( string host , Publish publish , startNew startNew , FromCache fromCache , int ? maxHours , All all , ignoreMismatch ignoreMismatch ,
144
+ int maxWaitInterval , int sleepInterval )
139
145
{
140
146
var startTime = DateTime . Now ;
141
147
var sleepIntervalMilliseconds = sleepInterval * 1000 ;
142
148
var apiPassCount = 1 ;
143
- var analyzeModel = Analyze ( host , publish , clearCache , fromCache , all ) ;
149
+ var analyzeModel = Analyze ( host , publish , startNew , fromCache , maxHours , all , ignoreMismatch ) ;
144
150
145
151
// Ignoring cache settings after first request to prevent loop
146
- clearCache = ClearCache . Ignore ;
152
+ startNew = startNew . Ignore ;
147
153
148
154
// Shouldn't have to check status header as HasErrorOccurred should be enough
149
155
while ( analyzeModel . HasErrorOccurred == false && analyzeModel . status != "READY" && ( DateTime . Now - startTime ) . TotalSeconds < maxWaitInterval )
150
156
{
151
157
Thread . Sleep ( sleepIntervalMilliseconds ) ;
152
158
apiPassCount ++ ;
153
- analyzeModel = Analyze ( host , publish , clearCache , fromCache , all ) ;
159
+ analyzeModel = Analyze ( host , publish , startNew , fromCache , null , all , ignoreMismatch ) ;
154
160
}
155
161
156
162
analyzeModel . Wrapper . ApiPassCount = apiPassCount ;
0 commit comments