Discussion List Archives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IUCr Web services

Dear Yves

>> I should still like to see queries to the SinCris database returning
>> pages with relative links, so the Swedish site, for example, could
>> query the SinCris database and have pages returned with the Swedish
>> logo and links to other files on the Swedish machine. This must be
>> possible (as is done with the Chester pages).
> 
> One again I do not see how to do that:
> - the resulting HTML page  for a query is build dynamically, thus:
> Assuming a mirror site M and a client C somewhere else:
> - C asks a query from the index page provided by M.
> - C sends a query to Paris which cannot know that a previous query was
>   made by C to M.

It *is* possible. The CGI protocol includes an environment variable,
HTTP_REFERER, defined as "the URL of the document that the client
points to before accessing the CGI program".

So C requests an index page from mirror M, with URL M//mmm. From this
page, a query is generated to Paris with a set of CGI environment
variables, including $HTTP_REFERER, which has a value of M//mmm (even
though the query comes from C). Paris reads the value of this variable,
strips off the mmm bit, and substitutes M// in any absolute URLs that
it returns to C. Sometimes the original CGI program needs to invoke
subsequent programs, but it encodes the M// in some other variable that
it passes as an argument to its daughter programs. Even if the original
index page is itself generated dynamically, the process that does that
can inherit the HTTP_REFERER value from its calling page.

There will be cases when HTTP_REFERER can't be resolved, if the CGI
process is invoked directly and not from an existing form or index page.
In those cases, enter a default value (the Paris address, probably).

But for most cases where people traverse a sequence of pages with 
well-defined URLs, the location of the invoking page is accessible.

Regards
Brian

Reply to: [list | sender only]
International Union of Crystallography

Scientific Union Member of the International Science Council (admitted 1947). Member of CODATA, the ISC Committee on Data. Partner with UNESCO, the United Nations Educational, Scientific and Cultural Organization in the International Year of Crystallography 2014.

International Science Council Scientific Freedom Policy

The IUCr observes the basic policy of non-discrimination and affirms the right and freedom of scientists to associate in international scientific activity without regard to such factors as ethnic origin, religion, citizenship, language, political stance, gender, sex or age, in accordance with the Statutes of the International Council for Science.