I've got this new application I'm piecing together, and I've got all of the innards coded and working, and it works well (minus some scaling issues with my understanding of mod_perl; more on that in another future node).

I'm assigning new content to a row in MySQL with an id (auto_increment) and a unique_id (some hashing of Data::UUID, thanks to revdiablo for the hint there), along with several other columns.

The goal, is that the content in the row, would be accessed by hitting a url like the following, in a browser:

http://pss.example.com/86e1b327ccc39a38

That unique_id would be the key to return the URl, content, and other items from that row in the database. Right now, I'm using an HTML form to submit that URL for fetch and conversion, using POST. If the URL submitted is unique, a new row is added. If it is not unique (already exists in the database), the duplicate row is updated.

Is it possible to submit an HTML form, which insert this row in the database, and tack on the UUID hash to the end of the URI field in the POST'd page, so that when the submitted page is rendered, the URL in the browser's URI field, is that hash, as above?

I know this is confusing-sounding, so here's an example:

  1. User hits http://pss.example.com in their browser.
  2. User enters a URL in a form field, and clicks submit
  3. System accepts URL, validates it, fetches it, and converts it, and then renders a page with that URL's content converted for the user.

Currently, using POST for the HTML form, the user's browser would continue to show http://pss.example.com in their browser's URI field.

I would like it to show something like: http://pss.example.com/86e1b327ccc39a38 instead, so they can bookmark it and use it for future fetches/conversions without having to use the form interactively.

The catch is, I can't populate the form action with that UUID, because I won't know it until after the user submits the form and the URL they enter is fetched and validated. (Before you suggest it merlyn, PATH_INFO is not an option in this case).

Any way to do this? Maybe switching to GET + some mod_rewrite fu? Something else?


In reply to Sending data to browser's URI field via POST by hacker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.