Project

General

Profile

Bug #1499 ยป extforward-proto.patch

Here is an incomplete and ugly patch which solves the problem for fastcgi by introducing an is_proxy_ssl variable. -- Thomas Steinacher <tom - Anonymous, 2007-12-31 19:48

View differences:

lighttpd-1.4.18/src/base.h 2007-12-31 20:42:02.000000000 +0100
515 515
#ifdef USE_OPENSSL
516 516
       SSL_CTX *ssl_ctx;
517 517
#endif
518
       unsigned short is_proxy_ssl;
518 519
} server_socket;
519 520

  
520 521
typedef struct {
lighttpd-1.4.18/src/mod_extforward.c 2007-12-31 20:41:59.000000000 +0100
382 382

  
383 383
               struct addrinfo *addrs_left;
384 384

  
385
        data_string *forwarded_proto = NULL;
386
        server_socket *srv_sock = con->srv_socket;
387
        forwarded_proto = (data_string *) array_get_element(con->request.headers,"X-Forwarded-Proto");
388

  
389
        if (forwarded_proto && !strcmp(forwarded_proto->value->ptr, "https"))
390
            srv_sock->is_proxy_ssl = 1;
391
        else
392
            srv_sock->is_proxy_ssl = 0;
393

  
385 394
               if (con->conf.log_request_handling) {
386 395
                       log_error_write(srv, __FILE__, __LINE__, "ss",
387 396
                                       "using address:", real_remote_addr);
lighttpd-1.4.18/src/mod_fastcgi.c 2007-12-31 20:42:09.000000000 +0100
2045 2045
       s = get_http_version_name(con->request.http_version);
2046 2046
       FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SERVER_PROTOCOL"), s, strlen(s)),con)
2047 2047

  
2048
#ifdef USE_OPENSSL
2049
       if (srv_sock->is_ssl) {
2048
       if (srv_sock->is_ssl || srv_sock->is_proxy_ssl) {
2050 2049
               FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("HTTPS"), CONST_STR_LEN("on")),con)
2051 2050
       }
2052
#endif
2053 2051

  
2054 2052

  
2055 2053
       FCGI_ENV_ADD_CHECK(fcgi_env_add_request_headers(srv, con, p), con);
    (1-1/1)