#include <udp.h>#include <www.h>
gehe zum Quellcode dieser Datei
Funktionen | |
| private string | HTMLunescape (string char) |
| private string | translate (string str) |
| private mapping | decode (string input) |
| private string | put (string key, mapping val) |
| private string | encode (mapping input) |
| void | Send (mapping data, string text, mixed back) |
| private string | exch (string str, mapping to) |
| private string | xcode (string str, mapping to) |
| void | udp_www (mapping data) |
Variablen | |
| private mixed | pending |
| private mapping decode | ( | string | input | ) |
Definiert in Zeile 51 der Datei www.c.
Benutzt cmds, i, old_explode() und translate().
00052 { 00053 mixed tmp; int i; 00054 mapping cmds; 00055 cmds = ([]); 00056 i = sizeof(tmp = old_explode(translate(input), "&")); 00057 while(i--) 00058 { 00059 if(sizeof(tmp[i] = old_explode(tmp[i], "=")) == 2) 00060 cmds[tmp[i][0]] = tmp[i][1]; 00061 } 00062 return cmds; 00063 }

| private string encode | ( | mapping | input | ) |
| private string exch | ( | string | str, | |
| mapping | to | |||
| ) |
| private string HTMLunescape | ( | string | char | ) |
Definiert in Zeile 22 der Datei www.c.
Benutzt len.
00023 { 00024 int len; 00025 if(!char || !(len = strlen(char))) return ""; 00026 if(char[0] == '%' && len = 3) { 00027 int val, ch; 00028 while(--len) { 00029 switch(char[len]) { 00030 case '0'..'9': 00031 val = (int)char[len..len]; 00032 break; 00033 case 'A'..'F': 00034 val = char[len]-55; 00035 break; 00036 } 00037 if(len < 2) val <<= 4; 00038 ch += val; 00039 } 00040 return sprintf("%c", ch); 00041 } 00042 return char; 00043 }
| private string put | ( | string | key, | |
| mapping | val | |||
| ) |
Definiert in Zeile 66 der Datei www.c.
Wird benutzt von put_objects().

| void Send | ( | mapping | data, | |
| string | text, | |||
| mixed | back | |||
| ) |
Definiert in Zeile 74 der Datei www.c.
Benutzt DATA, ID, INETD, NAME, pending, RECIPIENT, REPLY, REQUEST, SENDER und UDPPATH.
00075 { 00076 if(strstr((string)previous_object(), UDPPATH+"/")) return; 00077 if(!data && !pending) return; 00078 else if(!data && pending) 00079 { 00080 data = pending[0]; back = pending[1]; pending = 0; 00081 } 00082 INETD->_send_udp(data[NAME], ([ 00083 REQUEST: REPLY, 00084 RECIPIENT: data[SENDER], 00085 ID: data[ID], 00086 "URL":data[DATA], 00087 DATA: "\n\n"+text+"\n" 00088 ])); 00089 }
| private string translate | ( | string | str | ) |
| void udp_www | ( | mapping | data | ) |
Definiert in Zeile 103 der Datei www.c.
Benutzt BACK, cmds, ctime(), DATA, decode(), encode(), error(), log_file, pending, R_INTERMUD, REQ, Request(), text(), WWWLOG und xcode().
00104 { 00105 string text, error; 00106 string back; int size; 00107 mapping cmds; 00108 error = catch(size = sizeof(cmds = decode(data[DATA]))); 00109 if(cmds[BACK]) back = xcode(cmds[BACK], (["XampX":"&", "XeqX":"="])); 00110 cmds[BACK] = xcode(encode(cmds-([BACK])), (["&":"XampX", "=":"XeqX"])); 00111 if(error || 00112 error=catch(text=("/"+object_name(this_object())+"."+cmds[REQ])->Request(cmds))) 00113 { 00114 #ifdef DEBUG 00115 text = "<H1>Fehler: "+error+"</H1><HR><H3>Kontext:</H3>" 00116 + "<PRE>"+sprintf("%O", data)+"</PRE>"; 00117 #else 00118 text = "<H1>Fehler: Anfrage konnte nicht bearbeitet werden!</H1>"; 00119 #endif 00120 log_file(WWWLOG, "ERROR: "+error[0..<2]+", DATA FOLLOWS:\n"); 00121 } 00122 log_file(WWWLOG, sprintf("[%s] %s\n", ctime(time())[4..15], data[DATA])); 00123 if(cmds[REQ] == R_INTERMUD && !text) 00124 { 00125 pending = ({data, back}); 00126 return 0; 00127 } 00128 pending = 0; 00129 funcall(#'Send, data, text, back); 00130 }

| private string xcode | ( | string | str, | |
| mapping | to | |||
| ) |
1.6.3