httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/modules/arch/win32 mod_isapi.c
Date Tue, 25 Feb 2003 16:52:56 GMT
wrowe       2003/02/25 08:52:56

  Modified:    modules/arch/win32 mod_isapi.c
  Log:
    Confirmed by Milan Kosina that this code was still broken - I realized
    we weren't updating stat correctly, and shouldn't have been trying to
    pass the status, but the headers instead, from WriteClient().  This way
    we can actually count the bytes consumed and begin treating the rest
    as body contents.
  
  Revision  Changes    Path
  1.91      +30 -12    httpd-2.0/modules/arch/win32/mod_isapi.c
  
  Index: mod_isapi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/arch/win32/mod_isapi.c,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- mod_isapi.c	3 Feb 2003 17:52:56 -0000	1.90
  +++ mod_isapi.c	25 Feb 2003 16:52:55 -0000	1.91
  @@ -653,6 +653,13 @@
   
   /* Common code invoked for both HSE_REQ_SEND_RESPONSE_HEADER and 
    * the newer HSE_REQ_SEND_RESPONSE_HEADER_EX ServerSupportFunction(s)
  + * as well as other functions that write responses and presume that
  + * the support functions above are optional.
  + *
  + * Other callers trying to split headers and body bytes should pass
  + * head/headlen alone (leaving stat/statlen NULL/0), so that they
  + * get a proper count of bytes consumed.  The argument passed to stat
  + * isn't counted as the head bytes are.
    */
   static apr_ssize_t send_response_header(isapi_cid *cid, 
                                           const char *stat,
  @@ -698,18 +705,29 @@
       }
   
       if (stat && (statlen > 0) && *stat) {
  -        char *newstat = apr_palloc(cid->r->pool, statlen + 9);
  -        char *stattok = (char*)memchr(stat, ' ', statlen - 1) + 1;
  -        strcpy(newstat, "Status: ");
  -        /* Now decide if we follow the xxx message 
  -         * or the http/x.x xxx message format 
  -         */
  -        if (!apr_isdigit(*stat) && stattok && apr_isdigit(*stattok)) {
  -            statlen -= stattok - (char*)stat;
  -            stat = stattok;
  +        char *newstat;
  +        if (!apr_isdigit(*stat)) {
  +            const char *stattok = stat;
  +            int toklen = statlen;
  +            while (toklen && *stattok && !apr_isspace(*stattok)) {
  +                ++stattok; --toklen;
  +            }
  +            while (toklen && apr_isspace(*stattok)) {
  +                ++stattok; --toklen;
  +            }
  +            /* Now decide if we follow the xxx message 
  +             * or the http/x.x xxx message format 
  +             */
  +            if (toklen && apr_isdigit(*stattok)) {
  +                statlen -= toklen;
  +                stat = stattok;
  +            }
           }
  -        apr_cpystrn(newstat + 8, stat, statlen + 1);
  +        newstat = apr_palloc(cid->r->pool, statlen + 9);
  +        strcpy(newstat, "Status: ");
  +        apr_cpystrn(newstat + 8, stat, statlen);
           stat = newstat;
  +        statlen += 8;
       }
   
       if (!head || headlen == 0 || !*head) {
  @@ -799,8 +817,8 @@
            * Parse them out, or die trying.
            */
           apr_ssize_t ate;
  -        ate = send_response_header(cid, (char*)buf_data,
  -                                   NULL, buf_size, 0);
  +        ate = send_response_header(cid, NULL, (char*)buf_data,
  +                                   0, buf_size);
           if (ate < 0) {
               SetLastError(ERROR_INVALID_PARAMETER);
               return 0;
  
  
  

Mime
View raw message