swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax     Other Library Functions  
function  

HttpRequestSetProxy

 
 

Library: HTTP support (OMHTTP)
Include: omhttp.xin

Declaration

define function HttpRequestSetProxy
            modifiable  stream   Request
   host     value       string   Host
   port     value       integer  Port optional initial { 80 }

Argument definitions

Request
is an HTTP request object.
Host
is the URL of the proxy server
Port
is the port number on the proxy server to which you will be sending requests


Purpose

Use HttpRequestSetProxy to set the proxy server to be used for an HTTP request.

Requirements

You must include the following line at the beginning of your OmniMark program:


  include "omhttp.xin"

You must create an HTTP request with HttpRequestSetFromUrl

Usage Notes

After you use HttpRequestSetProxy, you can send a request with HttpRequestSend.

Example

The following program requests the OmniMark home page via a proxy server. You should set the appropriate values of proxy-server and proxy-port for the proxy server you are using.

  include "omhttp.xin"
  
  global HttpRequest Request
  global HttpResponse Response global stream proxy-server initial {"proxy.mycompany.com"}
  global integer proxy-port initial {80}
  
  process
  
      HttpRequestSetFromUrl Request from "www.omnimark.com:80"
      HttpRequestSetProxy Request host proxy-server port proxy-port
  
      HttpRequestSend Request into Response
      do unless HttpObjectIsInError Request
          output "%n<RESPONSE>%n"
          repeat over Response
              output key of Response
                  || " = "
                  || Response || "%n"
          again
      else
          local stream Report variable
          HttpObjectGetStatusReport Request into Report
          output "%n<REQUEST FAILED>%n"
          repeat over Report
              output Report || "%n"
          again
      done

    Related Syntax
   HttpRequestSend
   HttpRequestSetFromUrl
 
  Other Library Functions
   HttpConnectionSendResponse
   HttpLibraryVersion
   HttpObjectGetCookieAttributes
   HttpObjectGetCookieValues
   HttpObjectGetHeaders
   HttpObjectGetStatusReport
   HttpObjectIsInError
   HttpObjectSetCookieAttribute
   HttpObjectSetCookieValue
   HttpObjectSetHeader
   HttpRequest
   HttpRequestGetSearchItems
   HttpRequestSend
   HttpRequestSetFromUrl
   HttpRequestSetProxy
   HttpRequestSetSearchItem
   HttpResponse
   HttpResponseOutput
   HttpServiceAwaitRequest
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:27:39 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.