vere: disable printfs on failed requests to $version/next
@@ -237,7 +237,7 @@ _king_curl_alloc(void* dat_v, size_t uni_t, size_t mem_t, void* buf_v)
** XX deduplicate with dawn.c
*/
static c3_i
-_king_curl_bytes(c3_c* url_c, c3_w* len_w, c3_y** hun_y)
+_king_curl_bytes(c3_c* url_c, c3_w* len_w, c3_y** hun_y, c3_t veb_t)
{
c3_i ret_i = 0;
CURL *cul_u;
@@ -261,11 +261,15 @@ _king_curl_bytes(c3_c* url_c, c3_w* len_w, c3_y** hun_y)
// XX retry?
//
if ( CURLE_OK != res_i ) {
+ if ( veb_t ) {
u3l_log("curl: failed %s: %s\n", url_c, curl_easy_strerror(res_i));
+ }
ret_i = -1;
}
if ( 300 <= cod_i ) {
+ if ( veb_t ) {
u3l_log("curl: error %s: HTTP %ld\n", url_c, cod_i);
+ }
ret_i = -2;
}
@@ -286,7 +290,7 @@ _king_get_atom(c3_c* url_c)
c3_y* hun_y;
u3_noun pro;
- if ( _king_curl_bytes(url_c, &len_w, &hun_y) ) {
+ if ( _king_curl_bytes(url_c, &len_w, &hun_y, 1) ) {
u3_king_bail();
exit(1);
}
@@ -354,15 +358,18 @@ u3_king_next(c3_c* pac_c, c3_c** out_c)
ret_i = asprintf(&url_c, "%s/%s/%s/next", ver_hos_c, pac_c, URBIT_VERSION);
c3_assert( ret_i > 0 );
- if ( _king_curl_bytes(url_c, &len_w, &hun_y) ) {
+ // skip printfs on failed requests (/next is usually not present)
+ //
+ if ( _king_curl_bytes(url_c, &len_w, &hun_y, 0) ) {
c3_free(url_c);
- // XX support channel redirections
- //
ret_i = asprintf(&url_c, "%s/%s/last", ver_hos_c, pac_c);
c3_assert( ret_i > 0 );
- if ( _king_curl_bytes(url_c, &len_w, &hun_y) )
+ // enable printfs on failed requests (/last must be present)
+ // XX support channel redirections
+ //
+ if ( _king_curl_bytes(url_c, &len_w, &hun_y, 1) )
{
c3_free(url_c);
return -2;
