@@ -80,6 +80,14 @@ asp::Mutex<>::Guard ArgonState::lockServerUrl() {
8080 return serverUrlMtx.lock ();
8181}
8282
83+ void ArgonState::setCertVerification (bool state) {
84+ this ->certVerification = state;
85+ }
86+
87+ bool ArgonState::getCertVerification () const {
88+ return this ->certVerification ;
89+ }
90+
8391std::lock_guard<std::mutex> ArgonState::acquireConfigLock () {
8492 if (!configLock) {
8593 this ->initConfigLock ();
@@ -227,9 +235,18 @@ void ArgonState::processStage1Response(PendingRequest* req, web::WebResponse* re
227235 auto res = response->json ();
228236
229237 if (!res) {
238+ auto str = response->string ().unwrapOrDefault ();
239+
230240 log::warn (" (Argon) Stage 1 request failed with code {}, server did not send a JSON, dumping server response." , response->code ());
231- log::warn (" {}" , response->string ().unwrapOrDefault ());
232- this ->handleStage1Error (req, fmt::format (" Unknown server error ({})" , response->code ()));
241+ log::warn (" Response: {}" , str);
242+ log::warn (" Curl (extra) error message: {}" , response->errorMessage ());
243+
244+ if (response->code () == -1 ) {
245+ this ->handleStage1Error (req, fmt::format (" Unknown request error: " , truncate (str).asBorrowed ()));
246+ } else {
247+ this ->handleStage1Error (req, fmt::format (" Unknown server error (code {}): {}" , response->code (), truncate (str).asBorrowed ()));
248+ }
249+
233250 return ;
234251 }
235252
@@ -299,9 +316,18 @@ void ArgonState::processStage3Response(PendingRequest* req, web::WebResponse* re
299316 auto res = response->json ();
300317
301318 if (!res) {
319+ auto str = response->string ().unwrapOrDefault ();
320+
302321 log::warn (" (Argon) Stage 3 request failed with code {}, server did not send a JSON, dumping server response." , response->code ());
303- log::warn (" {}" , response->string ().unwrapOrDefault ());
304- this ->handleStage3Error (req, fmt::format (" Unknown server error ({})" , response->code ()));
322+ log::warn (" Response: {}" , str);
323+ log::warn (" Curl (extra) error message: {}" , response->errorMessage ());
324+
325+ if (response->code () == -1 ) {
326+ this ->handleStage3Error (req, fmt::format (" Unknown request error: " , truncate (str).asBorrowed ()));
327+ } else {
328+ this ->handleStage3Error (req, fmt::format (" Unknown server error (code {}): {}" , response->code (), truncate (str).asBorrowed ()));
329+ }
330+
305331 return ;
306332 }
307333
0 commit comments