Changeset 1227:a79bf84726af in nginx-tests


Ignore:
Timestamp:
10/12/17 13:55:14 (2 months ago)
Author:
Sergey Kandaurov <pluknet@…>
Branch:
default
Message:

Tests: connection upgrade in subrequests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proxy_upgrade.t

    r1155 r1227  
    2828select STDOUT; $| = 1;
    2929
    30 my $t = Test::Nginx->new()->has(qw/http proxy/)
    31         ->write_file_expand('nginx.conf', <<'EOF')->plan(30);
     30my $t = Test::Nginx->new()->has(qw/http proxy ssi/)
     31        ->write_file_expand('nginx.conf', <<'EOF')->plan(31);
    3232
    3333%%TEST_GLOBALS%%
     
    5656            send_timeout 2s;
    5757        }
     58
     59        location /ssi.html {
     60            ssi on;
     61        }
    5862    }
    5963}
     
    6266
    6367my $d = $t->testdir();
     68
     69$t->write_file('ssi.html', '<!--#include virtual="/upgrade" --> SEE-THIS');
    6470
    6571$t->run_daemon(\&upgrade_fake_daemon);
     
    129135$s = upgrade_connect(noheader => 1);
    130136ok(!$s, "handshake noupgrade");
     137
     138# connection upgrade in subrequests shouldn't cause a segfault
     139
     140SKIP: {
     141skip 'leaves coredump', 1 unless $t->has_version('1.13.7')
     142        or $ENV{TEST_NGINX_UNSAFE};
     143
     144$s = upgrade_connect(uri => '/ssi.html');
     145ok(!$s, "handshake in subrequests");
     146
     147}
    131148
    132149# bytes sent on upgraded connection
     
    154171        # send request, $h->to_string
    155172
    156         my $buf = "GET / HTTP/1.1" . CRLF
     173        my $uri = $opts{uri} || '/';
     174
     175        my $buf = "GET $uri HTTP/1.1" . CRLF
    157176                . "Host: localhost" . CRLF
    158177                . ($opts{noheader} ? '' : "Upgrade: foo" . CRLF)
Note: See TracChangeset for help on using the changeset viewer.