in reply to Re: Perl - webserver
in thread Perl - webserver

http://pastebin.com/f19194081 that's what i have done so far :s any idea ?

Replies are listed 'Best First'.
Re^3: Perl - webserver
by CountZero (Bishop) on Mar 27, 2008 at 17:49 UTC
    I had a look at your code, but even when not being a networking-guru, I can see some problems:
    • You should use strict; and use warnings; to guard against silly mistakes, bad constructs and simple typos.
    • It is really a bare-bones, down-to-earth, ultra-simple type of webserver and as little as I know of it, web-servers are all but bare-bones, down-to-earth, ultra-simple kind of things. I'm not sure it is not full of ugly security holes, although you do some sanitizing of the request string.
    • It can handle only one connection at a time.
    • It can do no authentication / authorization.
    • ...
    Don't misunderstand me, I am not saying your code is not an honest try at writing (the beginnings of) a webserver, but these things are quite complicated by nature and without a good game-plan you are likely to bump into some issues later on and will have to start all over from scratch.

    As I am against re-inventing wheels, personally I would start with an existing design (see the links in my previous post) and adapt it as needed.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re^3: Perl - webserver
by ikegami (Patriarch) on Mar 27, 2008 at 18:02 UTC