14.1.8.HTTP Server Extensions

The Virtuoso shared object library enables you to create your own custom extensions to the Virtuoso HTTP server and create custom VSEs. Support for PHP page execution was implemented using this functionality. Virtuoso can automatically switch processing mode from VSP to PHP or some other custom extension based on the extension of the files being requested from the HTTP server. To enable Virtuoso to process files of a different extension you have to write a VSE handler where part of the name contains the extension: __http_handler_[extension] . The VSEs for HTTP handling must have the following parameters:

__http_handler_<extension> ( in resource varchar,
in parameters vector,
in request_header vector,
inout type_flag any);
  • resource is either the path to a file or the content of a resource in the WebDAV store. The interpretation of this parameter by the server is dependent of the type_flag parameter.

  • parameters for execution, the server will pass to this parameter a string session containing the entity body of the POST method request.

  • request_header is the HTTP request header lines as an array of strings. This parameter will accept the original header as a vector. The vector will contain the complete HTTP request header.

  • type_flag is an in/out parameter which is a flag for indicating the type of the first parameter. If the resource parameter is a file path in the file system this flag should be NULL, if the resource is located in the WebDAV store this flag should be set to URI of the WebDAV resource, something like: virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/dir1/subdir/myfile.php. Virtuoso will return in this parameter an array of two strings set to the http response status line and the header after execution.