File: cgi_8c-source.html

package info (click to toggle)
klone 1.1.1.dfsg1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,480 kB
  • ctags: 4,238
  • sloc: ansic: 16,288; makefile: 384; sh: 351
file content (74 lines) | stat: -rw-r--r-- 4,999 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>KLone: cgi.c Source File</title>
<link href="kl.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">src</a>&nbsp;/&nbsp;<a class="el" href="dir_000005.html">libhttp</a></div>
<h1>cgi.c</h1><a href="cgi_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span>
00002 <span class="comment"> * Copyright (c) 2005, 2006 by KoanLogic s.r.l. &lt;http://www.koanlogic.com&gt;</span>
00003 <span class="comment"> * All rights reserved.</span>
00004 <span class="comment"> *</span>
00005 <span class="comment"> * This file is part of KLone, and as such it is subject to the license stated</span>
00006 <span class="comment"> * in the LICENSE file which you have received as part of this distribution.</span>
00007 <span class="comment"> *</span>
00008 <span class="comment"> * $Id: cgi.c,v 1.8 2006/01/09 12:38:38 tat Exp $</span>
00009 <span class="comment"> */</span>
00010 
00011 <span class="preprocessor">#include "klone_conf.h"</span>
00012 <span class="preprocessor">#include &lt;u/libu.h&gt;</span>
00013 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
00014 <span class="preprocessor">#include &lt;<a class="code" href="cgi_8h.html">klone/cgi.h</a>&gt;</span>
00015 <span class="preprocessor">#include &lt;<a class="code" href="request_8h.html">klone/request.h</a>&gt;</span>
00016 
<a name="l00017"></a><a class="code" href="cgi_8h.html#a0">00017</a> <span class="keywordtype">int</span> <a class="code" href="cgi_8h.html#a0">cgi_set_request</a>(<a class="code" href="request_8h.html#a0">request_t</a> *rq)
00018 {
00019     <span class="keywordtype">char</span> *ev;
00020 
00021     <span class="comment">/* clear uri-related request fields */</span>
00022     <a class="code" href="group__request__t.html#ga18">request_clear_uri</a>(rq);
00023 
00024     dbg_err_if (rq == NULL);
00025 
00026     <span class="comment">/* dbg_err_if(request_set_filename(rq, getenv("SCRIPT_NAME"))); */</span>
00027 
00028     <span class="comment">/* use PATH_INFO as script name i.e. </span>
00029 <span class="comment">        http://site/cgi-bin/kloned/path/to/script.kl1 */</span>
00030     <span class="keywordflow">if</span>((ev = getenv(<span class="stringliteral">"PATH_INFO"</span>)) != NULL)
00031         dbg_err_if(<a class="code" href="group__request__t.html#ga9">request_set_filename</a>(rq, ev));
00032     <span class="keywordflow">else</span>
00033         dbg_err_if(<a class="code" href="group__request__t.html#ga9">request_set_filename</a>(rq, <span class="stringliteral">"/"</span>));
00034 
00035     <span class="keywordflow">if</span>((ev = getenv(<span class="stringliteral">"PATH_INFO"</span>)) != NULL)
00036         dbg_err_if(<a class="code" href="group__request__t.html#ga19">request_set_path_info</a>(rq, ev));
00037 
00038     <span class="keywordflow">if</span>((ev = getenv(<span class="stringliteral">"QUERY_STRING"</span>)) != NULL)
00039         dbg_err_if(<a class="code" href="group__request__t.html#ga17">request_set_query_string</a>(rq, ev));
00040 
00041     <span class="keywordflow">if</span>((ev = getenv(<span class="stringliteral">"REQUEST_METHOD"</span>)) != NULL)
00042         dbg_err_if(<a class="code" href="group__request__t.html#ga23">request_set_method</a>(rq, ev));
00043 
00044     <span class="keywordflow">if</span>((ev = getenv(<span class="stringliteral">"CONTENT_TYPE"</span>)) != NULL)
00045         dbg_err_if(<a class="code" href="group__request__t.html#ga6">request_set_field</a>(rq, <span class="stringliteral">"Content-Type"</span>, ev));
00046 
00047     <span class="keywordflow">if</span>((ev = getenv(<span class="stringliteral">"CONTENT_LENGTH"</span>)) != NULL)
00048         dbg_err_if(<a class="code" href="group__request__t.html#ga6">request_set_field</a>(rq, <span class="stringliteral">"Content-Length"</span>, ev));
00049 
00050     <span class="keywordflow">return</span> 0;
00051 err:
00052     <span class="keywordflow">return</span> ~0;
00053 }
</pre></div><hr>
<div> 
  <div style="text-align:left">
    <a href="http://www.koanlogic.com/kl/cont/gb/html/products.html">&larr;Products</a>
  </div>
  <div style="text-align:center;">
    &copy; 2005-2006 - <a href="http://www.koanlogic.com">KoanLogic S.r.l.</a> - All rights reserved
  </div>
</div>

</body>
</html>