Web Publishing with the PUT Method

This topic provides information on Web publishing with the PUT method.

Important: Information for this topic supports the latest PTF levels for HTTP Server for i5/OS . It is recommended that you install the latest PTFs to upgrade to the latest level of the HTTP Server for i5/OS. Some of the topics documented here are not available prior to this update. See http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm Link outside Information Center for more information.

The standard way of uploading files to a Web server using HTTP is through the use of the PUT method. HTTP Server (powered by Apache) supports the PUT method, but requires additional setup to tell the server how to handle incoming PUT requests. One way to accomplish this is to enable WebDAV, which is provided with HTTP Server (powered by Apache) through the module mod_dav. Another is to provide your own CGI program and configure it for use with HTTP Server (powered by Apache). This article discusses both options, as well as the PUT method in general.

About the PUT Method

POST and PUT are two methods in the HTTP specification that are used to permanently change files on a Web server. While the POST method is used in conjunction with preestablished content such as Web forms, the PUT method involves manipulating files that do not yet exist on the server. HTTP Server (powered by Apache) supports the POST and PUT methods in the same way -- that is, it requires a program to tell it how to handle incoming requests.

WebDAV

Most users will find that the easiest way to implement the PUT method for HTTP Server (powered by Apache) is to enable WebDAV and use a client program that supports WebDAV (such as Microsoft Web Folders) to upload files. WebDAV is a set of extensions to the HTTP protocol, and is included in HTTP Server (powered by Apache) through the module mod_dav. In addition to the WebDAV extensions, mod_dav includes a PUT handler.

For more information on WebDAV, including a list of all the methods included, see WebDAV for HTTP Server (powered by Apache) and Set up WebDAV for HTTP Server (powered by Apache).

CGI programs

Alternatively, you can provide your own CGI program to handle incoming PUT requests, and configure it for use with HTTP Server (powered by Apache). A program that handles PUT requests operates much like a program that handles POST requests, but must include additional code for writing (and overwriting) files on the server.

Because a PUT action results in a permanent change on the server, it's important to be aware of the security issues involved in providing your own PUT-handling CGI program. Some of these issues include:

For a more detailed discussion on providing your own PUT-handling CGI program, see the Apache Week article Publishing Pages with PUT Link outside Information Center.

Once you have a program capable of handling PUT requests, you can configure it for use with HTTP Server (powered by Apache) using the Script directive. For more information on the Script directive, see Module mod_actions.