5 Replies Latest reply on Jan 19, 2008 2:08 PM by 807581

    HTTP Headers - accessing from HTTPRequest


      We are trying to integrate our Forte UDS web application with SiteMinder for user authentication. We need to access the user name as placed in a http header by SiteMinder from within the Forte code. How-ever, the HTTPRequest object does not appear to have a method to retrieve http headers - just support for the retrieval of cookies and parameters.
      Does any-one know if http headers are stored on and are accessible from the HTTPRequest object?

      I would appreciate any suggestions on how to resolve this.
        • 1. Re: HTTP Headers - accessing from HTTPRequest

          I would assume you are using the WE HTTP library (not HTTPSupport), if so HTTPMessage bears two attributes that may be of interest to you:

          normally ExtensionHeader contains all the extra stuff aside (Allow, Content-Encoding, Content-Language, Content-Length, Content-Location, Content-MD5, Content-Range, Content-Type, Expires & Last-Modified) e.g. things that do not fit in the HTTP/1.1 (RFC ???)

          ExtensionHeader would propably have the extra bit of info the SiteMinder may add to the header.

          That's my best bet, but I don't know the modus operandi of SiteMinder, run the stuff thru the debugger or dump the contents of (ContentBase/ExtensionHeader) to a file or stdout

          Hope this helps,

          • 2. Re: HTTP Headers - accessing from HTTPRequest

            Thanks for your reply, but when I log the contents of the ExtensionHeader and ContentBase attributes they appear empty. I have also identifed another attribute on HTTPRequest - CustomHeaders, but it also is unpopulated.
            Do you know if there is any way to force these to be populated e.g. a flag that should be set?
            Or do you know of any way to convert a HTTPRequest object into a HTTPBaseRequest object that does appear to support apis to retrieve http headers?

            Thanks for your help.
            • 3. Re: HTTP Headers - accessing from HTTPRequest

              I had forgotten how a pain it was to attache the debugger to the proper process and I should have read the HTTP/1.1 RFC ... (http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html)

              anyway, the request header can be accessed through the qqwe_Buf attribute on the HTTPRequest class. In fact it contains the full request.

              In your HandleTemplateRequest or HandleRequest overidden method if you dump the contents with a bit of code like this

              myStr : TextData = new();
              request.qqwe_Buf.ReadText(myStr, 0);
              may be you'll need to restore the Offset to its previous value.

              that should get you something similar to this:
              GET fortecgi?ServiceName=ShopCartService&TemplateName=/shopping/products.htm&cat
              egory=0002 HTTP/1.1

              Host: p4:80

              Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plai

              Content-Length: 0

              Cookie: ShopCartService=091E1A7B24251E2422241B2D17012674; frte_lbf_ShopCartServi

              Referer: http://p4/cgi-forte/fortecgi.exe?ServiceName=ShopCartService&TemplateNa

              User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv: Gecko/2
              0071127 Firefox/

              WebEnterprise-GatewayInterface: CGI/1.1

              WebEnterprise-PathTranslated: c:\inetpub\wwwroot



              WebEnterprise-ScriptName: /cgi-forte/fortecgi.exe

              WebEnterprise-ServerName: p4

              WebEnterprise-ServerPort: 80

              WebEnterprise-ServerSoftware: Microsoft-IIS/5.0


              WebEnterprise-ForteInterface: ForteCGI

              Hope this helps.

              Apologies for misleading you in me previous post.


              PS: HTTPSupport is meant to use UDS as a "web-server" I tried to instantiate a HTTPBaseRequest and stuff the query attribute with the contents of qqwe_Buf and poke around to initialize the stuff but I haven't managed to get anything out of it (there must be a lot of things done behind the scenes).
              • 4. Re: HTTP Headers - accessing from HTTPRequest

                Thanks very much for your reply - when I logged the contents of the qqwe_Buf attribute I was able to find the user name (that had been placed in a http header by SiteMinder). But the value wasn't placed in the SiteMinder header named sm_user, but associated with WebEnterprise.RemoteUser. The other headers created by SiteMinder were not present. Do you know if Forte discards all the other headers it doesn't recognise? Does it just strip out ones it recognises and associates them with WebEnterprise.*? Also, do you know what the intended use of the qqwe_Buf attribute is? Do you think it would be safe to rely on it being populated?

                Thanks for your help again.
                • 5. Re: HTTP Headers - accessing from HTTPRequest
                  K3wl, the qq**_Stuff is Fort� internal and I'd say it can be trusted. Then again it may change from one major version to another (but that's may be not the main concern).

                  If you don't mind me asking what Fort� version are you using. And if you've got a version of SiteMinder (Win or Solaris) that you can share ... send me an email on me profile's address.

                  To see what is coming in, snoop on the connection between the two hosts (web server and SiteMinder).
                  Use tcpdump or snoop on UNIX and (http://www.winpcap.org/) on Windows you need admin rights but you may be able to snoop on two remote hosts if the network is not switched.

                  and compare the dumps with what you get within Fort�.

                  If Fort� is dropping fields, or portions of the Header, I'd say the only way then would be to attach a debugger to see where it's happening and if it can be retrieved with a raw pointer in Fort� ... always possible to manipulate the pointee.

                  Have a G'Day.