147
151
cpair = PyString_AS_STRING(pair);
149
153
len = strlen(cpair);
154
/* PYTHON 2.5: 'PyString_FromStringAndSize' uses Py_ssize_t for input parameters */
150
155
key = PyString_FromStringAndSize(NULL, len);
158
/* PYTHON 2.5: 'PyString_FromStringAndSize' uses Py_ssize_t for input parameters */
153
159
val = PyString_FromStringAndSize(NULL, len);
184
190
ap_unescape_url(ckey);
185
191
ap_unescape_url(cval);
193
/* PYTHON 2.5: '_PyString_Resize' uses Py_ssize_t for input parameters */
187
194
_PyString_Resize(&key, strlen(ckey));
195
/* PYTHON 2.5: '_PyString_Resize' uses Py_ssize_t for input parameters */
188
196
_PyString_Resize(&val, strlen(cval));
190
198
if (key && val) {
250
259
char *cpair, *ckey, *cval;
251
260
int plen, j, p, k, v;
262
/* PYTHON 2.5: 'PyString_FromStringAndSize' uses Py_ssize_t for input parameters */
253
263
pair = PyString_FromStringAndSize(NULL, len);
254
264
if (pair == NULL)
284
/* PYTHON 2.5: '_PyString_Resize' uses Py_ssize_t for input parameters */
274
285
_PyString_Resize(&pair, j);
275
286
cpair = PyString_AS_STRING(pair);
277
288
/* split the "abc=def" pair */
278
289
plen = strlen(cpair);
290
/* PYTHON 2.5: 'PyString_FromStringAndSize' uses Py_ssize_t for input parameters */
279
291
key = PyString_FromStringAndSize(NULL, plen);
294
/* PYTHON 2.5: 'PyString_FromStringAndSize' uses Py_ssize_t for input parameters */
282
295
val = PyString_FromStringAndSize(NULL, plen);
312
325
ap_unescape_url(ckey);
313
326
ap_unescape_url(cval);
328
/* PYTHON 2.5: '_PyString_Resize' uses Py_ssize_t for input parameters */
315
329
_PyString_Resize(&key, strlen(ckey));
330
/* PYTHON 2.5: '_PyString_Resize' uses Py_ssize_t for input parameters */
316
331
_PyString_Resize(&val, strlen(cval));
318
333
if (key && val) {
486
501
index = (hash % (glb->nlocks-1)+1);
489
// ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s,
490
// "_global_trylock at index %d from pid %d", index, getpid());
505
* ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s,
506
* "_global_trylock at index %d from pid %d", index, getpid());
491
508
Py_BEGIN_ALLOW_THREADS
492
509
rv = apr_global_mutex_trylock(glb->g_locks[index]);
493
510
Py_END_ALLOW_THREADS
495
512
if (rv == APR_SUCCESS) {
496
// ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s,
497
// "_global_trylock DONE at index %d from pid %d", index, getpid());
514
* ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s,
515
* "_global_trylock DONE at index %d from pid %d", index, getpid());
498
517
Py_INCREF(Py_True);
501
520
else if(APR_STATUS_IS_EBUSY(rv)) {
502
// ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s,
503
// "_global_trylock BUSY at index %d from pid %d", index, getpid());
522
* ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s,
523
* "_global_trylock BUSY at index %d from pid %d", index, getpid());
504
525
Py_INCREF(Py_False);
707
** mp_stat(fname, wanted)
709
* Wrapper for apr_stat().
712
static PyObject *mp_stat(PyObject *self, PyObject *args)
715
apr_int32_t wanted = 0;
719
if (! PyArg_ParseTuple(args, "si", &fname, &wanted))
722
finfo = (finfoobject *)MpFinfo_New();
724
fname = apr_pstrdup(finfo->pool, fname);
726
result = apr_stat(finfo->finfo, fname, wanted, finfo->pool);
728
if (result == APR_INCOMPLETE || result == APR_SUCCESS)
729
return (PyObject *)finfo;
731
if (result == APR_ENOENT)
732
return (PyObject *)finfo;
736
PyErr_SetObject(PyExc_OSError,
737
Py_BuildValue("is", result, "apr_stat() failed"));
685
742
/* methods of _apache */
686
743
struct PyMethodDef _apache_module_methods[] = {
687
744
{"config_tree", (PyCFunction)config_tree, METH_NOARGS},
692
749
{"server_root", (PyCFunction)server_root, METH_NOARGS},
693
750
{"register_cleanup", (PyCFunction)register_cleanup, METH_VARARGS},
694
751
{"exists_config_define", (PyCFunction)exists_config_define, METH_VARARGS},
752
{"stat", (PyCFunction)mp_stat, METH_VARARGS},
695
753
{"_global_lock", (PyCFunction)_global_lock, METH_VARARGS},
696
754
{"_global_trylock", (PyCFunction)_global_trylock, METH_VARARGS},
697
755
{"_global_unlock", (PyCFunction)_global_unlock, METH_VARARGS},
723
781
PyDict_SetItemString(d, "table", (PyObject *)&MpTable_Type);
783
o = PyInt_FromLong(AP_CONN_UNKNOWN);
784
PyDict_SetItemString(d, "AP_CONN_UNKNOWN", o);
786
o = PyInt_FromLong(AP_CONN_CLOSE);
787
PyDict_SetItemString(d, "AP_CONN_CLOSE", o);
789
o = PyInt_FromLong(AP_CONN_KEEPALIVE);
790
PyDict_SetItemString(d, "AP_CONN_KEEPALIVE", o);
793
o = PyInt_FromLong(APR_NOFILE);
794
PyDict_SetItemString(d, "APR_NOFILE", o);
796
o = PyInt_FromLong(APR_REG);
797
PyDict_SetItemString(d, "APR_REG", o);
799
o = PyInt_FromLong(APR_DIR);
800
PyDict_SetItemString(d, "APR_DIR", o);
802
o = PyInt_FromLong(APR_CHR);
803
PyDict_SetItemString(d, "APR_CHR", o);
805
o = PyInt_FromLong(APR_BLK);
806
PyDict_SetItemString(d, "APR_BLK", o);
808
o = PyInt_FromLong(APR_PIPE);
809
PyDict_SetItemString(d, "APR_PIPE", o);
811
o = PyInt_FromLong(APR_LNK);
812
PyDict_SetItemString(d, "APR_LNK", o);
814
o = PyInt_FromLong(APR_SOCK);
815
PyDict_SetItemString(d, "APR_SOCK", o);
817
o = PyInt_FromLong(APR_UNKFILE);
818
PyDict_SetItemString(d, "APR_UNKFILE", o);
727
822
PyObject *get_ServerReturn()