#62 Bug in HTTPResponse code

closed-fixed
WebKit (58)
5
2004-03-04
2004-01-20
No

In the HTTPResponse module (see
http://webware.sourceforge.net/Webware-
0.8.1/WebKit/Docs/Source/Files/HTTPResponse.py.html)
you will find the following method for flushing the
response cache

def flush(self, autoFlush=1):
"""..."""
if not self._committed:
self.commit()
self._strmOut.flush()
self._strmOut.autoCommit(1)

The last line should be very obviously changed to

self._strmOut.autoCommit(autoFlush)

Or do I miss something?

I also noticed a problem when I do a flush and a
forward afterwards. Webware makes the forwarding, but
somehow the forwarding servlet seems to overwrites
the servlet to which it forwards in the servlet cache.
Webware should prohibit forwarding when the response
is already committed.

Discussion

    • assigned_to: nobody --> jdhildeb
     
  • Logged In: YES
    user_id=173690

    Ok, I've applied the first bugfix to CVS -- thanks.

    With respect to the second problem, could you whip up a
    small test case which demonstrates the problem?

     
  • Logged In: YES
    user_id=193957

    Find attached a small test case demonstrating the problem.

    You can jump between page a and page b via ordinary links,
    and you can make a forward from page a to page b. Withthe
    flush() command commented out in servlet a, everything
    works fine. The response from page a is discarded and you
    see the response from page b. However, with the flush()
    command, you will get an error
    like "InvalidCommandSequence". It is understandable that
    an error is raised, since the response has already been sent
    to the web server and cannot be taken back, but the problem
    is that from now on, servlet b has been taken over by servlet
    a in the servlet cache. Even if you enter the address of
    servlet b or jump to servlet b, you will always get the output
    of servlet a. Things will only become normal again if you
    restart Webware or empty the servlet cache.

     
  • Test case for servlet take-over after forward

     
    Attachments
    • status: open --> closed-fixed
     
  • Logged In: YES
    user_id=173690

    Thanks for the test case. It looks like this code has
    changed since Webware 0.8.x, and instead of the
    InvalidCommandSequence exception you get an assertion error
    earlier in the call sequence.
    I was able to confirm that using webware from cvs, servlet a
    doesn't "take over" servlet b.

    I added some text to make the assertion failure more clear
    "Cannot reset response; it has already been sent.", which
    will hopefully help the developer in this situation.