[fpc-pascal] fpweb: processing URLs like GET http://server/cgi-bin/tigercgi/documents/301/

Reinier Olislagers reinierolislagers at gmail.com
Mon Feb 25 13:56:55 CET 2013

On 25-2-2013 13:38, Michael Van Canneyt wrote:
> On Mon, 25 Feb 2013, Reinier Olislagers wrote:
>> Say I have an fpweb CGI server with action documents registered and I
>> GET http://server/cgi-bin/tigercgi/documents/301/
>> 1. How do instruct the documents action to handle that? Currently I get
>> a Error: Could not determine HTTP module for request ....
> Did you register the module ? It means that the documents module was not
> found.
> As soon as the path has more than 1 component, it is assumed that the
> path is composed of
> /module/action/whatever.

Yep, started a new default CGI application which registered a module.
I'll have a look to see how it goes with multiple modules (e.g. for
documents, images, whatever), and how I can handle arbitrary actions
(document id such as 301 in the example above, image ID) or perhaps even
disable action handling altogether if possible.

> If - and only if - there is only 1 path component, it is assumed to be
> an action:
> /action
> There are is a flag to change this latter behaviour, so it is assumed to
> be a module:
> /module
Ok, that helps.

>> 2. Is there some example/easy way of recognizing the part after the
>> module or do I have to parse the URI property in some way?
>> Seem like GetNextPathInfo may be a likely candidate?
> Correct.
>> 3. For any URL, I would like to differentiate between e.g. GET and PUT.
>> How do I figure out which method (GET, POST, PUT, DELETE...)was used?
> See Request.Method.
Obvious name really <blush> ;)


More information about the fpc-pascal mailing list