Uniform Resource Locators (URL), Berners-Lee, Masinter, McCahill; RFC 1738
URL = Uniform Resource Locator
Common Internet Scheme Syntax
gopher
prospero
WWW
DTD
<TITLE>The simplest HTML example</TITLE>
<H1>This is a level-one heading</H1>
Welcome to the world of HTML.
This is one paragraph.<P>
And this is a second.<P>
This is a level one heading
Welcome to the world of HTML. This is one paragraph.
And this is a second.
HTML is not case sensitive
<TITLE>My Title</TITLE>
<Hy>Text of heading </Hy >
y = 1 | 2 | ... | 6
Paragraphs
<CENTER> center </CENTER>
<B> bold text </B>
<CENTER><B> center </B></CENTER>
<I> italic text </I>
<TT> typewriter text, </TT>
<CITE> for titles of books, films, etc. </CITE>
<CODE> for snippets of computer code.</CODE>
<STRONG> for strong emphasis</STRONG>
<HR> tag produces a horizontal line
In document Foo.html create a link to document fancy.html
In document fancy.html indicate the link by
Link to a document on another machine
Link to an image
<A HREF="http://host/fileName.extensions">
Great Stuff
</A>
File Type Extension Plain text .txt HTML document .html GIF image .gif TIFF image .tiff XBM bitmap image .xbm JPEG image .jpg or .jpeg PostScript file .ps AIFF sound .aiff AU sound .au QuickTime movie .mov MPEG movie .mpeg or .mpg
<!DOCTYPE HTML SYSTEM "html.dtd"> <HTML> <HEAD><TITLE> CS 596: Gopher Protocol </TITLE></HEAD> <BODY> <H2> <IMG SRC="http://www.sdsu.edu/graphics/sdsu_logo_3.gif" ALT="SDSU" HSPACE=20> CS 596: Client Server Programming<br> <center> Gopher Protocol </center> </H2> <CENTER> <A HREF="../index.html">[To Lecture Notes Index]</a><br> San Diego State University<I> -- This page last updated February 20, 1995</I> </CENTER> <IMG SRC="http://www.sdsu.edu/graphics/divider_red.gif" ALT="----------"> <P> <center><h3> Contents of Gopher Protocol Lecture </h3></center> </body> </html>
Hypertext Transfer Protocol
stateless, object-oriented protocol
The typing and negotiation of data representation, allows systems to be built independently of the data being transferred
Assigned port 80
Client: Open connection
Server: Accept/Reject connection
Client: Send request
Server: Send response to request
Connection closed
origin server
proxy
"literal"
rule1 | rule2
(rule1 rule2)
*rule
<n>*<m>element
[rule]
<n>(element)
<n>#<m>element
; comment
OCTET = <any 8-bit character>
CHAR = <any US-ASCII character (octets 0 - 127)>
UPALPHA = <uppercase letter "A".."Z">
LOALPHA = <lowercase letter "a".."z">
ALPHA = UPALPHA | LOALPHA
DIGIT = <"0".."9">
CTL = <control character (octets 0 - 31) and DEL>
CR = <carriage return (13)>
LF = <linefeed (10)>
SP = <space (32)>
HTAB = <horizontal-tab (9)>
<"> = <double-quote mark>
LWS = [CRLF] ( SP | HTAB )
HTTP-message = Simple-Request ; HTTP/0.9 messages | Simple-Response | Full-Request ; HTTP/1.0 messages | Full-Response Full-Request = Request-Line *General-Header *Request-Header *Object-Header CRLF [ Object-Body ] Full-Response = Status-Line *General-Header *Response-Header *Object-Header CRLF [ Object-Body ] HTTP-header = field-name ":" [ field-value ] CRLF Object-Body = *OCTET
Request = Simple-Request | Full-Request Simple-Request = "GET" SP URI CRLF
telnet: saturn 8080
Server: accepts connection
Telnet: GET /cs/cs596_3/ <CRLF>
Server:
etc.
Request = Simple-Request | Full-Request Full-Request = Request-Line *General-Header *Request-Header *Object-Header CRLF [ Object-Body ]
Request-Line = Method SP URI SP HTTP-Version CRLF
Telnet: saturn 8080
Server: accepts connection
Telnet: GET /cs/cs596_3/ HTTP/1.0 <CRLF>
Telnet: <CRLF>
Server:
Method = "GET" | "HEAD" | "PUT" | "POST" | "DELETE" | "LINK" | "UNLINK" | extension-method
GET and HEAD must be supported by all HTTP/1.0 servers
Servers should return the Status-Code
if the method is unknown.
Retrieves whatever object is identified by the URI.
The URI can refer to a data-producing process, or a script
The produced data which shall be returned as the Object-Body
Identical to GET except that the server must not return any Object-Body in the response
Request that the origin server accept the object enclosed in the request as a new subordinate of the resource identified by the URI
Allows a uniform function to:
The enclosed Object in the request is to be stored under the supplied URI
Requests that the server delete the resource identified by the given URI
Establishes one or more Link relationships between the existing resource identified by the URI and other existing resources
UNLINK method removes one or more Link relationships from the existing resource identified by the URI
HTTP-header = field-name ":" [ field-value ] CRLF field-name = 1*<any CHAR, excluding CTLs, SP, and ":"> field-value = *( field-content | comment | LWS ) field-content = <the OCTETs making up the field-value and consisting of either *text or combinations of token, tspecials, and quoted-string>
Date: Wednesday, 22-Feb-95 19:48:55 GMT
Content-Type: text/html
Content-Length: 1831
General-Header = Connection | Date | Forwarded | Mandatory | Message-ID | MIME-Version
Connection = "Connection" ":" 1#connect-option connect-option = token [ "=" word ]
Example: Connection: keep-alive
Formats accepted
Preferred:
Used by proxies to indicate the intermediate steps between the user agent and the server
Forwarded = "Forwarded" ":" "by" URI [ "(" product ")" ] [ "for" FQDN ] FQDN = <Fully-Qualified Domain Name>
Example:
Forwarded: by http://info.cern.ch:8000/ for ptsun00.cern.ch
The Mandatory header is used to indicate a list of other header field names which must be understood by the receiver
This header is used to alert the receiver that, unlike the default behavior, it cannot safely ignore the semantics of the listed field-names if they are not understood.
It is anticipated that the field names correspond to conditions that must be met by the receiver in order to abide by the sender's licensing, copyright, payment, or other fair-usage constraints.
Mandatory = "Mandatory" ":" 1#field-name
The Message-ID field in HTTP is identical to that used by Internet Mail and USENET messages
A single, unique identifier which can be used for identifying the message (not its contents) for "much longer" than the expected lifetime of that message.
Message-ID = "Message-ID" ":" "<" addr-spec ">" addr-spec = unique-string "@" FQDN unique-string = <1*CHAR, not including whitespace, "@", or ">">
Message-ID: <9411151630.4256@info.cern.ch>
HTTP/1.0 messages may include a single MIME-Version header field to indicate what version of the MIME protocol was used to construct the message.
Unfortunately, current versions of HTTP/1.0 clients and servers use this field indiscriminately, and thus receivers must not take it for granted that the message is indeed in full compliance with MIME.
MIME-Version = "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
Request = Simple-Request | Full-Request Full-Request = Request-Line *General-Header *Request-Header *Object-Header CRLF [ Object-Body ]
Request-Header = User-Agent | If-Modified-Since | Pragma | Authorization | Proxy-Authorization | Referer | From | Accept | Accept-Encoding | Accept-Language
Response = Simple-Response | Full-Response
Simple-Response= [Object-Body]
Full-Response = Status-Line *General-Header *Response-Header *Object-Header CRLF [ Object-Body ]
Simple response is sent only in response to HTTP/0.9 simple request
Sample Full-response
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF Example:
Status-Code = 3DIGIT
Reason-Phrase = token *( SP token )
1xx: Not used, but reserved for future use
2xx: Success - The requested action was successfully received and understood
3xx: Redirection - Further action must be taken in order to complete the request
4xx: Client Error - The request contains bad syntax or is inherently impossible to fulfill
5xx: Server Error - The server could not fulfill the request
Full-Response = Status-Line *General-Header *Response-Header *Object-Header CRLF [ Object-Body ]
Response-Header= Server | WWW-Authenticate | Proxy-Authenticate | Retry-After
Unknown header fields should be considered Object-Header fields.
Object-Header = Allow | Content-Length | Content-Type | Content-Encoding | Content-Transfer-Encoding | Content-Language | Expires | Last-Modified | URI-header | Location | Version | Derived-From | Title | Link | extension-headerextension-header=HTTP-header
Set of methods allowed by the object
q (quality)
qs (quality server)
mxb
bs
{ if mxb=undefined, then (qs * q) } Q(q,qs,mxb,bs) = { if mxb >= bs, then (qs * q) } { if mxb < bs, then 0 }
The maximum of the Q function represents the preferred media-type
Telnet: saturn 8080 Server: accepts connection Telnet: GET /cs/cs596_3/ HTTP/1.0 Accept: audio/*; q=0.2, audio/basic
Accept: text/plain; q=0.5, text/html, text/x-dvi; q=0.8; mxb=100000, text/x-c