Changeset 4fe52e6 in mod_gnutls


Ignore:
Timestamp:
Jan 23, 2020, 8:02:50 AM (9 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master, proxy-ticket
Children:
4f2c988
Parents:
f94938c
Message:

Use gnutls-cli inline command to test TLS session resumption

This makes it possible to resume at any point during the connection,
not just at the start (before any request) like "--resume" does.

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/tests.py

    rf94938c r4fe52e6  
    180180                elif type(act) is TestReq10:
    181181                    act.run(command, timeout, conn_log, response_log)
     182                elif type(act) is Resume:
     183                    act.run(conn, command)
    182184                else:
    183185                    raise TypeError(f'Unsupported action requested: {act!r}')
     
    424426
    425427
     428class Resume(yaml.YAMLObject):
     429    """Test action to close and resume the TLS session.
     430
     431    Send the gnutls-cli inline command "^resume^" to close and resume
     432    the TLS session. "inline-commands" must be present in
     433    gnutls_params of the parent connection. This action does not need
     434    any arguments, but you must specify with an explicitly empty
     435    dictionary for YAML parsing to work, like this:
     436
     437      !resume {}
     438
     439    """
     440    yaml_tag = '!resume'
     441    def run(self, conn, command):
     442        if not '--inline-commands' in command:
     443            raise ValueError('gnutls_params must include "inline-commands" '
     444                             'to use the resume action!')
     445        if not type(conn) is HTTPSubprocessConnection:
     446            raise TypeError('Resume action works only with '
     447                            'HTTPSubprocessConnection.')
     448        conn.sock.send(b'^resume^\n')
     449
     450
     451
    426452def filter_cert_log(in_stream, out_stream):
    427453    """Filter to stop an erroneous gnutls-cli log message.
  • test/tests/14_resume_session/test.yml

    rf94938c r4fe52e6  
    22gnutls_params:
    33  - x509cafile=authority/x509.pem
    4   - resume
     4  - inline-commands
    55actions:
    66  - !request
     
    1111        exactly: |
    1212          test
     13  - !resume {}
     14  - !request
     15    path: /test.txt
     16    expect:
     17      status: 200
     18      body:
     19        exactly: |
     20          test
Note: See TracChangeset for help on using the changeset viewer.