Bug fixes for CGI, forwarding for post-upload

Fixed a deadlock condition on cgi scripts with large amounts of output
Added support for forwarding after upload (?next=<where_to_go>)