#!/usr/bin/env python # -*- coding: utf-8 -*- from gaidaros import Gaidaros def multiline_split(x): _loc = x.find('\n\n') + 2 if _loc - 2 < len(x): return (x[:_loc], x[_loc:]) else: return (x, '') server = Gaidaros(end_request = lambda x: '\n\n' in x, split_request = multiline_split) server.serve()
def _do_multiple(*args, **kwargs): kwargs.update({'handle_request': lambda x: (x, True)}) srv = Gaidaros(*args, **kwargs) srv.serve()
def _do_single(*args, **kwargs): srv = Gaidaros(*args, **kwargs) srv.handle()
#!/usr/bin/env python # -*- coding: utf-8 -*- from gaidaros import Gaidaros # ...handles Unix and MS EOLs server = Gaidaros(handle_request = lambda x: ("Hello World: you said \"{}\"\r\n".format(x.rstrip('\r\n')), False) server.handle()