Solved

Problem with Location header and shell script

Posted on 1998-08-07
3
191 Views
Last Modified: 2013-12-25
I have a problem executing a CGI program (in C) inside a script. The CGI writes a Location header. If the CGI is executed directly from a browser, it runs fine, but if the script is executed, the browser prints the location text in browser but not change the location.
I have cut the CGI and the script to the next:
Script (nph-script):
      #!/bin/sh
      exec /directory/prueba
CGI: The source code from prueba.c is:
      void main (void) { printf("Location: http://www.aranzadi.es\n\n");}

With these codes, if I put in browser the URL
       http://server/cgi/nph-script
the browser prints the location text (Location: http://www.aranzadi.es) instead change the location in the browser.

My server is Netscape Enterprise Server 2.01 under Solaris 2.51
I have a lot of scripts that call CGI's and all of them run fine, but this case fails. WHY????
0
Comment
Question by:carlos0007
[X]
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
  • 2
3 Comments
 

Accepted Solution

by:
bjornh earned 200 total points
ID: 1831417
Rename your script file to script.cgi. In this case your script should not begin with 'nph-'.

Bjorn
0
 

Author Comment

by:carlos0007
ID: 1831418
Thanks, Bjornh.

Now, the script runs fine.

Can you say me what's the meaning of the prefix 'nph-'?

Carlos.

0
 

Expert Comment

by:bjornh
ID: 1831419
When you use nph- a direct socket connection will be made between your server and your browser. Headers will not be processed by your webbrowser, but will be send to the browser without being processed. You can use it to 'push' information to the browser. Normally the html-page wont be displayed until all data is written to the page, when using nph- it is updated right away.

When you use nph- you also dont want to use Content-type: text/html, it will be printed in your browser, like the location text.

For more information make some searches on the internet with the keywords 'nph-', 'server push', 'html', '...'

Good luck!

Bjorn
0

Featured Post

Understanding Linux Permissions

Linux for beginners: How to view the permissions associated with files and directories and also how you can change them.

Question has a verified solution.

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

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

623 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