Apache HTTP Server Setup
Testing the PUT and DELETE Methods
To test PUT and DELETE, install an Apache HTTP server on a (virtual) machine. Install and enable the WebDAV module (mod_dav).
Note: The following configuration enables uploading of files to the server, so it is not secure.
Configure Apache version 2.4.7-1ubuntu4 on the machine as follows:
/etc/apache2/apache2.conf: <Directory /var/www/html> Options Indexes FollowSymLinks AllowOverride None Require all granted Dav On <Limit GET POST PUT DELETE HEAD OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST PUT DELETE HEAD OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory>
Testing the POST and GET Methods
To test POST and GET, install a CGI script named cgi_test.py in the Apache server's html directory. The content of the file cgi_test.py is as follows:
#!/usr/bin/python
import cgi, cgitb
form = cgi.FieldStorage()
first_name = form.getvalue('first_name')
last_name = form.getvalue('last_name')
print "Content-type: text/html\r\n\r\n"
print "<html><head><title>CGI Program</title></head>"
print "<body><h2>Hello %s %s</h2></body></html>" % (first_name, last_name)