Fossil

Check-in [491e6d30]
Login

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

Overview
Comment:Slight modularization when building the request to establish https tunnel over proxy.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | jan-httpsproxytunnel
Files: files | file ages | folders
SHA1:491e6d30fc294810188027e011195a2911c13097
User & Date: jan 2013-10-21 17:21:33
Context
2013-10-26
22:51
Accept return codes 2xx when establishing tunnel. check-in: a6720183 user: jan tags: jan-httpsproxytunnel
2013-10-21
17:21
Slight modularization when building the request to establish https tunnel over proxy. check-in: 491e6d30 user: jan tags: jan-httpsproxytunnel
17:00
Merge from trunk. check-in: f3037e17 user: jan tags: jan-httpsproxytunnel
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/http_ssl.c.

172
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
198
199
200
201
202
203
204
205
206
void ssl_close(void){
  if( iBio!=NULL ){
    (void)BIO_reset(iBio);
    BIO_free_all(iBio);
  }
}


static int establish_proxy_tunnel(BIO *bio){
  int rc, httpVerMin;
  char *connStr, *bbuf;
  Blob reply;
  int done=0,end=0;
  if( !g.urlProxyAuth ){

    connStr = mprintf("CONNECT %s:%d HTTP/1.1\r\n"
          "Host: %s\r\n"
          "Proxy-Connection: keep-alive\r\n",
          "User-Agent: Fossil/" RELEASE_VERSION "\r\n\r\n",
          g.urlHostname, g.proxyOrigPort, g.urlHostname);

  }else{
    connStr = mprintf("CONNECT %s:%d HTTP/1.1\r\n"
          "Host: %s\r\n"

          "Proxy-Connection: keep-alive\r\n"
          "User-Agent: Fossil/" RELEASE_VERSION "\r\n"

          "Proxy-Authorization: %s\r\n\r\n",
          g.urlHostname, g.proxyOrigPort, g.urlHostname, g.urlProxyAuth);
  }
  BIO_write(bio, connStr, strlen(connStr));
  free(connStr);

  /* Wait for end of reply */
  blob_zero(&reply);
  do{
    int len;
    char buf[256];
    len = BIO_read(bio, buf, sizeof(buf));







>


|
|

<
>
|
<
|
<
|
>
|
<
<
>
|
|
>
|
|
<
<
<







172
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
198
199
200
201
202
203
void ssl_close(void){
  if( iBio!=NULL ){
    (void)BIO_reset(iBio);
    BIO_free_all(iBio);
  }
}

/* See RFC2817 for details */
static int establish_proxy_tunnel(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_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);




  /* Wait for end of reply */
  blob_zero(&reply);
  do{
    int len;
    char buf[256];
    len = BIO_read(bio, buf, sizeof(buf));