Project

General

Profile

Revision 880dc54f

ID880dc54fdbb40937890923ffda9180a8b72d7357
Parent 75cef49f
Child 15928a3d

Added by Thomas Mullins about 11 years ago

Fixed curl SSL queries failing and queue bug

View differences:

mainbox/query.c
10 10

  
11 11
  server = server_name;
12 12

  
13
  error_code = curl_global_init(CURL_GLOBAL_NOTHING);
13
  error_code = curl_global_init(CURL_GLOBAL_SSL);
14 14
  if (error_code)
15 15
    fprintf(stderr, "curl_global_init: %s\n", curl_easy_strerror(error_code));
16 16

  
......
33 33
  return nmemb;
34 34
}
35 35

  
36
static size_t write_ignore(void *buffer, size_t size, size_t nmemb,
37
    void *userp) {
38
  return nmemb;
39
}
40

  
36 41
/*
37 42
 * query_user_permission
38 43
 *
......
139 144
  error_code = curl_easy_setopt(handle, CURLOPT_URL, buf);
140 145
  if (error_code) goto error;
141 146

  
147
  error_code = curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
148
  if (error_code) goto error;
149

  
150
  error_code = curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_ignore);
151
  if (error_code) goto error;
152

  
142 153
  error_code = curl_easy_setopt(handle, CURLOPT_HTTPPOST, formpost);
143 154
  if (error_code) goto error;
144 155

  
......
153 164
    fprintf(stderr, "Warning: response %ld from %s\n", response, buf);
154 165

  
155 166
  curl_easy_cleanup(handle);
167
  curl_formfree(formpost);
156 168
  return response >= 300;
157 169

  
158 170
error:
159 171
  fprintf(stderr, "curl: %s\n", curl_easy_strerror(error_code));
160 172
  curl_easy_cleanup(handle);
173
  curl_formfree(formpost);
161 174
  return 1;
162 175
}

Also available in: Unified diff