Revision cce97007
mainbox now prints error on 404 or 500 from server
mainbox/query.c | ||
---|---|---|
37 | 37 |
CURLcode error_code; |
38 | 38 |
char url[1024]; |
39 | 39 |
int result = 0; |
40 |
long response = 0; |
|
40 | 41 |
|
41 | 42 |
handle = curl_easy_init(); |
42 | 43 |
if (handle == NULL) |
... | ... | |
55 | 56 |
error_code = curl_easy_perform(handle); |
56 | 57 |
if (error_code) goto error; |
57 | 58 |
|
59 |
error_code = curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &response); |
|
60 |
if (error_code) goto error; |
|
61 |
if (response >= 400) |
|
62 |
fprintf(stderr, "Error %ld from %s\n", response, url); |
|
63 |
else if (response > 200) |
|
64 |
fprintf(stderr, "Warning: response %ld from %s\n", response, url); |
|
65 |
|
|
58 | 66 |
curl_easy_cleanup(handle); |
59 | 67 |
return result; |
60 | 68 |
|
Also available in: Unified diff