~ubuntu-branches/ubuntu/raring/curl/raring-updates

« back to all changes in this revision

Viewing changes to lib/asyn-thread.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2011-11-13 21:07:32 UTC
  • mto: (3.6.1 experimental) (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 55.
  • Revision ID: package-import@ubuntu.com-20111113210732-bk5n25x2tu7aplur
Tags: upstream-7.22.0
ImportĀ upstreamĀ versionĀ 7.22.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include "setup.h"
24
24
 
25
 
#include <string.h>
26
 
#include <errno.h>
27
 
 
28
25
#ifdef HAVE_SYS_SOCKET_H
29
26
#include <sys/socket.h>
30
27
#endif
37
34
#ifdef HAVE_ARPA_INET_H
38
35
#include <arpa/inet.h>
39
36
#endif
40
 
#ifdef HAVE_STDLIB_H
41
 
#include <stdlib.h>     /* required for free() prototypes */
42
 
#endif
43
37
#ifdef HAVE_UNISTD_H
44
38
#include <unistd.h>     /* for the close() proto */
45
39
#endif
46
40
#ifdef __VMS
47
41
#include <in.h>
48
42
#include <inet.h>
49
 
#include <stdlib.h>
50
43
#endif
51
44
 
52
45
#if defined(USE_THREADS_POSIX)
421
414
   socket error string function can be used for this pupose. */
422
415
static const char *gai_strerror(int ecode)
423
416
{
424
 
  switch (ecode){
 
417
  switch (ecode) {
425
418
  case EAI_AGAIN:
426
419
    return "The name could not be resolved at this time";
427
420
  case EAI_BADFLAGS:
633
626
                                         int *waitp)
634
627
{
635
628
  struct addrinfo hints;
 
629
  struct in_addr in;
636
630
  Curl_addrinfo *res;
637
631
  int error;
638
632
  char sbuf[NI_MAXSERV];
639
633
  int pf = PF_INET;
 
634
#ifdef CURLRES_IPV6
 
635
  struct in6_addr in6;
 
636
#endif /* CURLRES_IPV6 */
640
637
 
641
638
  *waitp = 0; /* default to synchronous response */
642
639
 
643
 
#ifndef CURLRES_IPV4
 
640
  /* First check if this is an IPv4 address string */
 
641
  if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
 
642
    /* This is a dotted IP address 123.123.123.123-style */
 
643
    return Curl_ip2addr(AF_INET, &in, hostname, port);
 
644
 
 
645
#ifdef CURLRES_IPV6
 
646
  /* check if this is an IPv6 address string */
 
647
  if(Curl_inet_pton (AF_INET6, hostname, &in6) > 0)
 
648
    /* This is an IPv6 address literal */
 
649
    return Curl_ip2addr(AF_INET6, &in6, hostname, port);
 
650
 
644
651
  /*
645
652
   * Check if a limited name resolve has been requested.
646
653
   */
660
667
    /* the stack seems to be a non-ipv6 one */
661
668
    pf = PF_INET;
662
669
 
663
 
#endif /* !CURLRES_IPV4 */
 
670
#endif /* CURLRES_IPV6 */
664
671
 
665
672
  memset(&hints, 0, sizeof(hints));
666
673
  hints.ai_family = pf;