Note that there are some explanatory texts on larger screens.

plurals
  1. POcgi URL forwarding with "Location" header - only partial forwarding?
    primarykey
    data
    text
    <p>Greetings all,</p> <p>I have a python CGI script which using </p> <pre><code>print "Location: [nextfilename]" print </code></pre> <p>After "forwarding" (the reason for the quotes there is apparent in a second), I see the HTML of the page to which it has forwarded fine, but all images, etc. are not showing. The address bar still shows the cgi script as the current location, not the HTML file itself. If I go to the HTML file directly, it displays fine.</p> <p>Basically, the CGI script, which is stored in the cgi-bin, whereas the HTML files are not, is trying to render images with relational links that are broken. </p> <p>How do I <em>actually</em> forward to the next page, not just render the next page through the cgi script? </p> <p>I have gone through the script with a fine-toothed comb to make sure that i wasn't actually using a print htmlDoc command anywhere that would be interrupting and screwing this up. </p> <p>Sections of Code that are Applicable: </p> <pre><code>def get_nextStepName(): """Generates a random filename.""" nextStepBuilder = ["../htdocs/bcc/"] fileLength = random.randrange(10)+5 for i in range(fileLength): j = random.choice(varLists.ALPHANUM) nextStepBuilder.append(j) nextStepName = "" for char in nextStepBuilder: nextStepName += char nextStepName += ".html" return nextStepName def make_step2(user, password, email, headerContent, mainContent, sideSetup, sideContent, footerContent): """Creates the next step of user registration and logs valid data to a pickle for later confirmation.""" nextStepName = get_nextStepName() mainContent = "&lt;h1&gt;Step Two: The Nitty Gritty&lt;/h1&gt;" mainContent += "&lt;p&gt;User Name: %s &lt;/p&gt;" % (user) mainContent += """\ [HTML CODE GOES HERE] """ htmlDoc = htmlGlue.glue(headerContent, mainContent, sideSetup, sideContent, footerContent) f = open(nextStepName, "w") f.write(htmlDoc) f.close() nextStepName = nextStepName[9:] #truncates the ../htdocs part of the filename to fix a relational link issue when redirecting gotoNext(nextStepName) def gotoNext(filename): nextLocation = "Location:" nextLocation += filename print(nextLocation) print </code></pre> <p>Any thoughts? Thanks a ton. CGI is new to me. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload