ref: 7eb61c82c8f04b7f4a93ecbed287b48b51583620
parent: a811d49d0d0ae0ed433903f4a3337fc2f75a5260
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Dec 5 17:02:49 EST 2020
differentiate between network errors and error responses
--- a/main.c
+++ b/main.c
@@ -125,7 +125,10 @@
if(wait)
close(open("/dev/text", OWRITE|OTRUNC));
if(r->code < 20 || r->code >= 30){
- fprint(2, "%U: %d %s\n", url, r->code, r->meta[0] ? r->meta : r->status);
+ if(r->code > 0)
+ fprint(2, "%U: %d %s\n", url, r->code, (r->meta && r->meta[0]) ? r->meta : r->status);
+ else
+ fprint(2, "%U: %r\n", url);
if(!wait)
exits("failed");
}else{