Solved

Problem with Location header and shell script

Posted on 1998-08-07
3
172 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to silent print from safari browser 6 170
Need to convert a simple VB script to PowerShell 3 65
get remote physical servers and platforms 5 50
Where do I learn ES6? 3 49
In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now