Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Does LOCATION: http://  Work?

Posted on 1997-11-12
6
160 Views
Last Modified: 2013-12-25
I am using the following line in my CGI-PERL code:

print "Location: http://mywebsite.com/test.htm\n\n";

This is the ONLY line I have that outputs back to browser.  From what I've gathered, this should tell the browser to switch to this new web site (mywebsite.com/test.htm).  Unfortunately it doesn't do this.  

All I get is DOCUMENT CONTAINS NO DATA (or something to that extent) by Netscape 4.0 and down and MS Explorer.

Any clues as to what I'm doing wrong?
0
Comment
Question by:jujoo
  • 3
  • 2
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1831153
Perhaps the http://mywebsite.com/test.htm document contains no data?
Or perhaps some other line in your program is preventing the only output line from printing.
0
 
LVL 3

Accepted Solution

by:
gwalters earned 0 total points
ID: 1831154
One more newline ought to do it (an HTTP header is delimited by a blank line).

BTW, I hope you're planning on increasing the points before grading this.
0
 
LVL 6

Expert Comment

by:alamo
ID: 1831155
Funny, looks like there's a blank line after the Location header to me...

jujoo, if you run the script from the commasd line what does it print? That might tell you something.
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 3

Expert Comment

by:gwalters
ID: 1831156
Oops, I didn't look closely enough.  Now that I have, I see the real problem.  Try printing this:


"Location: http://mywebsite.com/test.htm\r\n\r\n"



You MUST use CR LF at the end of lines in HTTP.


0
 
LVL 6

Expert Comment

by:alamo
ID: 1831157
Must? I have never used \r\n and have seen only a handful of examples which do, almost everything I've seen uses just \n. I've never had a problem. (The server is repsonsible for parsing the headers anyway). Is this server-dependent?
0
 
LVL 3

Expert Comment

by:gwalters
ID: 1831158
OK, "must" (especially with my all-caps emphasis) might have been a bit strong.  I meant it was in the HTTP spec as CR LF.

I beleive most servers see the LF coming in from a CGI and convert them to CR LF.

Could we get a URL to check so we can stop guessing here (and I can stop making bold statements that turn out to be wrong ;)


0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
exchange, scripts 3 73
Scripting vs. Programming languages 25 179
Script to change all permissions to my user 7 45
Renaming with batch file 9 50
Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question