comparison src/c/openid.c @ 40:5415f1ded564

Tell libcurl to use SSLv3
author Adam Chlipala <adam@chlipala.net>
date Sun, 12 Jun 2011 17:16:30 -0400
parents 8d23d76b5d48
children a77f4cd1336d
comparison
equal deleted inserted replaced
39:f6b3fbf10dac 40:5415f1ded564
204 uw_push_cleanup(ctx, (void (*)(void *))XML_ParserFree, cd.parser); 204 uw_push_cleanup(ctx, (void (*)(void *))XML_ParserFree, cd.parser);
205 XML_SetElementHandler(cd.parser, startElement, endElement); 205 XML_SetElementHandler(cd.parser, startElement, endElement);
206 XML_SetCharacterDataHandler(cd.parser, cdata); 206 XML_SetCharacterDataHandler(cd.parser, cdata);
207 207
208 curl_easy_reset(c); 208 curl_easy_reset(c);
209 curl_easy_setopt(c, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
209 curl_easy_setopt(c, CURLOPT_URL, id); 210 curl_easy_setopt(c, CURLOPT_URL, id);
210 curl_easy_setopt(c, CURLOPT_WRITEFUNCTION, write_discovery_data); 211 curl_easy_setopt(c, CURLOPT_WRITEFUNCTION, write_discovery_data);
211 curl_easy_setopt(c, CURLOPT_WRITEDATA, &cd); 212 curl_easy_setopt(c, CURLOPT_WRITEDATA, &cd);
212 curl_slist_append(headers, "Accept: application/xrds+xml"); 213 curl_slist_append(headers, "Accept: application/xrds+xml");
213 uw_push_cleanup(ctx, (void (*)(void *))curl_slist_free_all, headers); 214 uw_push_cleanup(ctx, (void (*)(void *))curl_slist_free_all, headers);
214 curl_easy_setopt(c, CURLOPT_HTTPHEADER, headers); 215 curl_easy_setopt(c, CURLOPT_HTTPHEADER, headers);
215 216
216 code = curl_easy_perform(c); 217 code = curl_easy_perform(c);
217 uw_pop_cleanup(ctx); 218 uw_pop_cleanup(ctx);
218 uw_pop_cleanup(ctx); 219 uw_pop_cleanup(ctx);
220
221 if (code) {
222 uw_Basis_debug(ctx, "CURL error:");
223 uw_Basis_debug(ctx, (char*)curl_easy_strerror(code));
224 }
225 else if (!dy->endpoint)
226 uw_Basis_debug(ctx, "Couldn't parse endpoint from page");
219 227
220 if (code || !dy->endpoint) 228 if (code || !dy->endpoint)
221 return NULL; 229 return NULL;
222 else 230 else
223 return dy; 231 return dy;
290 uw_buffer_init(BUF_MAX, buf, BUF_INIT); 298 uw_buffer_init(BUF_MAX, buf, BUF_INIT);
291 299
292 uw_buffer_append(inps, "", 1); 300 uw_buffer_append(inps, "", 1);
293 301
294 curl_easy_reset(c); 302 curl_easy_reset(c);
303 curl_easy_setopt(c, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
295 curl_easy_setopt(c, CURLOPT_URL, url); 304 curl_easy_setopt(c, CURLOPT_URL, url);
296 curl_easy_setopt(c, CURLOPT_POSTFIELDS, inps->start); 305 curl_easy_setopt(c, CURLOPT_POSTFIELDS, inps->start);
297 curl_easy_setopt(c, CURLOPT_WRITEFUNCTION, write_buffer_data); 306 curl_easy_setopt(c, CURLOPT_WRITEFUNCTION, write_buffer_data);
298 curl_easy_setopt(c, CURLOPT_WRITEDATA, buf); 307 curl_easy_setopt(c, CURLOPT_WRITEDATA, buf);
299 308