Roxen.git / server / modules / proxies / gopher.pike

version» Context lines:

Roxen.git/server/modules/proxies/gopher.pike:1:   // This is a roxen module. Copyright © 1996 - 2009, Roxen IS.      // Gopher proxy module.    - constant cvs_version = "$Id: gopher.pike,v 1.29 2009/05/07 14:15:55 mast Exp $"; + constant cvs_version = "$Id$";   constant thread_safe = 1;      #include <config.h>      #define CONNECTION_REFUSED "HTTP/1.0 500 Connection refused by remote " \   "host\r\nContent-type: text/html\r\n\r\n<title>Roxen: Connection " \   "refused </title>\n<h1>Proxy request failed</h1><hr /><font " \   "size=\"+2\"><i>Connection refused by remote host</i></font><hr><font " \   "size=\"-2\"><a href=http://www.roxen.com/>Roxen</a></font>"   
Roxen.git/server/modules/proxies/gopher.pike:199:    type=file[0..0];    file=file[1..strlen(file)-1];    }       GOPHER_WERR("Requesting file");       switch(type)    {    case "1": /* Directory, must be parsed. */    GOPHER_WERR("Is a menu"); -  ok->write(file + "\n"); +  ok->write(file + "\r\n");    ok->set_id(({ "", send_to, ok, key}));    ok->set_nonblocking(got_dir_data, lambda(){}, done_dir_data);    send_to->my_fd->write("HTTP/1.0 200 Yo! Gopher dir comming soon to a "    "screen near you\nContent-Type: text/html\n\n"    "<h1>Gopher menu</h1><hr>");    return;       /* 2 is phonebook(?). Should probably be parsed.. */    /* 3 is error (?) */       case "4": /* Mac binhex (of all types...) */ -  ok->write(file + "\n"); +  ok->write(file + "\r\n");    send_to->my_fd->write("HTTP/1.0 200 Yo! Gopher data comming soon to a "    "screen near you\n"    "Content-Type: application/mac-binhex\n\n");    break;       case "5": /* Dos binary (of all types...) */ -  ok->write(file + "\n"); +  ok->write(file + "\r\n");    send_to->my_fd->write("HTTP/1.0 200 Yo!\n"    "Content-Type: application/x-dosbinary\n\n");    break;       case "6": /* Unix UUENCODE */ -  ok->write(file + "\n"); +  ok->write(file + "\r\n");    send_to->my_fd->write("HTTP/1.0 200 Yo!\n"    "Content-Type: application/x-uuencode\n\n");    break;       case "9": /* Binary */ -  ok->write(file + "\n"); +  ok->write(file + "\r\n");    send_to->my_fd->write("HTTP/1.0 200 Yo!\n"    "Content-Type: application/binary\n\n");    break;       case "g": /* Gif image */ -  ok->write(file + "\n"); +  ok->write(file + "\r\n");    send_to->my_fd->write("HTTP/1.0 200 Gopher data\n"    "Content-Type: image/gif\n\n");    break;       case "I": /* _some_ image, lets pretend it's a jpeg.. :) */ -  ok->write(file + "\n"); +  ok->write(file + "\r\n");    send_to->my_fd->write("HTTP/1.0 200 to a screen near you\n"    "Content-Type: image/jpeg\n\n");    break;       case "7": /* Search, should be handled separately.. */    if(!query)    {    send_to->my_fd->write("HTTP/1.0 200 Yo! Gopher data comming soon to a "    "screen near you\nContent-Type: text/html\n\n"    "<h1>Gopher search</h1>"    "<isindex prompt=\"Gopher search: \">");    destruct(ok);    destruct(send_to);    return;    }    send_to->my_fd->write("HTTP/1.0 200 Yo! Gopher data comming soon to a "    "screen near you\nContent-Type: text/html\n\n"    "<h1>Gopher Search</h1>"    "<isindex prompt=\"Gopher search: \">"); -  ok->write(file + " " + query + "\n"); +  ok->write(file + " " + query + "\r\n");    ok->set_id(({ "", send_to, ok}));    ok->set_nonblocking(got_dir_data, lambda(){}, done_dir_data);    return;       case "T": /* Tn 3270, shouldn't be here */    case "+": /* Extra server, shouldn't be here */    case "8": /* Shouldn't be here... */    default: -  ok->write(file + "\n"); +  ok->write(file + "\r\n");    send_to->my_fd->write("HTTP/1.0 200 Yo! Gopher data comming soon to a "    "screen near you\nContent-Type: text/plain\n\n");       }    async_pipe(send_to->my_fd, ok, 0, 0, "gopher", key);    send_to->disconnect();    /* Go for it... :) */    return;   }