Adresy ciekawych miejsc


idź do góry

Example 1: Bad client request


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3GET / HTTP/1.1
 4(empty line)
 5Server response: 
 6HTTP/1.1 400 Bad Request
 7Date: Fri, 19 Mar 2004 19:27:23 GMT
 8Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
 9Connection: close
10Transfer-Encoding: chunked
11Content-Type: text/html; charset=iso-8859-1
12  
13<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
14<HTML>&lt;HEAD>
15<TITLE>400 Bad Request</TITLE>
16</HEAD><BODY>
17<H1>Bad Request</H1>
18Your browser sent a request that this server could not understand.<P>
19client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23) 
20</P> 
21<HR>
22<ADDRESS>Apache/1.3.28 Server at sirius.cs.put.poznan.pl Port 80
23</ADDRESS>
24</BODY>
25</HTML>

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 2: Valid HTTP/1.1 client request


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3GET / HTTP/1.1
 4Host: unixlab
 5(empty line)

 6Server response:
 7HTTP/1.1 200 OK
 8Date: Fri, 19 Mar 2004 19:27:34 GMT
 9Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
10Last-Modified: Mon, 24 Nov 2003 12:35:52 GMT
11ETag: "6d2-252-3fc1fb28"
12Accept-Ranges: bytes
13Content-Length: 594
14Content-Type: text/html
15  
16<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
17<html>
18<head>
19<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
20<meta name="Author" content="CS">
21<meta name="Description" content="UnixLab Home Page">
22<title>Laboratorium systemów Uniksowych</title>
23</head>
24<body>
25<h1>Serwer sirius.cs.put.poznan.pl</h1>
26<hr>
27<p>To jest strona serwera <strong>sirius.cs.put.poznan.pl</strong>.Właściwe
28strony laboratorium uniksowego znajdują się pod adresem: 
29<a href="http://unixlab.cs.put.poznan.pl">http://unixlab.cs.put.poznan.pl
30</a>.
31</p>
32<hr>
33</body>
34</html>

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 3: Get text file


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3GET /~kobus/dane.txt HTTP/1.1
 4host: unixlab
 5(empty line)

 6Server response:
 7HTTP/1.1 200 OK
 8Date: Fri, 19 Mar 2004 19:31:25 GMT
 9Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
10Last-Modified: Fri, 19 Mar 2004 19:29:50 GMT
11ETag: "1e8f38-21-405b4a2e"
12Accept-Ranges: bytes
13Content-Length: 33
14Content-Type: text/plain

15to jest zawartosc
16pliku DANE.TXT

[pokaż zawartość pliku] [pobierz plik] idź do góry

Server Status Codes


  • 100 Continue
  • 101 Switching Protocols
  • 200 OK
  • 201 Created
  • 202 Accepted
  • 203 Non-Authoritative Information
  • 204 No Content
  • 205 Reset Content
  • 206 Partial Content
  • 300 Multiple Choices
  • 301 Moved Permanently
  • 302 Found
  • 303 See Other
  • 304 Not Modified
  • 305 Use Proxy
  • 307 Temporary Redirect
  • 400 Bad Requestv
  • 401 Unauthorized
  • 402 Payment Required
  • 403 Forbidden
  • 404 Not Found
  • 405 Method Not Allowed
  • 406 Not Acceptable
  • 407 Proxy Authentication Required
  • 408 Request Time-out
  • 409 Conflict
  • 410 Gone
  • 411 Length Required
  • 412 Precondition Failed
  • 413 Request Entity Too Large
  • 414 Request-URI Too Large
  • 415 Unsupported Media Type
  • 416 Requested range not satisfiable
  • 417 Expectation Failed
  • 500 Internal Server Error
  • 501 Not Implemented
  • 502 Bad Gateway
  • 503 Service Unavailable
  • 504 Gateway Time-out
  • 505 HTTP Version not supported
idź do góry

Example 4: Get part of text file


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3GET /~kobus/dane.txt HTTP/1.1
 4Host: unixlab
 5Range: bytes=3-16
 6(empty line)

 7Server response:
 8HTTP/1.1 206 Partial Content
 9Date: Fri, 19 Mar 2004 19:49:08 GMT
10Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
11Last-Modified: Fri, 19 Mar 2004 19:29:50 GMT
12ETag: "1e8f38-21-405b4a2e"
13Accept-Ranges: bytes
14Content-Length: 7
15Content-Range: bytes 3-16/33
16Content-Type: text/plain
17jest zawartosc

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 5: OPTION command


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3OPTIONS / HTTP/1.1
 4Host: unixlab
 5(empty line)

 6Server response:
 7HTTP/1.1 200 OK
 8Date: Fri, 19 Mar 2004 19:33:01 GMT
 9Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
10Content-Length: 0
11Allow: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, PATCH, PROPFIND, 
12PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, TRACE

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 6: Request for directory without "/"


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3GET /~kobus HTTP/1.1
 4host: unixlab

 5Server response:
 6HTTP/1.1 301 Moved Permanently
 7Date: Fri, 19 Mar 2004 19:59:00 GMT
 8Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
 9Location: http://sirius.cs.put.poznan.pl/~kobus/
10Transfer-Encoding: chunked
11Content-Type: text/html; charset=iso-8859-1

12<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
13<HTML><HEAD>
14<TITLE>301 Moved Permanently</TITLE>
15</HEAD><BODY>
16<H1>Moved Permanently</H1>
17The document has moved <A HREF="http://sirius.cs.put.poznan.pl/~kobus/">
18here</A>.<P>
19<HR>
20<ADDRESS>Apache/1.3.28 Server at sirius.cs.put.poznan.pl Port 80</ADDRESS>
21</BODY></HTML>

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 7: Get default language version of the document


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3GET /~kobus/ HTTP/1.1
 4host: unixlab

 5Server response:
 6HTTP/1.1 200 OK
 7Date: Fri, 19 Mar 2004 19:59:44 GMT
 8Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
 9Content-Location: index.html.en
10Vary: negotiate,accept-language
11TCN: choice
12Last-Modified: Fri, 19 Mar 2004 19:58:21 GMT
13ETag: "1e92a5-36-405b50dd;405b50eb"
14Accept-Ranges: bytes
15Content-Length: 54
16Content-Type: text/html
17Content-Language: en

18<html>
19<body>
20<h1>Good Morning !</h1>
21</body>
22</html>

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 8: Get specified language version of the document


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3GET /~kobus/ HTTP/1.1
 4Host: unixlab
 5Accept-language: pl, de

 6Server response:
 7HTTP/1.1 200 OK
 8Date: Fri, 19 Mar 2004 20:00:15 GMT
 9Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
10Content-Location: index.html.po
11Vary: negotiate,accept-language
12TCN: choice
13Last-Modified: Fri, 19 Mar 2004 19:57:51 GMT
14ETag: "1e92a1-35-405b50bf;405b50eb"
15Accept-Ranges: bytes
16Content-Length: 53
17Content-Type: text/html
18Content-Language: pl

19<html>
20<body>
21<h1>Dzień dobry !</h1>
22</body>
23</html>

[pokaż zawartość pliku] [pobierz plik] idź do góry

Authorize access to WWW


_/*Step 1: create file .htaccess with content :_*/
  AuthType Basic
  AuthName "By Invitation Only"
  AuthUserFile /home/kobus/public_html/secure/passwords
  Require user test1

_/*Step 2: create password file .htpasswd_*/
  htpasswd -cb .htpasswd test1 test1

_/*Step 3: get encoded value of user:password string (here PHP example)_*/
  <?php
  $str = 'test1:test1';
  echo "original: $str<br>";
  echo "encoded : ".base64_encode($str);
  ?>
idź do góry

Example 9: Authorization failure


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3GET /~kobus/secure/ HTTP/1.1
 4host: unixlab

 5Server response:
 6HTTP/1.1 401 Authorization Required
 7Date: Fri, 19 Mar 2004 20:52:16 GMT
 8Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
 9WWW-Authenticate: Basic realm="By Invitation Only"
10Transfer-Encoding: chunked
11Content-Type: text/html; charset=iso-8859-1

12<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
13<HTML><HEAD>
14<TITLE>401 Authorization Required</TITLE>
15</HEAD><BODY>
16<H1>Authorization Required</H1>
17This server could not verify that you
18are authorized to access the document
19requested.  Either you supplied the wrong
20credentials (e.g., bad password), or your
21browser doesnt understand how to supply
22the credentials required.<P>
23<HR>
24<ADDRESS>Apache/1.3.28 Server at sirius.cs.put.poznan.pl Port 80</ADDRESS>
25</BODY></HTML>

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 10: Authorization succesfull


 1Client request:
 2kobus@sirius:~> netcat unixlab 80
 3GET /~kobus/secure/ HTTP/1.1
 4host: unixlab
 5authorization: Basic dGVzdDE6dGVzdDE=

 6Server response:
 7HTTP/1.1 200 OK
 8Date: Fri, 19 Mar 2004 21:22:15 GMT
 9Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
10Last-Modified: Fri, 19 Mar 2004 20:59:13 GMT
11ETag: "1033a-44-405b5f21"
12Accept-Ranges: bytes
13Content-Length: 68
14Content-Type: text/html

15<html>
16<body>
17<h1>To jest sekretny dokument :)</h1>
18</body>
19</html>

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 11: Emulation of Web server


 1Client request:
 2kobus@sirius:~> mozilla http://unixlab:8081/

 3Server response:
 4kobus@sirius:~> netcat -l -p 8081
 5GET / HTTP/1.1
 6Accept: */*
 7Accept-Language: pl,en;q=0.7,en-us;q=0.3
 8Accept-Encoding: gzip, deflate
 9User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
10Host: unixlab:8081
11Connection: Keep-Alive

12HTTP/1.1 200 OK
13Server: testowy 1.0
14Content-Type: text/html; charset=iso-8859-1

15<html>
16<body>
17this page is created manually !
18</body>
19</html>

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 12: Set temporary cookie


 1Client request:
 2kobus@sirius:~> mozilla http://unixlab:8081/

 3Server response after 1st client request:
 4kobus@sirius:~/public_html> netcat -l -p 8081
 5GET / HTTP/1.1
 6Accept: */*
 7Accept-Language: pl,en;q=0.7,en-us;q=0.3
 8Accept-Encoding: gzip, deflate
 9User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
10Host: unixlab:8081
11Connection: Keep-Alive
12  
13HTTP/1.1 200 OK
14Server: testowy 1.0
15Content-Type: text/html; charset=iso-8859-2
16Set-Cookie: Secret1=12345
17  
18Server response after 2nd client request:
19GET / HTTP/1.1
20Accept: */*
21Accept-Language: pl,en;q=0.7,en-us;q=0.3
22Accept-Encoding: gzip, deflate
23User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
24Host: unixlab:8081
25Connection: Keep-Alive
26Cookie: Secret1=12345

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 13: Set temporary cookie II


 1Client request:
 2kobus@sirius:~> mozilla http://unixlab:8081/
 3  
 4Server response:
 5kobus@sirius:~/public_html> netcat -l -p 8081
 6GET / HTTP/1.1
 7Accept: */*
 8Accept-Language: pl,en;q=0.7,en-us;q=0.3
 9Accept-Encoding: gzip, deflate
10User-Agent: Mozilla/4.0 
11Host: unixlab:8081
12Connection: Keep-Alive

13HTTP/1.1 200 OK
14Server: testowy 1.0
15Content-Type: text/html; charset=iso-8859-2
16Set-Cookie: Secret2=12345; expires=Fri, 30 Apr 2004 15:00:00 GMT

[pokaż zawartość pliku] [pobierz plik] idź do góry

Example 14: Show picture


 1Client request:
 2kobus@sirius:~> mozilla http://unixlab:8081/
 3  
 4Server response:
 5kobus@sirius:~/public_html> netcat -l -p 8081
 6GET / HTTP/1.1
 7Accept: */*
 8Accept-Language: pl,en;q=0.7,en-us;q=0.3
 9Accept-Encoding: gzip, deflate
10User-Agent: Mozilla/4.0 
11Host: unixlab:8081
12Connection: Keep-Alive

13HTTP/1.1 200 OK
14Date: Fri, 02 Apr 2004 19:55:24 GMT
15Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3
16Last-Modified: Wed, 08 Oct 2003 12:52:42 GMT
17ETag: "4507b6-7e-3f84089a"
18Accept-Ranges: bytes
19Content-Length: 126
20Content-Type: image/gif

21GIF89a,....

[pokaż zawartość pliku] [pobierz plik] idź do góry