Reputation: 1877
I am moving some really old legacy perl cgi code to a new server.
All the old perl stuff seems to be working except one script and one line.
I am not sure if i have forgotten to load something (usually it tells me i am missing something)
the line of code that causes the error:
print $query->redirect(-location=>"/servlet/guestbookServlet?method=displayGuestBook&dir=kam");
the error in the errorlog is
malformed header from script. Bad header=HTTP/1.0 "/servlet/guestbookSe: guestbook.pl
if i put in malformed header from script. Bad header=HTTP/1.0 "/servlet/guestbookSe: guestbook.pl durectly in the browser it is fine
if i put
print header
print $query->redirect(-location=>"/servlet/guestbookServlet?method=displayGuestBook&dir=kam");
the browser just prints out ( which i am not sure really look correct?)
HTTP/1.0 "/servlet/guestbookServlet?method Status: "/servlet/guestbookServlet?method
Window-target: kam" Set-cookie: displayGuestBook&dir Expires: -Status Date: Tuesday,
31-Dec-2013 14:04:37 GMT -Location http://www1.mydomain.com/cgi-local/guestbook.pl?
action: -URI http://www1.mydomain.com/cgi-local/guestbook.pl?action: -nph 0 Content-
type: LOCATION
Upvotes: 0
Views: 861
Reputation: 9819
Try
print $query->redirect("/servlet/guestbookServlet?method=displayGuestBook&dir=kam");
without the -location
. Also check the docs under GENERATING A REDIRECTION HEADER.
Upvotes: 4