Search in sources :

Example 1 with SettingsParameter

use of com.webpieces.http2.api.dto.lowlevel.lib.SettingsParameter in project webpieces by deanhiller.

the class RemoteSettingsManagement method applyRemoteSettings.

public void applyRemoteSettings(SettingsFrame settings) {
    for (Http2Setting setting : settings.getSettings()) {
        SettingsParameter key = setting.getKnownName();
        if (key == null)
            // TODO: forward unknown settings to clients
            continue;
        // unknown setting so skip it
        apply(key, setting.getValue());
    }
}
Also used : SettingsParameter(com.webpieces.http2.api.dto.lowlevel.lib.SettingsParameter) Http2Setting(com.webpieces.http2.api.dto.lowlevel.lib.Http2Setting)

Example 2 with SettingsParameter

use of com.webpieces.http2.api.dto.lowlevel.lib.SettingsParameter in project webpieces by deanhiller.

the class SettingsMarshaller method validate.

private void validate(Http2Setting http2Setting) {
    SettingsParameter key = SettingsParameter.lookup(http2Setting.getId());
    long value = http2Setting.getValue();
    if (key == null)
        // unknown setting
        return;
    switch(key) {
        case SETTINGS_ENABLE_PUSH:
            if (value != 0 && value != 1)
                throw new ConnectionException(CancelReasonCode.INVALID_SETTING, 0, "push setting must be 0 or 1 but was=" + value);
            break;
        case SETTINGS_INITIAL_WINDOW_SIZE:
            validateWindowSize(value);
            break;
        case SETTINGS_MAX_FRAME_SIZE:
            validateMaxFrameSize(value);
            break;
        case SETTINGS_HEADER_TABLE_SIZE:
        case SETTINGS_MAX_CONCURRENT_STREAMS:
        case SETTINGS_MAX_HEADER_LIST_SIZE:
            break;
        default:
            throw new IllegalArgumentException("case statement missing new setting=" + key + " with value=" + value);
    }
}
Also used : SettingsParameter(com.webpieces.http2.api.dto.lowlevel.lib.SettingsParameter) ConnectionException(com.webpieces.http2.api.dto.error.ConnectionException)

Aggregations

SettingsParameter (com.webpieces.http2.api.dto.lowlevel.lib.SettingsParameter)2 ConnectionException (com.webpieces.http2.api.dto.error.ConnectionException)1 Http2Setting (com.webpieces.http2.api.dto.lowlevel.lib.Http2Setting)1