IBM Integrated Technology Delivery
HTTP protocol basics
Balazs Balogh/Hungary/IBM
Hermann Huebler - IBM India Pvt.
Confidential 01/22/25 © 2007 IBM Corporation
IBM – Integrated Technology Delivery
Why dealing with HTTP protocol
HTTP protocol is the base protocol for Web traffic
Common protocol also used for Web-Services invocation
Several HTTP server configurations depend on HTTP information
Several WAS configurations depend on HTTP information
Need to understand HTTP for several PD scenarios
HTTP Protocol basics | Confidential © 2007 IBM Corporation
IBM – Integrated Technology Delivery
HTTP protocol - the satellite view
re que s t
C lient re s po ns e Server
h ead h ead
empty line empty line
b od y b od y
HTTP Protocol basics | Confidential © 2007 IBM Corporation
IBM – Integrated Technology Delivery
HTTP protocol - GET request
C lient request Server
G E T /ap a che 2-de fa ult/ HTTP /1 .1
Ho st: wa s.ib m .co m
Use r-A g e nt: M o zilla /5 .0 (W ind o ws; U; W ind o ws NT 5 .1 ; en-US ; rv:1 .8 .0 .7 ) G e cko /2 00 6 0 9 09 F ire fo x/1 .5 .0 .7
A cce p t: text/xm l,ap plica tio n/xm l,a pp lica tio n/xhtm l+xm l,te xt/htm l;q =0.9,text/p la in;q =0.8,im a ge /p ng ,*/*;q =0 .5
A cce p t-La ngua ge : en-us,e n;q =0 .5
A cce p t-E nco d ing: g zip ,d efla te
A cce p t-C harse t: IS O -8 85 9-1,utf-8 ;q =0 .7 ,*;q =0 .7
K e e p-A live : 30 0
C o nne ctio n: ke ep -a live
Re fe re r: http ://wa s.ib m .co m /
P rag m a: no-ca che
C a che -C o ntro l: no-ca che
HTTP Protocol basics | Confidential © 2007 IBM Corporation
IBM – Integrated Technology Delivery
HTTP protocol - GET request– sending form data
C lient request Server
GE T /form .htm l?age=40& w eight=72kgs& w eight=158.7lbs& nam e=B al% C 3% A1z s& subm it=subm it HTTP /1.1
Host: was.ibm .com
User-A gent: M ozilla/5.0 (W indows; U; W indows NT 5.1; en-US ; rv:1.8.0.7) Gecko/20060909 F irefox/1.5.0.7
A ccept: text/xm l,application/xm l,application/xhtm l+xm l,text/htm l;q=0.9,text/plain;q=0.8,im age/png,*/*;q=0.5
A ccept-Language: en-us,en;q=0.5
A ccept-E ncoding: gzip,deflate
A ccept-C harset: IS O-8859-1,utf-8;q=0.7,*;q=0.7
K eep-A live: 300
C onnection: keep-alive
Referer: http://was.ibm .com /
P ragm a: no-cache
C ache-C ontrol: no-cache
HTTP Protocol basics | Confidential © 2007 IBM Corporation
IBM – Integrated Technology Delivery
HTTP protocol - POST request– sending form data
C lient request Server
P OS T /form .htm l HTTP /1.1
Host: was.ibm .com
User-A gent: M ozilla/5.0 (W indows; U; W indows NT 5.1; en-US ; rv:1.8.0.7) Gecko/20060909 F irefox/1.5.0.7
A ccept: text/xm l,application/xm l,application/xhtm l+xm l,text/htm l;q=0.9,text/plain;q=0.8,im age/png,*/*;q=0.5
A ccept-Language: en-us,en;q=0.5
A ccept-E ncoding: gzip,deflate
A ccept-C harset: IS O-8859-1,utf-8;q=0.7,*;q=0.7
K eep-A live: 300
C onnection: keep-alive
Referer: http://crow/form .htm l
C ontent-Type: application/x-www-form -urlencoded
C ontent-Length: 60
age=40& w eight=72kgs& w eight=158.7lbs& nam e=B al% C 3% A1z s& subm it=submit
HTTP Protocol basics | Confidential © 2007 IBM Corporation
IBM – Integrated Technology Delivery
HTTP protocol - commands
GET R e trie ve s a W e b s e rve r o b je c t
POST P o s ts fo rm d a ta
PUT U p lo a d s file s to s e rve r (n e e d s s o m e a c tive c o d e o n th e s e rve r s id e )
D E L E TE R e m o ve s file s fro m s e rve r
HEAD R e trie ve s th e h e a d e r p a rt o n ly o f a w e b s e rve r o b je c t
A llo w s th e c lie n t to d e te rm in e th e o p tio n s a n d /o r re q u ire m e n ts
O P TIO N S
a s s o c ia te d w ith a re s o u rc e , o r th e c a p a b ilitie s o f a s e rve r
To s e e w h a t is b e in g re c e ive d a t th e o th e r e n d o f th e re q u e s t c h a in
TR A C E
a n d u s e th a t d a ta fo r te s tin g o r d ia g n o s tic in fo rm a tio n
HTTP Protocol basics | Confidential © 2007 IBM Corporation
IBM – Integrated Technology Delivery
HTTP protocol - HTTP server response
C lient respo nse Server
HTTP/1.1 200 OK
Date: Mon, 02 Oct 2006 16:00:41 GMT
Server: Apache/2.0.55 (Ubuntu)
Last-Modified: Mon, 02 Oct 2006 15:56:48 GMT
ETag: "15b1e7-261-dab3000"
Accept-Ranges: bytes
Content-Length: 609
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
<!DOCTYPE HTML PUBLIC "-//W 3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<TITLE>form.html</TITLE>
</HEAD>
<BODY><FORM method="post">Age:<INPUT type="text" name="age" size="5"><BR>W eight: <INPUT type="text
„ name="weight" size="20">kgs
<INPUT type="text" name="weight" size="20">lbs<BR>Name: <INPUT type="text" name="name" size="20">
<BR>Password: <INPUT type="password" size="20"><BR>
<INPUT type="submit" name="submit" value="submit">
</FORM></BODY></HTML>
HTTP Protocol basics | Confidential © 2007 IBM Corporation
IBM – Integrated Technology Delivery
HTTP protocol - response codes
Informational 1xx Client Error 4xx Server Error 5xx
100 Continue 400 Bad Request 500 Internal Server Error
101 Switching Protocols 401 Unauthorized 501 Not Implemented
402 Payment Required 502 Bad Gateway
Successful 2xx 403 Forbidden 503 Service Unavailable
200 OK 404 Not Found 504 Gateway Timeout
201 Created 405 Method Not Allowed 505 HTTP Version Not Supported
202 Accepted 406 Not Acceptable
203 Non-Authoritative Information407 Proxy Authentication Required
204 No Content 408 Request Timeout
205 Reset Content 409 Conflict
206 Partial Content 410 Gone
411 Length Required
Redirection 3xx 412 Precondition Failed
300 Multiple Choices 413 Request Entity Too Large
301 Moved Permanently 414 Request-URI Too Long
302 Found 415 Unsupported Media Type
303 See Other 416 Requested Range Not Satisfiable
304 Not Modified 417 Expectation Failed
305 Use Proxy
306 (Unused)
307 Temporary Redirect
For details see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
HTTP Protocol basics | Confidential © 2007 IBM Corporation
IBM – Integrated Technology Delivery
HTTP protocol – Networking perspective
■ HTTP is based on TCP/IP
■ All basic TCP/IP networking rules apply
■ For PD network tracing is often very useful
■ wireshark - http://www.wireshark.org/ (Win, Linux, Max OS etc.)
■ tcpdump (Linux, AIX, etc.
■ iptrace / ipreport (AIX)
:
:
■ Modern trace utilities understand HTTP
■ HTTPS is the secure version (HTTP over SSL)
HTTP Protocol basics | Confidential © 2007 IBM Corporation
IBM – Integrated Technology Delivery
Resources
■ HTTP protocol is defined in rfc2616
– http://www.w3.org/Protocols/rfc2616/rfc2616.html
■ HTTPS: HTTP over SSL
■ http://en.wikipedia.org/wiki/HTTP_Secure
HTTP Protocol basics | Confidential © 2007 IBM Corporation