Beruflich Dokumente
Kultur Dokumente
telnet is a
TELNET protocol.
TELNET
Server Process
NVT
TCP
NVT
TCP
TELNET
Negotiated Options
All NVTs support a minimal set of capabilities.
protocol,
so that new terminal features can be incorporated without changing the TELNET protocol.
acceptable options
Line mode vs. character mode echo modes character set (EBCDIC vs. ASCII)
TELNET
Control Functions
TELNET includes support for a series of
TELNET
Control Functions
Interrupt Process (IP)
suspend/abort process.
Command Structure
All TELNET commands and data flow through
the same TCP connection. Commands start with a special character called the Interpret as Command escape character
The IAC code is 255. If a 255 is sent as data - it must be followed by another 255.
a single byte is presented to application/terminal the TELNET layer interprets this as a command.
TELNET 8
telnet is a
Sends whatever you type to the TCP socket. Prints whatever comes back through the TCP socket Useful for testing TCP servers (ASCII based protocols).
Many Unix systems have these servers running
(by default):
echo daytime
port 7 port 13
discard chargen
port 9 port 19
TELNET 9
TELNET
10
type ^], then "help" for a list of fancy TELNET stuff you can do in telnet.
TELNET
11
A Web Server is a HTTP server Most clients/servers today speak version 1.1,
HTTP
13
the lightness and speed necessary for distributed, hypermedia information systems.
Transport Independence The HTTP protocol generally takes place over a TCP connection, but the protocol itself is not dependent on a specific transport layer.
HTTP 14
Request - Response
HTTP has a simple structure:
port 80.
\r\n
Request-Line Headers . . .
blank line
Content...
HTTP 16
Request Line
Method URI HTTP-Version\r\n
The request line contains 3
tokens (words).
space characters separate the tokens. Newline (\n) seems to work by itself but the protocol requires CRLF
HTTP
17
Request Method
The Request Method can be:
GET PUT
HEAD POST
Methods
GET:
HEAD:
POST:
More Methods
PUT:
DELETE: remove
20
No server mentioned
HTTP 21
URI Usage
When dealing with a HTTP 1.1 server, only a
HTTP 1.1 servers are required to be capable of handling an absolute URI, but there are still some out there that wont
HTTP
22
Client tells the server what version it can talk (what options are supported, etc).
a request line.
If a server gets a request line with no HTTP version number, it assumes 0.9 HTTP 0.9 was used for many years.
HTTP 23
what kind of client what kind of content will be accepted who is making the request
Each header line contains
There can be 0 headers (HTTP 1.0) HTTP 1.1 requires a Host: header
HTTP 24
Referer: http://www.unr.edu/
HTTP
25
just CRLF
HTTP
26
POST
A POST request includes some
content (some
bytes).
Content-length: 267
HTTP
27
HTTP
28
HTTP
29
HTTP Response
ASCII Status Line Headers Section
Status-Line Headers . . .
blank line
Content...
Content can be anything (not just text) typically an HTML document or some kind of image.
HTTP
30
Status-Code
Message
HTTP
32
Response Headers
Provide the client with information about
what kind of document how big the document is how the document is encoded when the document was last modified
Response headers end with blank line
HTTP
33
Content-Encoding: gzip
HTTP
34
Content
Content can be anything (sequence of raw
bytes).
HTTP
35
Single Request/Reply
The client sends a complete request.
Persistent Connections
HTTP 1.1 supports persistent connections
HTTP
37
HTTP
38
HTTP
39
Browser
Proxy
HTTP Server
HTTP
40
requests.
domain names on the command line, you should refuse to forward requests to any server whose name is within a specified domain.
Lab #2
41
Lab #2
42
Testing
Tell your browser to use a proxy
Edit preferences/options.
Interrupt a long transfer (press stop). Fill out a form (probably uses POST). Test it with a browser. Test it with telnet Write an abusive client and a rude server!
Lab #2 43
What is expected
We should be able to surf through your proxy!
support every nitty-gritty detail. work on creating a working proxy (one you can use through a browser).
performance is not a big deal (but it shouldnt be horribly worse than without your proxy).
chunking, etc.
you need to turn off persistence if you don't want to handle it.
Lab #2 45
HTTP Headers
You will need to look at the Content-Length
header in a POST.
you need to know how many bytes to read after the end of the headers.
Connection (Proxy-Connection) headers or (at a minimum) to force Connection: close as a request header.
Lab #2
46
hard either).
just fork the server after calling accept. MAKE SURE YOU TAKE CARE OF ZOMBIES!
Lab #2 47