Fossil

Check-in [12e917a1cd]
Login

Check-in [12e917a1cd]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Don't use global data any more in establish_proxy_tunnel()
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | jan-httpsproxytunnel
Files: files | file ages | folders
SHA1: 12e917a1cd150b98ae24d7311ec5a227307d7cd4
User & Date: jan.nijtmans 2014-01-29 09:36:57.243
Context
2014-02-05
14:59
Use hostname in stead of proxy name in certificate handling. Attempt to fix the problem described here: [https://www.mail-archive.com/fossil-users@lists.fossil-scm.org/msg13898.html] ... (check-in: 6673f163ea user: jan.nijtmans tags: jan-httpsproxytunnel)
2014-01-29
09:36
Don't use global data any more in establish_proxy_tunnel() ... (check-in: 12e917a1cd user: jan.nijtmans tags: jan-httpsproxytunnel)
09:22
merge trunk ... (check-in: 1f1848dd07 user: jan.nijtmans tags: jan-httpsproxytunnel)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/http_ssl.c.
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
188
189
190





191
192
193
194
195
196
197
173
174
175
176
177
178
179

180
181
182
183
184
185





186
187
188
189
190
191
192
193
194
195
196
197







-
+





-
-
-
-
-
+
+
+
+
+







  if( iBio!=NULL ){
    (void)BIO_reset(iBio);
    BIO_free_all(iBio);
  }
}

/* See RFC2817 for details */
static int establish_proxy_tunnel(BIO *bio){
static int establish_proxy_tunnel(UrlData *pUrlData, BIO *bio){
  int rc, httpVerMin;
  char *bbuf;
  Blob snd, reply;
  int done=0,end=0;
  blob_zero(&snd);
  blob_appendf(&snd, "CONNECT %s:%d HTTP/1.1\r\n", g.urlHostname,
      g.proxyOrigPort);
  blob_appendf(&snd, "Host: %s:%d\r\n", g.urlHostname, g.proxyOrigPort);
  if( g.urlProxyAuth ){
    blob_appendf(&snd, "Proxy-Authorization: %s\r\n", g.urlProxyAuth);
  blob_appendf(&snd, "CONNECT %s:%d HTTP/1.1\r\n", pUrlData->hostname,
      pUrlData->proxyOrigPort);
  blob_appendf(&snd, "Host: %s:%d\r\n", pUrlData->hostname, pUrlData->proxyOrigPort);
  if( pUrlData->proxyAuth ){
    blob_appendf(&snd, "Proxy-Authorization: %s\r\n", pUrlData->proxyAuth);
  }
  blob_append(&snd, "Proxy-Connection: keep-alive\r\n", -1);
  blob_append(&snd, "User-Agent: Fossil/" RELEASE_VERSION "\r\n", -1);
  blob_append(&snd, "\r\n", 2);
  BIO_write(bio, blob_buffer(&snd), blob_size(&snd));
  blob_reset(&snd);

260
261
262
263
264
265
266
267

268
269
270
271
272
273
274
260
261
262
263
264
265
266

267
268
269
270
271
272
273
274







-
+







    free(connStr);
    if( BIO_do_connect(sBio)<=0 ){
      ssl_set_errmsg("SSL: cannot connect to proxy %s:%d (%s)",
            pUrlData->name, pUrlData->port, ERR_reason_error_string(ERR_get_error()));
      ssl_close();
      return 1;
    }
    rc = establish_proxy_tunnel(sBio);
    rc = establish_proxy_tunnel(pUrlData, sBio);
    if( rc<200||rc>299 ){
      ssl_set_errmsg("SSL: proxy connect failed with HTTP status code %d", rc);
      return 1;
    }

    pUrlData->path = pUrlData->proxyUrlPath;