# -*- coding: iso-8859-2 -*-

from serv import MyServer

def ize(r):
	st = ""
	for s in r.header_list:
		st += str(s) + ", "
	return st
n = 0


def my_proc(req, resp):
	global n
	n = n + 1
	resp.body = '''
	<html>
        <head>
        <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-2">
        <head>
	<body>
    ''' + str(n) + '''. hívás <br> ''' + str(req.headers['User-Agent']) + ''' böngészőből<br>
	<p>
    Request method: ''' + str(req.method) + '''
    <p>
	<br>Újdonság: q=''' + str(req.params.get('q')) + '''<br>
	
    Query parameters: ''' + str(req.params) + str(req.params.__class__) + '''
    <hr>
    Request header:''' + ize(req) + '''
    </body>
	</html>
	'''

s = MyServer(9090)
s.publish("/hello", my_proc)
s.publish_file("/izeke", "na.html")
s.start()
	

