diff --git a/src/python/pyrte.c b/src/python/pyrte.c index b53a82c130849e717e2a6d326f8171394f205535_c3JjL3B5dGhvbi9weXJ0ZS5j..d9854a53091b7bdc3966061b13155cc2bed762c9_c3JjL3B5dGhvbi9weXJ0ZS5j 100755 --- a/src/python/pyrte.c +++ b/src/python/pyrte.c @@ -242,6 +242,7 @@ These parameters can control aspects of RTE behaviour on a per-path (and therefore per-script) basis using mapping rules. + script=param=PYRTE=/HEAD=GET same as logical PYRTE_HEAD_CVT_GET script=param=PYRTE=/REUSE reuse this Python interpreter script=param=PYRTE=/NOREUSE do not reuse this Python interpreter script=param=PYRTE=/NOSTREAM do not issue the stream-mode header @@ -255,6 +256,8 @@ if defined to something like 'c' or '/' or '-' debugs all (this script-name check is CASE-SENSITIVE) PYRTE_BASIC_RTE full interpreter cycle request processing (for comparison) +PYRTE_HEAD_CVT_GET if a HEAD method convert to a GET method + as per Apache mod_wsgi behaviour PYRTE_CACHE_ENTRY enables function RtePyMethRteCache() PYRTE_CACHE_MAX integer size of code cache (zero to compare uncached) PYRTE_NOREUSE_INTERPRETER do not reuse interpreter for each script instance @@ -271,6 +274,12 @@ VERSION HISTORY (update SOFTWAREVN as well!) --------------- +30-APR-2010 JFP v1.1.6, WsgiSendResponse(), headers were send too early + in some cases +29-APR-2010 MGD v1.1.5, PYRTE_HEAD_CVT_GET and script=param=PYRTE=/HEAD=GET + with support in SetupOsEnvCgiVar() (per JFP) + JFP Fix a bug in WsgiSendResponse, headers were not + sent when the body respond is empty 08-DEC-2009 JFP v1.1.4, fix bugs introduced in 1.1.3 07-DEC-2009 JFP v1.1.3, os.environ is not a dictionary on OpenVMS 19-APR-2008 JFP v1.1.2, WSGI buffered output (see description above) @@ -281,8 +290,8 @@ */ /*****************************************************************************/ -#define SOFTWARECR "Copyright (C) 2007-2009 Mark G.Daniel" -#define SOFTWAREVN "1.1.4" +#define SOFTWARECR "Copyright (C) 2007-2010 Mark G.Daniel" +#define SOFTWAREVN "1.1.6" #define SOFTWARENM "PYRTE" #ifdef __ALPHA # define SOFTWAREID SOFTWARENM " AXP-" SOFTWAREVN @@ -362,6 +371,7 @@ CgiPlusPythonEnd, Debug, GlobalDebug, + HeadCvtGet, IsCgiPlusMode, IsCgiPlusScript, NoStreamMode, @@ -1549,6 +1559,7 @@ int SetupOsEnvCgiVar (int InitEnv) { + static char RequestMethodGet[] = "REQUEST_METHOD=GET"; static PyObject *pOsEnvironDict; int retval; @@ -1563,6 +1574,9 @@ if (Debug) fprintf (stdout, "SetupOsEnvCgiVar() %d\n", InitEnv); + if (!HeadCvtGet) + HeadCvtGet = (TrnLnm ("PYRTE_HEAD_CVT_GET", NULL) != NULL); + if (InitEnv) { if (!pOsEnvironDict) @@ -1626,6 +1640,11 @@ !strncmp (cptr, "GATEWAY_BG", 10)))) continue; + if (HeadCvtGet && + toupper(*cptr) == 'R' && + !strcmp (cptr, "REQUEST_METHOD=HEAD")) + cptr = RequestMethodGet; + for (sptr = cptr; *sptr && *sptr != '='; sptr++); if (!*sptr) continue; *sptr = '\0'; @@ -2240,6 +2259,11 @@ Py_DECREF (pItem); } Py_DECREF (pIter); + /* + If the response was empty, we have to send the headers + because the preceding loop was not entered + */ + if (!WsgiHeadersSent) WsgiSendHeaders (); return (1); } @@ -2503,7 +2527,7 @@ if (Debug) fprintf (stdout, "RteScriptParam()\n"); - NoStreamMode = 0; + NoStreamMode = HeadCvtGet = 0; cptr = CgiVar ("PYRTE"); if (!cptr) return; @@ -2523,6 +2547,9 @@ if (!strncasecmp (cptr, "/nostream", 9)) NoStreamMode = 1; else + if (!strncasecmp (cptr, "/head=get", 9)) + HeadCvtGet = 1; + else if (!strncasecmp (cptr, "/dbug", 5)) Debug = 1; cptr++; diff --git a/src/python/readme.txt b/src/python/readme.txt index b53a82c130849e717e2a6d326f8171394f205535_c3JjL3B5dGhvbi9yZWFkbWUudHh0..d9854a53091b7bdc3966061b13155cc2bed762c9_c3JjL3B5dGhvbi9yZWFkbWUudHh0 100755 --- a/src/python/readme.txt +++ b/src/python/readme.txt @@ -4,7 +4,7 @@ PYRTE COPYRIGHT --------------- -Copyright (C) 2007-2009 Mark G.Daniel +Copyright (C) 2007-2010 Mark G.Daniel This package comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the conditions of the GNU GENERAL PUBLIC LICENSE, version 3, or any later version. diff --git a/src/python/readmore.html b/src/python/readmore.html index b53a82c130849e717e2a6d326f8171394f205535_c3JjL3B5dGhvbi9yZWFkbW9yZS5odG1s..d9854a53091b7bdc3966061b13155cc2bed762c9_c3JjL3B5dGhvbi9yZWFkbW9yZS5odG1s 100755 --- a/src/python/readmore.html +++ b/src/python/readmore.html @@ -60,5 +60,5 @@ <CENTER> <H1>Python Run-Time Environment</H1> -<H3>Version 1.1.3, 7th Decmeber 2009</H3> +<H3>Version 1.1.6, 1st May 2010</H3> @@ -64,5 +64,5 @@ -<P><B>Copyright © 2007-2009 Mark G. Daniel</B> +<P><B>Copyright © 2007-2010 Mark G. Daniel</B> <BR>This program, comes with ABSOLUTELY NO WARRANTY. <BR>This is free software, and you are welcome to redistribute it under the <BR>conditions of the GNU GENERAL PUBLIC LICENSE, version 3, or any later version.