Forum Discussion
Altera_Forum
Honored Contributor
21 years agoCGI problem
Hello:
I am testing a CGI program using C language and Shell under the Nios2 Linux system. What I want is to implement the "Redirection" function to redirect user's browser to a website: for exmaple "www.google.com". My approach is to print the "Location: URL" header to user's browser. What I did is like this, I wrote a C program that is doing simple I/O access,and contains the last line: printf("Location: http://www.google.com\n\n"); (http://www.google.com\n\n"%3b%29;) I also wrote a shell scirpt which was: # !/bin/sh echo "Location: http://www.google.com" (http://www.google.com") echo "" Finally,I put them into the proper place and tried to link them using IE. Both execution turned out successful(I/O result was correct),but they did't bring me to google! After the execution,both of them only took me to the previous folder. (i.e. from http://192.168.1.1/cgi-bin/test.cgi (http://192.168.1.1/cgi-bin/test.cgi) to http://192.168.1.1/cgi-bin/ (http://192.168.1.1/cgi-bin/) ) Can anyone please tell me what's the problem!? Thank you so much. Best Regards.3 Replies
- Altera_Forum
Honored Contributor
I presume that you're using boa?
- Altera_Forum
Honored Contributor
Hello clansdown:
Yes,I am using boa. - Altera_Forum
Honored Contributor
Two other questions:
(1) What happens if you go to it manually, e.g.
(2) What happens if you use some other browser, such as Firefox?telnet host 80 GET /cgi-bin/test.cgi HTTP/1.1 Host: hostname