You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by gr...@apache.org on 2003/11/10 19:54:45 UTC

cvs commit: httpd-python/src/include mod_python.h mpversion.h

grisha      2003/11/10 10:54:45

  Modified:    Doc      Tag: branch-3-0-3 modpython.tex
               src      Tag: branch-3-0-3 _apachemodule.c
               src/include Tag: branch-3-0-3 mod_python.h mpversion.h
  Log:
  Fix the http://myserver/?& parse_qsl() segfault reported by Matt Hoskins
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.20.2.1  +2 -2      httpd-python/Doc/modpython.tex
  
  Index: modpython.tex
  ===================================================================
  RCS file: /home/cvs/httpd-python/Doc/modpython.tex,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- modpython.tex	7 Mar 2003 20:14:23 -0000	1.20
  +++ modpython.tex	10 Nov 2003 18:54:45 -0000	1.20.2.1
  @@ -11,8 +11,8 @@
   }
   
   % do not mess with the 2 lines below, they are written by make dist
  -\release{3.0.3}
  -\date{March 07, 2003}
  +\release{3.0.4}
  +\date{November 10, 2003}
   
   \makeindex			% tell \index to actually write the .idx file
   \makemodindex			% If this contains a lot of module sections.
  
  
  
  No                   revision
  No                   revision
  1.20.2.1  +39 -26    httpd-python/src/_apachemodule.c
  
  Index: _apachemodule.c
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/_apachemodule.c,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- _apachemodule.c	8 Nov 2002 00:15:11 -0000	1.20
  +++ _apachemodule.c	10 Nov 2003 18:54:45 -0000	1.20.2.1
  @@ -153,10 +153,12 @@
   	    i++;
   	    j++;
   	}
  -	_PyString_Resize(&pair, j);
  -	cpair = PyString_AS_STRING(pair);
  +        if (j) {
  +            _PyString_Resize(&pair, j);
  +            if (pair)
  +                PyList_Append(pairs, pair);
  +        }
   
  -	PyList_Append(pairs, pair);
   	Py_DECREF(pair);
   	i++;
       }
  @@ -221,26 +223,29 @@
   	    ap_unescape_url(cval);
   
   	    _PyString_Resize(&key, strlen(ckey));
  -	    ckey = PyString_AS_STRING(key);
   	    _PyString_Resize(&val, strlen(cval));
  -	    cval = PyString_AS_STRING(val);
  -	
  -	    if (PyMapping_HasKeyString(dict, ckey)) {
  -		PyObject *list;
  -		list = PyDict_GetItem(dict, key);
  -		PyList_Append(list, val);
  -		/* PyDict_GetItem is a borrowed ref, no decref */
  -	    }
  -	    else {
  -		PyObject *list;
  -		list = Py_BuildValue("[O]", val);
  -		PyDict_SetItem(dict, key, list);
  -		Py_DECREF(list);
  -	    }
  -	}
   
  -	Py_DECREF(key);
  -	Py_DECREF(val);
  +            if (key && val) {
  +
  +                ckey = PyString_AS_STRING(key);
  +                cval = PyString_AS_STRING(val);
  +	
  +                if (PyMapping_HasKeyString(dict, ckey)) {
  +                    PyObject *list;
  +                    list = PyDict_GetItem(dict, key);
  +                    PyList_Append(list, val);
  +                    /* PyDict_GetItem is a borrowed ref, no decref */
  +                }
  +                else {
  +                    PyObject *list;
  +                    list = Py_BuildValue("[O]", val);
  +                    PyDict_SetItem(dict, key, list);
  +                    Py_DECREF(list);
  +                }
  +            }
  +        }
  +	Py_XDECREF(key);
  +	Py_XDECREF(val);
   
   	n++;
       }
  @@ -295,6 +300,13 @@
   	    i++;
   	    j++;
   	}
  +
  +        if (j == 0) {
  +            Py_XDECREF(pair);
  +            i++;
  +            continue;
  +        }
  +
   	cpair[j] = '\0';
   	_PyString_Resize(&pair, j);
   	cpair = PyString_AS_STRING(pair);
  @@ -340,12 +352,13 @@
   	    _PyString_Resize(&key, strlen(ckey));
   	    _PyString_Resize(&val, strlen(cval));
   
  -	    PyList_Append(pairs, Py_BuildValue("(O,O)", key, val));
  +            if (key && val)
  +                PyList_Append(pairs, Py_BuildValue("(O,O)", key, val));
   
   	}
  -	Py_DECREF(pair);
  -	Py_DECREF(key);
  -	Py_DECREF(val);
  +	Py_XDECREF(pair);
  +	Py_XDECREF(key);
  +	Py_XDECREF(val);
   	i++;
       }
   
  
  
  
  No                   revision
  No                   revision
  1.27.2.1  +6 -1      httpd-python/src/include/mod_python.h
  
  Index: mod_python.h
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/include/mod_python.h,v
  retrieving revision 1.27
  retrieving revision 1.27.2.1
  diff -u -r1.27 -r1.27.2.1
  --- mod_python.h	8 Nov 2002 00:15:11 -0000	1.27
  +++ mod_python.h	10 Nov 2003 18:54:45 -0000	1.27.2.1
  @@ -138,6 +138,11 @@
   #define SILENT 0
   #define NOTSILENT 1
   
  +/* python 2.3 no longer defines LONG_LONG, it defines PY_LONG_LONG */
  +#ifndef LONG_LONG
  +#define LONG_LONG PY_LONG_LONG
  +#endif
  +
   /* structure to hold interpreter data */
   typedef struct {
       PyInterpreterState *istate;
  
  
  
  1.16.2.1  +2 -2      httpd-python/src/include/mpversion.h
  
  Index: mpversion.h
  ===================================================================
  RCS file: /home/cvs/httpd-python/src/include/mpversion.h,v
  retrieving revision 1.16
  retrieving revision 1.16.2.1
  diff -u -r1.16 -r1.16.2.1
  --- mpversion.h	7 Mar 2003 20:14:24 -0000	1.16
  +++ mpversion.h	10 Nov 2003 18:54:45 -0000	1.16.2.1
  @@ -1,5 +1,5 @@
   #define MPV_MAJOR 3
   #define MPV_MINOR 0
  -#define MPV_PATCH 3
  +#define MPV_PATCH 4
   #define MPV_BUILD 0
  -#define MPV_STRING "3.0.3"
  +#define MPV_STRING "3.0.4"