Showing posts with label Web server. Show all posts
Showing posts with label Web server. Show all posts

Monday, December 15, 2014

Difference between PUT and POST

HTTP PUT:
PUT puts a file or resource at a specific URI, and exactly at that URI. If there's already a file or resource at that URI, PUT replaces that file or resource. If there is no file or resource there, PUT creates one.
HTTP POST:
POST sends data to a specific URI and expects the resource at that URI to handle the request. The web server at this point can determine what to do with the data in the context of the specified resource.
The official HTTP RFC specifies POST to be:
  • Annotation of existing resources;
  • Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;
  • Providing a block of data, such as the result of submitting a form, to a data-handling process;
  • Extending a database through an append operation.

Monday, December 1, 2014

python built-in Web Server

The SimpleHTTPServer module that comes with Python is a simple HTTP server that
provides standard GET and HEAD request handlers.

To start a HTTP server on port 8000 (which is the default port), simply type:

python -m SimpleHTTPServer [port]




An advantage with the built-in HTTP server is that you don't have to install and configure anything. The only thing that you need, is to have Python installed. That makes it perfect to use when you need a quick web server running and you don't want to mess with setting up apache. You can use this to turn any directory in your system into your web server directory.

As long as the HTTP server is running, the terminal will update as data are loaded from the Python web server. You should see standard http logging information (GET and PUSH), 404 errors, IP addresses, dates, times, and all that you would expect from a standard http log as if you were tailing an apache access log file.