~myers-1/pyopenssl/npn

« back to all changes in this revision

Viewing changes to OpenSSL/ssl/context.c

  • Committer: Jean-Paul Calderone
  • Date: 2011-09-08 22:44:31 UTC
  • mfrom: (156.2.7 ctx_set_mode)
  • Revision ID: exarkun@divmod.com-20110908224431-9hxcmjzfhzqyglxh
Add Context.set_mode, MODE_RELEASE_BUFFERS, and OP_NO_COMPRESSION

Show diffs side-by-side

added added

removed removed

Lines of Context:
1108
1108
    return PyLong_FromLong(SSL_CTX_set_options(self->ctx, options));
1109
1109
}
1110
1110
 
 
1111
static char ssl_Context_set_mode_doc[] = "\n\
 
1112
Add modes via bitmask. Modes set before are not cleared!\n\
 
1113
\n\
 
1114
@param mode: The mode to add.\n\
 
1115
@return: The new mode bitmask.\n\
 
1116
";
 
1117
static PyObject *
 
1118
ssl_Context_set_mode(ssl_ContextObj *self, PyObject *args) {
 
1119
    long mode;
 
1120
 
 
1121
    if (!PyArg_ParseTuple(args, "l:set_mode", &mode)) {
 
1122
        return NULL;
 
1123
    }
 
1124
 
 
1125
    return PyLong_FromLong(SSL_CTX_set_mode(self->ctx, mode));
 
1126
}
 
1127
 
1111
1128
static char ssl_Context_set_tlsext_servername_callback_doc[] = "\n\
1112
1129
Specify a callback function to be called when clients specify a server name.\n\
1113
1130
\n\
1174
1191
    ADD_METHOD(set_app_data),
1175
1192
    ADD_METHOD(get_cert_store),
1176
1193
    ADD_METHOD(set_options),
 
1194
    ADD_METHOD(set_mode),
1177
1195
    ADD_METHOD(set_tlsext_servername_callback),
1178
1196
    { NULL, NULL }
1179
1197
};