26d25 < static int proxy = 0; 32c31 < "Usage: [-v] [-p:] [key=value] uploadfield [file] URL\n" --- > "Usage: [-v] [key=value] uploadfield [file] URL\n" 49,50c48 < char * proxhost = "unset"; < int port = 0, proxport = 0, ok = 500; --- > int port = 0, ok = 500; 54c52 < while ((ch = getopt(argc, argv, "vp:" )) != -1) --- > while ((ch = getopt(argc, argv, "v")) != -1) 59,71d56 < case 'p': < proxy++; < /* Take the proxy option and get host and port. < */ < proxhost = optarg; < if ((p = index(proxhost,':'))) { < *p = '\0'; < proxport = atoi(++p); < } else { < proxport = 80; < } < printf("proxy is '%s' port '%d'\n",proxhost,proxport); < break; 78,79c63,64 < < if (argc < 2) --- > > if (argc < 2) 149,159d133 < if (proxy) { < if (inet_aton(proxhost,&ip) == 0) { < struct hostent * h; < if (verbose) < printf("Resolving %s into IP address\n",proxhost); < if ((h = gethostbyname(proxhost)) == NULL) < pdie("Gethostbyname() failed for host."); < ip.s_addr = *(in_addr_t *) h->h_addr; < }; < } else { < if ((s = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) == -1) 168d141 < }; 183,184c156 < if (proxy) { < bzero((void*)&dst,sizeof(dst)); --- > bzero((void*)&dst,sizeof(dst)); 186,194c158 < dst.sin_port = htons(proxport); < dst.sin_addr = ip; < < if (verbose) < printf("Connecting to %s, port %d\n",inet_ntoa(ip),proxport); < } else { < bzero((void*)&dst,sizeof(dst)); < dst.sin_family = AF_INET; < dst.sin_port = htons(port); --- > dst.sin_port = htons(port); 199,201c163,164 < }; < < if (connect(s, ( struct sockaddr *) &dst, sizeof (dst)) != 0) --- > > if (connect(s, ( struct sockaddr *) &dst, sizeof (dst)) != 0) 209c172 < "POST http://%s%s HTTP/1.0\r\n" --- > "POST %s HTTP/1.0\r\n" 216c179 < ,host,path,host,tag,1024*1024,tag); --- > ,path,host,tag,1024*1024,tag);