Fossil SCM

Don't use global data any more in establish_proxy_tunnel()

jan.nijtmans 2014-01-29 09:36 UTC jan-httpsproxytunnel
Commit 12e917a1cd150b98ae24d7311ec5a227307d7cd4
1 file changed +7 -7
+7 -7
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -175,21 +175,21 @@
175175
BIO_free_all(iBio);
176176
}
177177
}
178178
179179
/* See RFC2817 for details */
180
-static int establish_proxy_tunnel(BIO *bio){
180
+static int establish_proxy_tunnel(UrlData *pUrlData, BIO *bio){
181181
int rc, httpVerMin;
182182
char *bbuf;
183183
Blob snd, reply;
184184
int done=0,end=0;
185185
blob_zero(&snd);
186
- blob_appendf(&snd, "CONNECT %s:%d HTTP/1.1\r\n", g.urlHostname,
187
- g.proxyOrigPort);
188
- blob_appendf(&snd, "Host: %s:%d\r\n", g.urlHostname, g.proxyOrigPort);
189
- if( g.urlProxyAuth ){
190
- blob_appendf(&snd, "Proxy-Authorization: %s\r\n", g.urlProxyAuth);
186
+ blob_appendf(&snd, "CONNECT %s:%d HTTP/1.1\r\n", pUrlData->hostname,
187
+ pUrlData->proxyOrigPort);
188
+ blob_appendf(&snd, "Host: %s:%d\r\n", pUrlData->hostname, pUrlData->proxyOrigPort);
189
+ if( pUrlData->proxyAuth ){
190
+ blob_appendf(&snd, "Proxy-Authorization: %s\r\n", pUrlData->proxyAuth);
191191
}
192192
blob_append(&snd, "Proxy-Connection: keep-alive\r\n", -1);
193193
blob_append(&snd, "User-Agent: Fossil/" RELEASE_VERSION "\r\n", -1);
194194
blob_append(&snd, "\r\n", 2);
195195
BIO_write(bio, blob_buffer(&snd), blob_size(&snd));
@@ -262,11 +262,11 @@
262262
ssl_set_errmsg("SSL: cannot connect to proxy %s:%d (%s)",
263263
pUrlData->name, pUrlData->port, ERR_reason_error_string(ERR_get_error()));
264264
ssl_close();
265265
return 1;
266266
}
267
- rc = establish_proxy_tunnel(sBio);
267
+ rc = establish_proxy_tunnel(pUrlData, sBio);
268268
if( rc<200||rc>299 ){
269269
ssl_set_errmsg("SSL: proxy connect failed with HTTP status code %d", rc);
270270
return 1;
271271
}
272272
273273
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -175,21 +175,21 @@
175 BIO_free_all(iBio);
176 }
177 }
178
179 /* See RFC2817 for details */
180 static int establish_proxy_tunnel(BIO *bio){
181 int rc, httpVerMin;
182 char *bbuf;
183 Blob snd, reply;
184 int done=0,end=0;
185 blob_zero(&snd);
186 blob_appendf(&snd, "CONNECT %s:%d HTTP/1.1\r\n", g.urlHostname,
187 g.proxyOrigPort);
188 blob_appendf(&snd, "Host: %s:%d\r\n", g.urlHostname, g.proxyOrigPort);
189 if( g.urlProxyAuth ){
190 blob_appendf(&snd, "Proxy-Authorization: %s\r\n", g.urlProxyAuth);
191 }
192 blob_append(&snd, "Proxy-Connection: keep-alive\r\n", -1);
193 blob_append(&snd, "User-Agent: Fossil/" RELEASE_VERSION "\r\n", -1);
194 blob_append(&snd, "\r\n", 2);
195 BIO_write(bio, blob_buffer(&snd), blob_size(&snd));
@@ -262,11 +262,11 @@
262 ssl_set_errmsg("SSL: cannot connect to proxy %s:%d (%s)",
263 pUrlData->name, pUrlData->port, ERR_reason_error_string(ERR_get_error()));
264 ssl_close();
265 return 1;
266 }
267 rc = establish_proxy_tunnel(sBio);
268 if( rc<200||rc>299 ){
269 ssl_set_errmsg("SSL: proxy connect failed with HTTP status code %d", rc);
270 return 1;
271 }
272
273
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -175,21 +175,21 @@
175 BIO_free_all(iBio);
176 }
177 }
178
179 /* See RFC2817 for details */
180 static int establish_proxy_tunnel(UrlData *pUrlData, BIO *bio){
181 int rc, httpVerMin;
182 char *bbuf;
183 Blob snd, reply;
184 int done=0,end=0;
185 blob_zero(&snd);
186 blob_appendf(&snd, "CONNECT %s:%d HTTP/1.1\r\n", pUrlData->hostname,
187 pUrlData->proxyOrigPort);
188 blob_appendf(&snd, "Host: %s:%d\r\n", pUrlData->hostname, pUrlData->proxyOrigPort);
189 if( pUrlData->proxyAuth ){
190 blob_appendf(&snd, "Proxy-Authorization: %s\r\n", pUrlData->proxyAuth);
191 }
192 blob_append(&snd, "Proxy-Connection: keep-alive\r\n", -1);
193 blob_append(&snd, "User-Agent: Fossil/" RELEASE_VERSION "\r\n", -1);
194 blob_append(&snd, "\r\n", 2);
195 BIO_write(bio, blob_buffer(&snd), blob_size(&snd));
@@ -262,11 +262,11 @@
262 ssl_set_errmsg("SSL: cannot connect to proxy %s:%d (%s)",
263 pUrlData->name, pUrlData->port, ERR_reason_error_string(ERR_get_error()));
264 ssl_close();
265 return 1;
266 }
267 rc = establish_proxy_tunnel(pUrlData, sBio);
268 if( rc<200||rc>299 ){
269 ssl_set_errmsg("SSL: proxy connect failed with HTTP status code %d", rc);
270 return 1;
271 }
272
273

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button