Gray's Matter
Justice Gray - North America's favorite metrosexual software consultant
E-mail Justice
Subscribe to this feed
Subscribe to comments
Perennially Popular Posts
How to write a presentation abstract
My grandmother, globalization, and what's wrong with DateTime.Parse
A letter to my Worldvision sponsor child
Development Methodologies for the 21st Century
My grandmother & the difference between strong typing and weak typing
How I am becoming a better developer, part 1 of infinity
Facebook RSS Feeds: How to Write Your Own With C#
The Ten Keys To Happiness
My grandmother and the Global Assembly Cache (And Star Wars)
My grandmother and the difference between processes and threads
How to make a meeting request
Why you should never be an independent consultant
The DasBlog 1.9 AJAX Autosave True Story, Part 2
Other "metro" developers
Ben Scheirman
Bil Simser
D'Arcy Lussier
David Woods
Donald Belcham
Donald Jessop
George Clingerman
James Kovacs
Jason Hunt
Jason Row
Jean-Paul Boodhoo
Jeffrey Palermo
Joey deVilla
John Bristowe
Jonas Avellana
Kyle Baley
Mack Male
Martin Hinselwood
Michael McClenaghan
Mike Duncan
Mike Friesen
Mo Khan
Otyce
RoboSapient
Russell Ball
Scott Hanselman
Scott Reynolds
Steven Rockarts
Tech Embassy
Terry Thibodeau
Tom Opgenorth
Vladimir Levin
The Justice Gray Fan Club
Amazing Mrs. Loquacious
Dr. Teeth
Facedown
Janey Lynne
Maxime Lamy
Ridley Thunder
Stan Woo
Vanilla Con
Wobbly*Bits
I Wish These People Updated More Than Once a Year
Anand Narayan
Jeff Perrin
<< Visual Studio 2005 / ASP.NET 2.0 - The first two hours
Tom - Thank you for the new DasBlog doc sites >>
My grandmother and the difference between HTTP GET and HTTP POST
Since I'm a little under the weather today, I figured I'd post another one of the
Hanselman
questions
for my granny, who is no doubt concerned for my welfare and thinks I should be back in bed!
Let’s say that my grandmother wants to look for some DVDs at a particular local shop. Now, this shop doesn’t run like any ordinary shop. To see if they have a certain DVD, my grandmother has to write down a list of relevant info on a piece of lined paper. Let’s say she is looking for any movie that starred Gape Kaplan that was made before 1980.
She writes down the following:
Actor = GabeKaplan
DateMade = Before 1980
Ignore = Welcome Back Kotter
and gives this piece of paper to the clerk. The clerk reads this information into a microphone and then the back room goes to work finding all relevant titles.
There are a couple of disadvantages to this approach – the company won’t give my grandmother any more paper to write her criteria on, and the paper itself is limited to around 5 lines. So if my grandmother wants to submit anything in detail, she can’t! Also, unless my grandmother starts writing her orders down in some sort of code, anyone else who is listening can hear what she is looking for – no privacy! She may be okay with looking for DVDs in this manner, but she definitely doesn’t want her orders being public knowledge. Not to mention that all of her contact info will not fit on that piece of paper! My grandmother complains and because everyone listens to my grandmother, the process for actually ordering DVDs is changed, while the search method remains the same.
So, a week later Suresh comes in and he already knows what he is looking for: “Male Nurses Unchained”, Parts 70 through 75. With the new ordering process, he encloses all of his contact info as well as his order information and credit card number on some paper put into an envelope. When he goes up to the till, he tells them, “Order here” and hands them the envelope. They process his request and a week later he receives the shipment straight to his house.
What my grandmother has done, in terms of the HTTP protocol, is called a GET. A GET puts form values (her search criteria) into the URL string (that lined sheet of paper). GETs are recommend in situations where the interaction is like a question (a read operation, a lookup, or any of Gabe Kaplan’s film escapades). Now, the URL string is limited to 256 characters, sort of like that lined sheet of paper has a limited amount of lines. As well, unless the query string is encrypted that information is publically viewable.
Suresh, on the other hand, has executed a POST, which embeds the form values inside the body of the HTTP request (like Suresh’s envelope was given when he made his request). In addition to being slightly more secure, it’s also capable of being much denser than a GET (all of Suresh’s contact info, etc.) since it doesn’t have to contend with URL limitations. The W3C recommends using POST if
The interaction is more like an order, or
The interaction changes the state of the resource in a way that the user would perceive (e.g., a subscription to a service), or
The user be held accountable for the results of the interaction. [in all cases, like Suresh’s transaction].
Bonus: What is HEAD?
A HEAD request is similar to a GET request except no message body is returned (e.g. my grandmother makes a request for DVDs but gets nothing back). This might sound useless but it’s actually a way to simply test a URL for validity, accessibility, or recent modification.
Wednesday, December 07, 2005
Comments [1]
HanselmanQuestions
|
Suresh
|
Technical
|
Tracked by:
"One year" (Gray's Matter)
[Trackback]
"My grandmother and the Global Assembly Cache (and Star Wars)" (Gray's Matter)
[Trackback]
"My grandmother, globalization, and what's wrong with DateTime.Parse" (Gray's Ma...
[Trackback]
"My grandmother and the difference between strong-typing and weak-typing" (Gray'...
[Trackback]
5/7/2008 11:34:04 PM (Mountain Daylight Time, UTC-06:00)
Very Nice!!!!!!
Abhinav
|
astrovirginAT NOSPAMgmail dot com
Name
E-mail
Home page
Remember Me
Comment (HTML not allowed)
Enter the code shown (prevents robots):
Justice Gray
: a seething cauldron of rampaging masculinity. A fighter! A brother! Your
secret lover
! He's also a software development consultant and the Vice President of the
Edmonton .NET user group
. He also greatly enjoys speaking about himself in the 3rd person.
Gray's Matter Archives
Recent Posts
Controversy clarifications!
The most controversial interview of ALL TIME
Finally! The *winner* of the "What Justice Gray Means to Me" contest
The mystery of D'Arcy Lussier's ASP.NET MVP is solved...
Well, now that's pretty horrifying
MVPs on MVC: "No, we don't have any idea either"
Why I am happy to not be at the MVP Summit
Donald Belcham's cry for help: MS MVPs, your attention is needed
ALT.NET Pursefighting revealed
Test, please ignore!
Change yourself, change the world: a great week 4
Post Categories
BookReviews
Conferences
DasBlog
EDMUG
Goals
HanselmanQuestions
HotDeveloperCorner
ILiveToInform
Leadership
Mac
OtherGrayAreas
Personal
Productivity
Ruby
Suresh
Technical
Transformers
Vancouver
Wii
<
July 2008
>
Sun
Mon
Tue
Wed
Thu
Fri
Sat
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
Sign In