Re: php4-200006231745 - solaris 7 + nes/iplanet 4.1 NSAPI problems.

From: Date: Sat, 24 Jun 2000 16:37:11 +0000
Subject: Re: php4-200006231745 - solaris 7 + nes/iplanet 4.1 NSAPI problems.
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-22235@lists.php.net to get a copy of this message
Zeev commited your patch. I hope it is OK. The ISAPI module had a similar bug so I figure you got the fix from there. Thanks, Andi At 06:01 PM 6/24/00 +0200, Roberto Biancardi wrote:
i had problem with the indicated configuration. When i submit forms with file uploads i got strange errors about 'File Upload Mime headers garbled' and similar. I tracked down the problem to some bugs in sapi/nsapi/nsapi.c and after some bug fix in read_post_data (and more debug) i noticed php_request_startup() was called two times per each request; it work pretty well now. So, here is the patch, -- Roberto Biancardi - +39 2 277918.1 - biancardi@bware.it*** /tmp/nsapi.c Sat Jun 24 17:19:50 2000
--- php4-200006231745/sapi/nsapi/nsapi.c        Sat Jun 24 17:22:05 2000
*************** *** 80,85 **** --- 80,86 ----
        pblock  *pb;
        Session *sn;
        Request *rq;
+       int     read_post_bytes;
} nsapi_request_context; /* *************** *** 211,216 **** --- 212,224 ----
        netbuf *nbuf = rc->sn->inbuf;
        /*
+       *       Yesss!
+       */
+       count_bytes = MIN(count_bytes, SG(request_info).content_length-rc->read_post_bytes);
+       content_length = SG(request_info).content_length;
+ + #if 0
+       /*
        * Determine the content-length. This will tell us the limit we can read.
        */
        content_length_str = pblock_findval("content-length", rc->rq->headers);
*************** *** 217,222 **** --- 225,231 ----
        if (content_length_str != NULL) {
                content_length = strtol(content_length_str, 0, 0);
        }
+ #endif
        if (content_length <= 0)
                return 0;
*************** *** 225,235 **** --- 234,246 ----
        * Gobble any pending data in the netbuf.
        */
        length = nbuf->cursize - nbuf->pos;
+       length = MIN(count_bytes, length);
        if (length > 0) {
                memcpy(read_ptr, nbuf->inbuf + nbuf->pos, length);
                bytes_read += length;
                read_ptr += length;
                content_length -= length;
+               nbuf->pos += length;
        }
        /*
*************** *** 249,254 **** --- 260,267 ----
                content_length -= length;
        }
+       if ( bytes_read > 0 )
+               rc->read_post_bytes += bytes_read;
        return bytes_read;
} *************** *** 499,508 **** --- 512,523 ----
                "Parsing [%s]", SG(request_info).path_translated);
#endif + #if 0
        result = php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC);
        if (result == FAILURE) {
                return FAILURE;
        }
+ #endif
        nsapi_hash_environment(NSLS_C SLS_CC);
        php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
*************** *** 547,552 **** --- 562,568 ----
        request_context->pb = pb;
        request_context->sn = sn;
        request_context->rq = rq;
+       request_context->read_post_bytes = 0;
        SG(server_context) = request_context;
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#22235) next »