Project

General

Profile

Revision cce97007

IDcce970071b5364b5078c124f9350f36cbe73a262
Parent a96c5547
Child 036b4f9a

Added by Thomas Mullins over 11 years ago

mainbox now prints error on 404 or 500 from server

View differences:

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