File: hosting.sql

package info (click to toggle)
virtuoso-opensource 6.1.6+dfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 260,992 kB
  • ctags: 125,220
  • sloc: ansic: 652,748; sql: 458,419; xml: 282,834; java: 61,031; sh: 40,031; cpp: 36,890; cs: 25,240; php: 12,692; yacc: 9,523; lex: 7,018; makefile: 6,157; jsp: 4,484; awk: 1,643; perl: 1,013; ruby: 1,003; python: 326
file content (92 lines) | stat: -rw-r--r-- 3,201 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--
--  $Id$
--
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--
--  Copyright (C) 1998-2012 OpenLink Software
--
--  This project is free software; you can redistribute it and/or modify it
--  under the terms of the GNU General Public License as published by the
--  Free Software Foundation; only version 2 of the License, dated June 1991.
--
--  This program is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--  General Public License for more details.
--
--  You should have received a copy of the GNU General Public License along
--  with this program; if not, write to the Free Software Foundation, Inc.,
--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
--
create procedure WS.WS.GET_CGI_VARS_VECTOR (inout lines any) returns ANY
{
  declare options any;
  declare sys_addr varchar;
  declare server_addr varchar;
  declare host varchar;
  declare line varchar;
  declare fld varchar;
  declare server_name varchar;
  declare first_colon integer;

  sys_addr := sys_connected_server_address ();
  server_addr := split_and_decode (sys_addr, 0, '\0\0:');
  server_name := server_addr[0];
  host := http_request_header (lines, 'HOST', null, null);
  if (host is not null)
    {
      first_colon := strchr (host, ':');
      if (first_colon is null)
	server_name := trim (host);
      else
	server_name := trim (subseq (host, 0, first_colon));
    }
  options := vector (
    '__VIRT_CGI', 		'1'
   ,'__VIRT_APP_UID', 		http_map_get ('vsp_uid')
   ,'__VIRT_APP_LPATH', 	http_map_get ('domain')
   ,'__VIRT_APP_PPATH', 	http_map_get ('mounted')
   ,'SERVER_SOFTWARE', 		'Virtuoso Universal Server/6.0'
   ,'SERVER_SIGNATURE',		'Virtuoso Universal Server/6.0 on ' || sys_addr
   ,'SERVER_NAME', 		server_name
   ,'SERVER_ADDR', 		server_addr[0]
   ,'DOCUMENT_ROOT', 		http_root()
   ,'GATEWAY_INTERFACE',	'CGI/1.1'
   ,'SERVER_PROTOCOL',		http_request_get ('SERVER_PROTOCOL')
   ,'SERVER_PORT',		server_addr[1]
   ,'REQUEST_METHOD',		http_request_get ('REQUEST_METHOD')
   ,'REQUEST_URI',		http_request_get ('REQUEST_URI')
 --,'PATH_INFO',		''
   ,'PATH_TRANSLATED',		http_root() || http_physical_path ()
   ,'SCRIPT_NAME',		http_path ()
   ,'SCRIPT_FILENAME',		http_root() || http_physical_path ()
   ,'QUERY_STRING',		http_request_get ('QUERY_STRING')
   ,'REMOTE_ADDR',		http_client_ip ()
   ,'AUTHORIZATION',		http_auth ()
   ,'CONTENT_TYPE',		http_request_header_full (lines, 'Content-Type', '')
   ,'CONTENT_LENGTH',		http_request_header_full (lines, 'Content-Length', '0')
  );
  if (is_https_ctx ())
    options := vector_concat (options, vector ('HTTPS', 'on'));

  declare inx integer;
  inx := 1;
  while (inx < length (lines))
    {
      line := lines[inx];
      first_colon := strchr (line, ':');
      if (first_colon is not null)
	{
	  fld := trim (subseq (line, 0, first_colon));
	  options := vector_concat (options, vector (
		       concat ('HTTP_', upper (replace (fld, '-', '_'))),
		       http_request_header_full (lines, fld)));
	}
      inx := inx + 1;
    }
  return options;
}
;