Web Publishing with the PUT Method

An IBM® HTTP Server for i instance can be configured to support the PUT method for Web publishing.

The standard way of uploading files to a Web server using HTTP is through the use of the PUT method. HTTP Server 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 through the module mod_dav. Another is to provide your own CGI program and configure it for use with HTTP Server. This topic 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 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 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 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 and Setting up WebDAV for HTTP Server.

CGI programs

Alternatively, you can provide your own CGI program to handle incoming PUT requests, and configure it for use with HTTP Server. 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:

  • Ensuring the user making the PUT request is authorized to update files on the server
  • Making sure only Web content files are updated
  • Only updating content the user is authorized to update

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 using the Script directive. For more information on the Script directive, see Module mod_actions.