1 / 29

Environment Variables

Environment Variables. Overview. Your CGI or ASP Programs may make use of a “Collection” of variables, variously called ENVIRONMENT or SERVER VARIABLES. Different variables may be set on different servers. Your server logs may be set to record these variables. To see actual examples:.

amcdowell
Download Presentation

Environment Variables

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Environment Variables

  2. Overview • Your CGI or ASP Programs may make use of a “Collection” of variables, variously called ENVIRONMENT or SERVER VARIABLES. • Different variables may be set on different servers. • Your server logs may be set to record these variables.

  3. To see actual examples: • http://parana.ecs.csus.edu/fall02/servervariables.asp • http://sequoia.ecs.csus.edu/~harville/cgi-bin/environment.cgi

  4. CONTENT_LENGTH • The length in bytes of the returned document. • USE: Perhaps the programmer wants to limit the size of the response.

  5. CONTENT_TYPE • The type of information returned. • Ex: text/html • USE: Perhaps the programmer wants to have different parts of the program activate depending on the content type.

  6. DOCUMENT_ROOT • The main site directory. • USE: Setting up paths for dynamically generated URLs.

  7. GATEWAY_INTERFACE • The CGI version number. • USE: Perhaps certain program features require a certain CGI version.

  8. HTTP_ACCEPT • Media types the client accepts.

  9. HTTP_ACCEPT_ENCODING Methods of compression the browser understands. HTTP_ACCEPT_ENCODING = gzip, deflate

  10. HTTP_ACCEPT_LANGUAGE HTTP_ACCEPT_LANGUAGE = en-us • USE: Perhaps different files are to be served up depending on the language of the user.

  11. HTTP_CONNECTION HTTP_CONNECTION = Keep-Alive Every request made requires that the server and client re-introduce each other. Keep-Alive is a switch that allows requests sent within a very short time to avoid this server-client bureaucracy.

  12. HTTP_COOKIE • A list of cookies the particular site (or advertising group) has control over. • USE: Customer tracking, customization and other honorable or questionable activities.

  13. HTTP_HOST The name of the machine on which the script resides. HTTP_HOST = parana

  14. HTTP_REFERER • The page that requested the current document or program. • Note the correct misspelling. • Referrer would be more correct, but the mistake was made and not corrected. • USE: Redirection to a previous page.

  15. HTTP_USER_AGENT • The client browser version. • Use: Customization or redirection based on browser type (and thus capabilities).

  16. PATH_INFO • The current virtual path. PATH_INFO = /chat/servervariables.asp • Use: Recording a page name for redirection.

  17. PATH_TRANSLATED • The full absolute path on the server. PATH_INFO = /chat/servervariables.asp PATH_TRANSLATED = C:\csc123\chat\servervariables.asp ALSO: APPL_PHYSICAL_PATH = C:\csc123\chat\

  18. QUERY_STRING • This variable returns the query string: • ?example=Kevin%20Harville • USE: Using form or Querystring information.

  19. REMOTE_ADDR • The remote IP making the request. • USE: Serving up unique pages based on the user. Companies have actually served different pages to their competitors than to their clients.

  20. REMOTE_HOST • The remote hostname or IP of the requestor.

  21. REQUEST_METHOD • I.e. GET or POST.

  22. SCRIPT_NAME • The virtual path of the current script.

  23. SERVER_NAME • Server hostname or IP

  24. SERVER_PORT • Usually 80 • The “channel” incoming requests come in on.

  25. SERVER_PROTOCOL SERVER_PROTOCOL = HTTP/1.1

  26. SERVER_SOFTWARE SERVER_SOFTWARE = Microsoft-IIS/5.0

  27. URL URL = /chat/servervariables.asp

  28. Others • Numerous ones exist for SSL • HTTP_RAW and ALL_HTTP give long lists of the variables.

  29. Summary • Server or Environment Variables are a useful means of site customization. • They allow for customers to be tracked, which may or may not be in the customer’s best interest. • The allow logging of information.

More Related