Annotation of parser3/src/main/pa_request.C, revision 1.116
1.54 paf 1: /** @file
1.55 paf 2: Parser: request class main part. @see compile.C and execute.C.
3:
1.9 paf 4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.55 paf 5:
1.14 paf 6: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
1.9 paf 7:
1.116 ! paf 8: $Id: pa_request.C,v 1.115 2001/04/19 11:57:00 paf Exp $
1.1 paf 9: */
10:
1.70 paf 11: #include "pa_config_includes.h"
1.19 paf 12:
1.96 paf 13: #include <locale.h>
14:
1.69 paf 15: #include "pa_sapi.h"
1.53 paf 16: #include "pa_common.h"
1.1 paf 17: #include "pa_request.h"
1.3 paf 18: #include "pa_wwrapper.h"
19: #include "pa_vclass.h"
1.100 paf 20: #include "_op.h"
1.17 paf 21: #include "_table.h"
1.82 paf 22: #include "_file.h"
1.31 paf 23: #include "pa_globals.h"
1.30 paf 24: #include "pa_vint.h"
1.112 paf 25: #include "pa_vmethod_frame.h"
1.32 paf 26: #include "pa_types.h"
1.78 paf 27: #include "pa_vtable.h"
1.89 paf 28: #include "_random.h"
1.90 paf 29: #include "pa_vfile.h"
1.101 paf 30: #include "_mail.h"
1.106 paf 31: #include "_exec.h"
1.109 paf 32: #include "_image.h"
1.3 paf 33:
1.109 paf 34: /// $LIMITS.post_max_size default 10M
1.72 paf 35: const size_t MAX_POST_SIZE_DEFAULT=10*0x400*400;
36:
1.82 paf 37: /// content type of exception response, when no @MAIN:exception handler defined
38: const char *UNHANDLED_EXCEPTION_CONTENT_TYPE="text/plain";
39:
40: /// content type of response when no $MAIN:defaults.content-type defined
41: const char *DEFAULT_CONTENT_TYPE="text/html";
42:
1.72 paf 43: //
1.28 paf 44: Request::Request(Pool& apool,
1.33 paf 45: Info& ainfo,
1.43 paf 46: String::Untaint_lang adefault_lang) : Pooled(apool),
1.3 paf 47: stack(apool),
1.100 paf 48: OP(apool),
1.41 paf 49: env(apool),
50: form(apool),
51: request(apool, *this),
52: response(apool),
1.51 paf 53: cookie(apool),
1.3 paf 54: fclasses(apool),
1.43 paf 55: fdefault_lang(adefault_lang), flang(adefault_lang),
56: info(ainfo),
1.105 paf 57: post_data(0), post_size(0),
1.85 paf 58: used_files(apool),
1.74 paf 59: default_content_type(0),
1.94 paf 60: mime_types(0),
1.103 paf 61: connection(0), protocol2library(0),
62: mail(0)
1.3 paf 63: {
1.27 paf 64: // root superclass,
1.3 paf 65: // parent of all classes,
66: // operators holder
1.100 paf 67: initialize_op_class(pool(), OP);
68: classes().put(*op_class_name, &OP);
1.27 paf 69: // table class
70: classes().put(*table_class_name, table_class);
1.82 paf 71: // file class
72: classes().put(*file_class_name, file_class);
1.89 paf 73: // random class
74: classes().put(*random_class_name, random_class);
1.3 paf 75: // env class
1.41 paf 76: classes().put(*env_class_name, &env);
1.27 paf 77: // form class
1.41 paf 78: classes().put(*form_class_name, &form);
1.40 paf 79: // request class
1.41 paf 80: classes().put(*request_class_name, &request);
81: // response class
82: classes().put(*response_class_name, &response);
1.51 paf 83: // cookie class
84: classes().put(*cookie_class_name, &cookie);
1.101 paf 85: // mail class
1.106 paf 86: classes().put(*mail_class_name, mail_class);
1.109 paf 87: // image class
88: classes().put(*image_class_name, image_class);
1.45 paf 89: }
90:
1.64 paf 91: /**
92: load MAIN class, execute @main.
93: MAIN class consists of all the auto.p files we'd manage to find
94: plus
95: the file user requested us to process
96: all located classes become children of one another,
97: composing class we name 'MAIN'
1.96 paf 98:
1.115 paf 99: @test get rid of setlocale
1.64 paf 100: */
1.63 paf 101: void Request::core(const char *root_auto_path, bool root_auto_fail,
102: const char *site_auto_path, bool site_auto_fail,
1.62 paf 103: bool header_only) {
1.29 paf 104: VStateless_class *main_class=0;
1.41 paf 105: bool need_rethrow=false; Exception rethrow_me;
1.3 paf 106: TRY {
1.29 paf 107: char *auto_filespec=(char *)malloc(MAX_STRING);
108:
1.63 paf 109: // loading root auto.p
110: if(root_auto_path) {
1.77 paf 111: String& filespec=*NEW String(pool());
1.88 paf 112: filespec.APPEND_CLEAN(root_auto_path, 0, "root_auto", 0);
1.77 paf 113: filespec.APPEND_CONST("/" AUTO_FILE_NAME);
1.29 paf 114: main_class=use_file(
1.77 paf 115: filespec, root_auto_fail,
1.37 paf 116: main_class_name, main_class);
1.29 paf 117: }
118:
1.85 paf 119: // $MAIN:LIMITS hash used here,
1.72 paf 120: // until someone with less privileges have overriden them
1.78 paf 121: {
122: Value *limits=main_class?main_class->get_element(*limits_name):0;
1.106 paf 123: if(info.method && StrEqNc(info.method, "post", true)) {
1.105 paf 124: // $limits.post_max_size default 10M
125: Value *element=limits?limits->get_element(*post_max_size_name):0;
126: size_t value=element?(size_t)element->as_double():0;
127: size_t post_max_size=value?value:MAX_POST_SIZE_DEFAULT;
128:
1.110 paf 129: if(size_t limit=max(0, min(info.content_length, post_max_size))) {
1.106 paf 130: // read POST data
1.110 paf 131: post_data=(char *)malloc(limit);
132: post_size=SAPI::read_post(pool(), post_data, limit);
133: if(post_size!=limit)
1.105 paf 134: THROW(0, 0,
135: 0,
1.110 paf 136: "post_size(%d)!=limit(%d)",
137: post_size, limit);
1.105 paf 138: }
139: }
140:
141: form.fill_fields(*this);
1.78 paf 142: }
1.72 paf 143:
1.78 paf 144: // filling cookies
1.72 paf 145: cookie.fill_fields(*this);
146:
1.64 paf 147: // loading site auto.p
1.63 paf 148: if(site_auto_path) {
1.77 paf 149: String& filespec=*NEW String(pool());
1.88 paf 150: filespec.APPEND_CLEAN(site_auto_path, 0, "site_auto", 0);
1.77 paf 151: filespec.APPEND_CONST("/" AUTO_FILE_NAME);
1.37 paf 152: main_class=use_file(
1.77 paf 153: filespec, site_auto_fail,
1.37 paf 154: main_class_name, main_class);
1.29 paf 155: }
1.8 paf 156:
1.72 paf 157: // loading auto.p files from document_root/..
158: // to the one beside requested file.
159: // all assigned bases from upper dir
160: {
1.115 paf 161: Array ladder(pool());
162: const char *after=info.path_translated;
163: size_t drlen=strlen(info.document_root);
164: if(memcmp(after, info.document_root, drlen)==0) {
165: after+=drlen;
166: if(after[-1]=='/')
167: --after;
168: }
169:
170: while(const char *before=strchr(after, '/')) {
171: String& step=*NEW String(pool());
172: if(after!=info.path_translated) {
173: step.APPEND_CLEAN(
174: info.path_translated, before+1/* / */-info.path_translated,
175: "path-translated-scanned", ladder.size());
176: step << AUTO_FILE_NAME;
177: ladder+=&step;
178: }
179: after=before+1;
180: }
181: for(int i=ladder.size(); --i>=0; ) {
182: const String& sfile_spec=*ladder.get_string(i);
183: main_class=use_file(sfile_spec, false/*ignore read problem*/,
184: main_class_name, main_class);
1.72 paf 185: }
186: }
1.34 paf 187:
1.72 paf 188: // compiling requested file
1.77 paf 189: String& spath_translated=*NEW String(pool());
1.88 paf 190: spath_translated.APPEND_CLEAN(info.path_translated, 0, "user-request", 0);
1.77 paf 191: main_class=use_file(spath_translated, true/*don't ignore read problem*/,
1.72 paf 192: main_class_name, main_class);
1.7 paf 193:
1.85 paf 194: // $MAIN:DEFAULTS
1.78 paf 195: Value *defaults=main_class->get_element(*defaults_name);
1.75 paf 196: // value must be allocated on request's pool for that pool used on
197: // meaning constructing @see attributed_meaning_to_string
1.80 paf 198: default_content_type=defaults?defaults->get_element(*content_type_name):0;
1.78 paf 199: if(Value *element=main_class->get_element(*html_typo_name))
1.87 paf 200: if(Table *table=element->get_table())
201: pool().set_tag(table);
1.95 paf 202:
203: // $MAIN:SQL.drivers
204: if(Value *sql=main_class->get_element(*main_sql_name))
205: if(Value *element=sql->get_element(*main_sql_drivers_name))
206: protocol2library=element->get_table();
1.85 paf 207:
208: // $MAIN:MIME-TYPES
209: if(Value *element=main_class->get_element(*mime_types_name))
210: if(Table *table=element->get_table())
211: mime_types=table;
1.96 paf 212:
213: // $MAIN:LOCALE.ctype[Russian_Russia.1251]
214: /*
215: #define LC_ALL 0
216: #define LC_COLLATE 1
217: #define LC_CTYPE 2
218: #define LC_MONETARY 3
219: #define LC_NUMERIC 4
220: #define LC_TIME 5
221: */
222: if(Value *locale=main_class->get_element(*locale_name))
223: if(Value *element=locale->get_element(*locale_ctype_name)) {
224: const String& name=element->as_string();
225: if(!setlocale(LC_CTYPE, name.cstr()))
226: THROW(0, 0,
227: &name,
1.97 paf 228: "locale is invalid");
1.96 paf 229: }
1.102 paf 230:
231: // $MAIN:MAIL[$SMTP[mail.design.ru]]
232: if(Value *mail_element=main_class->get_element(*mail_name))
233: if(!(mail=mail_element->get_hash()))
234: THROW(0, 0,
235: 0,
236: "$MAIN:MAIL is not hash");
237:
1.25 paf 238:
239: // execute @main[]
1.41 paf 240: const String *body_string=execute_method(*main_class, *main_method_name);
241: if(!body_string)
1.25 paf 242: THROW(0,0,
243: 0,
244: "'"MAIN_METHOD_NAME"' method not found");
1.79 paf 245:
1.91 paf 246: VString body_vstring_before_post_process(*body_string);
247: VString *body_vstring_after_post_process=&body_vstring_before_post_process;
248:
249: // post-process
250: if(Value *value=main_class->get_element(*post_process_method_name))
251: if(Junction *junction=value->get_junction())
252: if(const Method *method=junction->method) {
253: // preparing to pass parameters to
254: // @post-process[data]
1.98 paf 255: VMethodFrame frame(pool(), *junction, false);
1.91 paf 256: frame.set_self(*main_class);
257:
258: frame.store_param(method->name,
259: &body_vstring_before_post_process);
260: body_vstring_after_post_process=
261: NEW VString(*execute_method(frame, *method));
262: }
1.90 paf 263:
1.91 paf 264: const VFile *body_file=body_vstring_after_post_process->as_vfile();
1.41 paf 265:
1.45 paf 266: // extract response body
267: Value *body_value=static_cast<Value *>(
268: response.fields().get(*body_name));
269: if(body_value) // there is some $request.body
1.90 paf 270: body_file=body_value->as_vfile();
1.45 paf 271:
272: // OK. write out the result
1.90 paf 273: output_result(*body_file, header_only);
1.3 paf 274: }
1.76 paf 275: CATCH(e) { // request handling problem
276: // we're returning not result, but error explanation
1.30 paf 277: TRY {
1.76 paf 278: // log the beast
279: const String *problem_source=e.problem_source();
1.114 paf 280: if(problem_source && problem_source->size())
1.76 paf 281: SAPI::log(pool(),
282: #ifndef NO_STRING_ORIGIN
283: "%s(%d): "
284: #endif
285: "'%s' %s [%s %s]",
286: #ifndef NO_STRING_ORIGIN
287: problem_source->origin().file?problem_source->origin().file:"global",
288: problem_source->origin().line,
289: #endif
1.99 paf 290: problem_source->cstr(String::UL_AS_IS),
1.76 paf 291: e.comment(),
1.99 paf 292: e.type()?e.type()->cstr(String::UL_AS_IS):"-",
293: e.code()?e.code()->cstr(String::UL_AS_IS):"-"
1.76 paf 294: );
295: else
296: SAPI::log(pool(),
297: "%s [%s %s]",
298: e.comment(),
1.99 paf 299: e.type()?e.type()->cstr(String::UL_AS_IS):"-",
300: e.code()?e.code()->cstr(String::UL_AS_IS):"-"
1.76 paf 301: );
1.43 paf 302:
303: // reset language to default
304: flang=fdefault_lang;
305:
306: // reset response
307: response.fields().clear();
308:
309: // this is what we'd return in $response:body
1.41 paf 310: const String *body_string=0;
1.43 paf 311:
1.30 paf 312: if(main_class) { // we've managed to end up with some main_class
313: // maybe we'd be lucky enough as to report an error
314: // in a gracefull way...
315: if(Value *value=main_class->get_element(*exception_method_name))
316: if(Junction *junction=value->get_junction())
317: if(const Method *method=junction->method) {
318: // preparing to pass parameters to
319: // @exception[origin;source;comment;type;code]
1.98 paf 320: VMethodFrame frame(pool(), *junction, false);
1.38 paf 321: frame.set_self(*main_class);
1.30 paf 322:
323: const String *problem_source=e.problem_source();
324: // origin
1.38 paf 325: Value *origin_value=0;
1.30 paf 326: #ifndef NO_STRING_ORIGIN
1.114 paf 327: if(problem_source && problem_source->size()) {
1.38 paf 328: const Origin& origin=problem_source->origin();
329: if(origin.file) {
330: char *buf=(char *)malloc(MAX_STRING);
1.106 paf 331: size_t buf_size=snprintf(buf, MAX_STRING, "%s(%d):",
1.38 paf 332: origin.file, 1+origin.line);
1.44 paf 333: String *origin_file_line=NEW String(pool(),
1.106 paf 334: buf, buf_size, true);
1.38 paf 335: origin_value=NEW VString(*origin_file_line);
336: }
1.30 paf 337: }
338: #endif
1.91 paf 339: frame.store_param(method->name,
1.38 paf 340: origin_value?origin_value:NEW VUnknown(pool()));
1.28 paf 341:
1.30 paf 342: // source
1.38 paf 343: Value *source_value=0;
1.114 paf 344: if(problem_source && problem_source->size()) {
1.47 paf 345: String& problem_source_copy=*NEW String(pool());
346: problem_source_copy.append(*problem_source,
347: flang, true);
1.43 paf 348: source_value=NEW VString(problem_source_copy);
349: }
1.91 paf 350: frame.store_param(method->name,
1.38 paf 351: source_value?source_value:NEW VUnknown(pool()));
1.30 paf 352:
353: // comment
1.44 paf 354: String *comment_value=NEW String(pool(),
1.106 paf 355: e.comment(), 0, true);
1.91 paf 356: frame.store_param(method->name,
1.30 paf 357: NEW VString(*comment_value));
358:
359: // type
360: Value *type_value;
1.43 paf 361: if(e.type()) {
1.47 paf 362: String& type_copy=*NEW String(pool());
363: type_value=NEW VString(type_copy.append(*e.type(),
364: flang, true));
1.43 paf 365: } else
1.30 paf 366: type_value=NEW VUnknown(pool());
1.91 paf 367: frame.store_param(method->name, type_value);
1.30 paf 368:
369: // code
370: Value *code_value;
1.43 paf 371: if(e.code()) {
1.47 paf 372: String& code_copy=*NEW String(pool());
373: code_value=NEW VString(code_copy.append(*e.code(),
374: flang, true));
1.43 paf 375: } else
1.30 paf 376: code_value=NEW VUnknown(pool());
1.91 paf 377: frame.store_param(method->name, code_value);
1.30 paf 378:
1.43 paf 379: // future $response:body=
380: // execute ^exception[origin;source;comment;type;code]
381: body_string=execute_method(frame, *method);
1.30 paf 382: }
383: }
384:
1.41 paf 385: if(!body_string) { // couldn't report an error beautifully?
386: // doing that ugly
387:
388: // make up result: $origin $source $comment $type $code
389: char *buf=(char *)malloc(MAX_STRING);
1.30 paf 390: size_t printed=0;
391: const String *problem_source=e.problem_source();
392: if(problem_source) {
1.16 paf 393: #ifndef NO_STRING_ORIGIN
1.30 paf 394: const Origin& origin=problem_source->origin();
395: if(origin.file)
1.41 paf 396: printed+=snprintf(buf+printed, MAX_STRING-printed, "%s(%d): ",
1.30 paf 397: origin.file, 1+origin.line);
1.28 paf 398: #endif
1.41 paf 399: printed+=snprintf(buf+printed, MAX_STRING-printed, "'%s' ",
1.99 paf 400: problem_source->cstr(String::UL_AS_IS));
1.30 paf 401: }
1.41 paf 402: printed+=snprintf(buf+printed, MAX_STRING-printed, "%s",
1.30 paf 403: e.comment());
404: const String *type=e.type();
405: if(type) {
1.41 paf 406: printed+=snprintf(buf+printed, MAX_STRING-printed, " type: %s",
1.99 paf 407: type->cstr(String::UL_AS_IS));
1.30 paf 408: const String *code=e.code();
409: if(code)
1.41 paf 410: printed+=snprintf(buf+printed, MAX_STRING-printed, ", code: %s",
1.99 paf 411: code->cstr(String::UL_AS_IS));
1.30 paf 412: }
1.43 paf 413:
414: // future $response:content-type
1.49 paf 415: response.fields().put(*content_type_name,
1.82 paf 416: NEW VString(*NEW String(pool(), UNHANDLED_EXCEPTION_CONTENT_TYPE)));
1.43 paf 417: // future $response:body
1.44 paf 418: body_string=NEW String(pool(), buf);
1.30 paf 419: }
1.41 paf 420:
1.90 paf 421: const VString body_vstring(*body_string);
422: const VFile *body_file=body_vstring.as_vfile();
423:
1.45 paf 424: // ERROR. write it out
1.90 paf 425: output_result(*body_file, header_only);
1.3 paf 426: }
1.30 paf 427: CATCH(e) {
1.41 paf 428: // exception in request exception handler
429: // remember to rethrow it
430: rethrow_me=e; need_rethrow=true;
1.1 paf 431: }
1.30 paf 432: END_CATCH
1.1 paf 433: }
1.41 paf 434: END_CATCH // do not use pool() after this point - no exception handler set
435: // any throw() would try to use zero exception() pointer
436:
1.91 paf 437: if(need_rethrow) // were there an exception for us to rethrow?
1.62 paf 438: THROW(rethrow_me.type(), rethrow_me.code(),
1.41 paf 439: rethrow_me.problem_source(),
440: rethrow_me.comment());
1.1 paf 441: }
442:
1.77 paf 443: VStateless_class *Request::use_file(const String& file_spec, bool fail_on_read_problem,
1.26 paf 444: const String *name,
445: VStateless_class *base_class) {
1.73 paf 446: // cyclic dependence check
1.77 paf 447: if(used_files.get(file_spec))
1.73 paf 448: return base_class;
1.77 paf 449: used_files.put(file_spec, (Hash::Val *)true);
1.73 paf 450:
451:
1.77 paf 452: char *source=file_read_text(pool(), file_spec, fail_on_read_problem);
1.3 paf 453: if(!source)
1.12 paf 454: return base_class;
1.3 paf 455:
1.77 paf 456: return use_buf(source, file_spec.cstr(), 0/*new class*/, name, base_class);
1.16 paf 457: }
458:
1.67 paf 459: VStateless_class *Request::use_buf(const char *source, const char *file,
1.26 paf 460: VStateless_class *aclass, const String *name,
461: VStateless_class *base_class) {
1.5 paf 462: // compile loaded class
1.26 paf 463: VStateless_class& cclass=COMPILE(source, aclass, name, base_class, file);
1.1 paf 464:
1.4 paf 465: // locate and execute possible @auto[] static method
1.25 paf 466: execute_method(cclass, *auto_method_name, false /*no result needed*/);
1.16 paf 467: return &cclass;
1.19 paf 468: }
469:
1.115 paf 470: /// @test with commandline start "parser3 a.html" so that ^load[a.cfg] worked! [now doesnt]
1.77 paf 471: const String& Request::relative(const char *apath, const String& relative_name) {
472: int lpath_buf_size=strlen(apath)+1;
473: char *lpath=(char *)malloc(lpath_buf_size);
474: memcpy(lpath, apath, lpath_buf_size);
475: rsplit(lpath, '/');
476: String& result=*NEW String(pool(), lpath);
1.104 paf 477: result << "/" << relative_name;
1.19 paf 478: return result;
479: }
480:
1.77 paf 481: const String& Request::absolute(const String& relative_name) {
482: char *relative_name_cstr=relative_name.cstr();
483: if(relative_name_cstr[0]=='/') {
484: String& result=*NEW String(pool(), info.document_root);
1.104 paf 485: result << relative_name;
1.19 paf 486: return result;
487: } else
1.77 paf 488: return relative(info.path_translated, relative_name);
1.1 paf 489: }
1.45 paf 490:
1.101 paf 491: static void add_header_attribute(const Hash::Key& aattribute, Hash::Val *ameaning,
492: void *info) {
493: String *attribute_to_exclude=static_cast<String *>(info);
494: if(aattribute==*attribute_to_exclude)
495: return;
496:
497: Value& lmeaning=*static_cast<Value *>(ameaning);
498: Pool& pool=lmeaning.pool();
499:
500: SAPI::add_header_attribute(pool,
1.116 ! paf 501: aattribute.cstr(String::UL_AS_IS),
1.101 paf 502: attributed_meaning_to_string(lmeaning, String::UL_HTTP_HEADER).cstr());
503: }
1.90 paf 504: void Request::output_result(const VFile& body_file, bool header_only) {
1.51 paf 505: // header: cookies
506: cookie.output_result();
507:
1.90 paf 508: // set content-type
509: if(String *body_file_content_type=static_cast<String *>(
510: body_file.fields().get(*vfile_mime_type_name))) {
511: // body file content type
512: response.fields().put(*content_type_name, body_file_content_type);
513: } else {
514: // default content type
515: response.fields().put_dont_replace(*content_type_name,
516: default_content_type?default_content_type
517: :NEW VString(*NEW String(pool(), DEFAULT_CONTENT_TYPE)));
1.92 paf 518: }
519:
520: // content-disposition
1.111 paf 521: if(VString *vfile_name=static_cast<VString *>(body_file.fields().get(*name_name)))
522: if(vfile_name->string()!=NONAME_DAT) {
523: VHash& vhash=*NEW VHash(pool());
524: vhash.hash().put(*content_disposition_filename_name, vfile_name);
525: response.fields().put(*content_disposition_name, &vhash);
526: }
1.49 paf 527:
1.62 paf 528: // prepare header: $response:fields without :body
1.73 paf 529: response.fields().for_each(add_header_attribute, /*excluding*/ body_name);
1.50 paf 530:
1.62 paf 531: // prepare...
1.90 paf 532: const void *body=body_file.value_ptr();
533: size_t content_length=body_file.value_size();
1.50 paf 534:
1.62 paf 535: // prepare header: content-length
1.65 paf 536: if(content_length) { // useful for redirecting [header "location: http://..."]
537: char content_length_cstr[MAX_NUMBER];
1.108 paf 538: snprintf(content_length_cstr, MAX_NUMBER, "%u", content_length);
1.69 paf 539: SAPI::add_header_attribute(pool(), "content-length", content_length_cstr);
1.65 paf 540: }
1.62 paf 541:
542: // send header
1.69 paf 543: SAPI::send_header(pool());
1.71 paf 544:
1.62 paf 545: // send body
546: if(!header_only)
1.69 paf 547: SAPI::send_body(pool(), body, content_length);
1.50 paf 548: }
1.104 paf 549:
550: const String& Request::mime_type_of(const char *user_file_name_cstr) {
551: if(mime_types)
552: if(const char *cext=strrchr(user_file_name_cstr, '.')) {
553: String sext(pool(), ++cext);
554: if(mime_types->locate(0, sext))
555: if(const String *result=mime_types->item(1))
556: return *result;
557: else
558: THROW(0, 0,
559: mime_types->origin_string(),
560: "MIME-TYPE table column elements must not be empty");
561: }
562: return *NEW String(pool(), "application/octet-stream");
563: }
E-mail: