I am having trouble getting an https connection to work through a proxy.

My understanding is that I can just send the CONNECT command to the proxy, then 
setup the ssl stuff as usual.  But it doesn't work.  I don't see any errors, but 
I also don't get any https back from the remote site.  Any suggestions?

Or if anyone has a reference to some code that does, a FAQ entry I missed, 
whatever, that'd be great.

The code I include work fine if I under USE_PROXY.

Thanks,
Jamey

-------------------------------- Cut Here --------------------------------

  char proxy[] = "129.101.93.3";
  char machine[] = "www.someplace.com";

  SSL_load_error_strings();
  SSLeay_add_all_algorithms();

  ctx = SSL_CTX_new(SSLv23_client_method());
  CHK_NULL(ctx);

  sd = socket(AF_INET, SOCK_STREAM, 0);
  CHK_ERR(sd, "socket");

  memset (&sa, '\0', sizeof(sa));
  sa.sin_family      = AF_INET;

#ifdef USE_PROXY
  if ((sa.sin_addr.s_addr = inet_addr(proxy)) == -1)
    printf("Error, inet_addr returned -1\n");

  sa.sin_port        = htons(8080);   /* Server Port number */
#else
  sa.sin_addr.s_addr = ip;           /* Server IP */
  sa.sin_port        = htons(443);   /* Server Port number */
#endif

  err = connect(sd, (struct sockaddr*)&sa, sizeof(sa));
  CHK_ERR(err, "connect");

  ssl = SSL_new(ctx);
  CHK_NULL(ssl);

#ifdef USE_PROXY
  sprintf(line, "CONNECT %s:443 HTTP/1.1\r\nUser-Agent: BBNET (compatible; Blah;
 Blah)\r\n\r\n", machine);
  printf("%s", line);
  write(sd, line, strlen(line), 0);
  len = read(sd, line, MAXLINE);
  line[len] = '\0';
  printf("%s", line);
#endif

  SSL_set_fd(ssl, sd);

  err = SSL_connect(ssl);
  CHK_SSL(err);


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to