ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaie_5.4.0.1/rzaiethrdprtymod.htm

151 lines
10 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="topic" />
<meta name="DC.Title" content="Set up third party modules for HTTP Server (powered by Apache)" />
<meta name="abstract" content="This topic provides information about how to set up third party modules for your HTTP Server." />
<meta name="description" content="This topic provides information about how to set up third party modules for your HTTP Server." />
<meta name="DC.Relation" scheme="URI" content="rzaieprogramming.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2002,2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2002,2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rzaiethrdprtymod" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Set up third party modules for HTTP Server (powered by Apache)</title>
</head>
<body id="rzaiethrdprtymod"><a name="rzaiethrdprtymod"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Set up third party modules for HTTP Server (powered by Apache)</h1>
<div><p>This topic provides information about how to set up third party
modules for your HTTP Server.</p>
<div class="important"><span class="importanttitle">Important:</span> Information
for this topic supports the latest PTF levels for HTTP Server for i5/OS .
It is recommended that you install the latest PTFs to upgrade to the latest
level of the HTTP Server for i5/OS. Some of the topics documented here are
not available prior to this update. See <a href="http://www-03.ibm.com/servers/eserver/iseries/software/http/services/service.html" target="_blank">http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm</a> <img src="www.gif" alt="Link outside Information Center" /> for more information. </div>
<p>The HTTP Server (powered by Apache) can extend its functionality in specific
areas of your server using modules. For example, a module could be configured
to create a new type of authentication that is not available with the shipped
HTTP Server (powered by Apache). The <a href="http://www.apache.org/" target="_blank">Apache Software Foundation (ASF)</a> <img src="www.gif" alt="Link outside Information Center" /> provides basic
information for writing your own modules.Before the module can be used by
your HTTP Server (powered by Apache), it must be compiled and saved in the
QSYS directory. In addition, the <a href="rzaiemod_so.htm#loadmodule">LoadModule</a> directive must be entered in
your server configuration file along with any specific context required information.
</p>
<p>As of i5/OS™ V5R4,
modules must be recompiled with a UTF locale. This creates an environment
where locale-dependent C runtime functions assume that string data is encoded
in UTF-8. Any hardcoded constants can be encoded in UTF-8 by adding a <tt>#pragma
convert(1208)</tt> statement in the module. Additionally, input data from
the client will no longer be converted to EBCDIC but will be passed as-is.
Output data sent from the module is not converted either so it must be encoded
in ASCII or UTF8 as required. <a href="rzaieprogapr.htm">APR
and HTTP APIs</a> as of V5R4, expect data in UTF-8. Note that several APIs
have additional functions that allow a CCSID to be set to indicate the encoding
of the parameters being passed. Conversion functions between UTF-8 and EBCDIC
have been added. Be sure to review APIs used by your module to be aware of
current changes. </p>
<p>Follow the below directions to compile and use a new module. </p>
<p><strong>1. Save the source code</strong></p>
<p>Save the source code in your QSYS or IFS directory. All objects created
from compiling and creating the service program must be placed in the QSYS
directory.</p>
<p><strong>2. Compile the source code </strong> </p>
<p>Compile the source code using the CRTCMOD command. Before you compile the
program, make sure you have the correct programming language compiler installed
on your iSeries™ (the
most common programming language used is C). Replace the text in the parenthesis
( ) with your own information. </p>
<pre class="block">CRTCMOD MODULE(<em>Destination module name and library for the compiled module object.</em>) </pre>
<div class="p">Any Apache modules will need to be changed in order to run as a UTF-8 based
server module as opposed to an EBCDIC based server module. There are 2 steps
required: <ol><li>The module owner needs to add this statement to the beginning of the part,
immediately after the header: <tt>#pragma convert(1208)</tt>. This change
causes any constant strings defined in the module to be encoded in the UTF-8
CCSID, and not in the EBCDIC CCSID. Existing functions now expect UTF-8 or
ASCII string data. In some cases, parallel functions are being added that
have an additional CCSID parameter. This allows data to be tagged with any
CCSID and passed to these same functions. The functions handle any conversions
required by system interfaces. </li>
<li>The modules need to be compiled with different options. <ul><li>For ILE C use: <pre>CRTCMOD MODULE(MYLIB/MOD_TEST) SRCSTMF('/mydir/mymodule/source/mod_test.c') DEFINE(AS400 AS400_UTF8) LOCALETYPE(*LOCALEUTF) TERASPACE(*YES) INCDIR('/qibm/proddata/httpa/include')</pre>
</li>
<li> For C++ use:<pre>CRTCPPMOD MODULE(MYLIB/MOD_TEST) SRCSTMF('/mydir/mymodule/source/mod_test.c') DEFINE(AS400 AS400_UTF8) LOCALETYPE(*LOCALEUTF) TERASPACE(*YES) INCDIR('/qibm/proddata/httpa/include') </pre>
</li>
</ul>
Notice the change in the LOCALETYPE parameter. Using LOCALETYPE(*LOCALEUTF)
does the following: Program objects created with this option use the locale
support provided by *LOCALE objects. Wide-character types contain four-byte
UTF-32 values. Narrow character types contain UTF-8 values. The effect of
this change enables the locale dependent C runtime functions to work on UTF-8
strings. See <a href="../books/c092712331.pdf../books/c092712331.pdf">../books/c092712331.pdf</a> for
more information. </li>
</ol>
</div>
<p>Correct any errors found while compiling. Continue to compile the source
code until there are no errors. Save the compiled module in the QSYS directory. </p>
<p><strong>3. Create a service program</strong></p>
<p>Create a service program using the CRTSRVPGM command. Replace the text
in the parenthesis ( ) with your own information. </p>
<pre class="block">CRTSRVPGM SRVPGM(<em>Destination service program name and library.</em>)
MODULE(<em>Module or modules to be built into the service program. Same as CRTCMOD above.</em>)
EXPORT(<em>Name of the data item to be exported.</em>)
BNDSRVPGM(<em>Specifies other service programs needed to bind to when creating the service program.</em>)</pre>
<div class="note"><span class="notetitle">Note:</span> The <strong>EXPORT</strong> field can only have the value of either <strong>*ALL</strong> or <strong>*SRCFILE</strong>.
If <strong>*SRCFILE</strong> is used, you will need to have an export source file defining
which data items or procedures need to be exported and contain the name of
the module structure (for example, cgi_module).<p>The <strong>BNDSRVPGM</strong> field
must have, at a minimum, the following: <strong>(QHTTPSVR/QZSRAPR QHTTPSVR/QZSRCORE
QHTTPSVR/QZSRXMLP QHTTPSVR/QZSRSDBM )</strong>. These values will cover all the
HTTP Sever (powered by Apache) APIs that may be used when building the service
program.</p>
</div>
<p><strong>4. Add LoadModule to HTTP Server (powered by Apache) configuration file</strong> </p>
<p>Using the <span>IBM<sup>®</sup> Web Administration for i5/OS interface</span>, manually
add the LoadModule directive to your HTTP Server (powered by Apache) configuration.
</p>
<ol><li>Start the <span>IBM Web Administration for i5/OS interface</span>. </li>
<li>Click the <strong>Manage</strong> tab. </li>
<li>Click the <span class="uicontrol">HTTP Servers</span> subtab.</li>
<li>Select your HTTP Server (powered by Apache) from the <span class="uicontrol">Server</span> list.</li>
<li>Expand <strong>Tools</strong>. </li>
<li>Click <strong>Edit Configuration File</strong>. </li>
<li>Add the following, where <em><strong>PATH</strong></em> is the directory in the QSYS
directory and <em><strong>MODULE</strong></em> is the name of your module:<pre class="block">LoadModule Module /QSYS.LIB/<em>PATH</em>/<em>MODULE</em>.SRVPGM</pre>
</li>
<li>Add any additional directives needed to the configuration file. Note that
the compiled service program, MOD_FOOTER, is located in the QSYS directory.
The " . " represent existing lines in the configuration file.<p>Example (replace <em><strong>MYLIB.LIB</strong></em> with
your library name):</p>
<pre class="block">LoadModule footer_module /QSYS.LIB/<em>MYLIB.LIB</em>/MOD_FOOTER.SRVPGM
.
.
.
&lt;Directory "/www/mydocs/htdocs"&gt;
SetOutputFilter FOOTERFILTER
FooterFile footer.hf
&lt;/Directory&gt;</pre>
<p>The <strong>FOOTERFILTER</strong> output filter and the <strong>FooterFile</strong> directive
are defined in MOD_FOOTER, the module that was compiled and configured. </p>
</li>
<li>Click <strong>OK</strong>.</li>
</ol>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaieprogramming.htm" title="This topic provides information on CGI, directives, APIs, and other programming topics.">Programming</a></div>
</div>
</div>
</body>
</html>