I should have described my scenario a little better.

I have an RPG CGI program waiting for requests from a client. The client is
going to send a custom http header to the RPG CGI program.  I need the RPG
CGI program to have access to that custom http header.

>Aren't the headers separated with a linefeed? I don't recall off-hand if
that's the case, but if it is, you have your solution.

You are correct, but the RPG CGI program is sitting behind the Apache web
server. I do not believe I have access to the raw request but instead only
have API access to the different components through this set of API's:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/rzaie
/rzaierefapi.htm

If I was doing a raw sockets RPG server program then yes, I could parse
through the request and get everything I needed. 

I am searching the Apache 2.0 manual to see if there is a specific setting
that I need to specify for custom headers to be allowed through.
http://httpd.apache.org/docs/2.0/mod/mod_headers.html#requestheader

Hope that explains what I am looking for better,
Aaron Bartell

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Bob Cozzi
Sent: Wednesday, April 12, 2006 12:00 PM
To: 'Web Enabling the AS400 / iSeries'
Subject: Re: [WEB400] Loop through HTTP request headers

Aaron,
Aren't the headers separated with a linefeed? I don't recall off-hand if
that's the case, but if it is, you have your solution.

-Bob Cozzi
www.RPGxTools.com
RPG xTools - Enjoy programming again.


-----Original Message-----
From: web400-bounces+cozzi=rpgiv.com@xxxxxxxxxxxx
[mailto:web400-bounces+cozzi=rpgiv.com@xxxxxxxxxxxx] On Behalf Of albartell
Sent: Wednesday, April 12, 2006 11:44 AM
To: 'Web Enabling the AS400 / iSeries'
Subject: [WEB400] Loop through HTTP request headers

 
I am wondering if anyone knows of a way to loop through all headers sent
from a client to an RPG CGI program?  I can do it in Java as shown in the
code at the bottom of this email.
 
More specifically I am trying to send a custom header from the client to an
RPG CGI program and want to read the value of that header into a variable to
use for later processing. Being able to loop through them I would see how
the Apache server is interpreting the headers and then know what literal
name to use to access it.
 
The current HTTP 1.1 spec allows custom headers per this page:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.3
 
 
Note that I am using QtmhGetEnv to read the headers. I can gain access to
CONTENT_TYPE and other standard ones just fine, so I am wondering if there
is a limitation in place that doesn't allow non-standard headers to be
obtained?
 
TIA,
Aaron Bartell
 
 
 
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
public class ShowHttpHeaders extends HttpServlet {
 
    public void doGet(HttpServletRequest request, HttpServletResponse
response)
            throws ServletException, IOException {
 
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
 
        out.println("Request Method:" + request.getMethod() + "<BR>\n" +
"Request URI:"
                + request.getRequestURI() + "<BR>\n" + "Request Protocol:" +
request.getProtocol()
                + "<br>\n");
 
        Enumeration headerNames = request.getHeaderNames();
        while (headerNames.hasMoreElements()) {
            String headerName = (String) headerNames.nextElement();
            out.println(headerName + "::" + request.getHeader(headerName));
        }
    }
 
    public void doPost(HttpServletRequest request, HttpServletResponse
response)
            throws ServletException, IOException {
        doGet(request, response);
    }
}
 
 
 
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list To post a
message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list
options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.