Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > f806c0f24240b25bde21a53f71766070 > files > 779

erlang-doc-R13B-04.6.fc13.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- httpc</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--            
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth || 
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;            
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){ 
                if (obj.addEventListener){ 
                obj.addEventListener(evType, fn, true); 
                return true; 
              } else if (obj.attachEvent){ 
                var r = obj.attachEvent("on"+evType, fn); 
                return r; 
              } else { 
                return false; 
              } 
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/inets-5.3.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>inets</strong><br><strong>Reference Manual</strong><br><small>Version 5.3</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu">
<li id="no" title="inets " expanded="false">inets<ul>
<li><a href="inets.html">
                  Top of manual page
                </a></li>
<li title="services-0"><a href="inets.html#services-0">services/0</a></li>
<li title="services_info-0"><a href="inets.html#services_info-0">services_info/0</a></li>
<li title="service_names-0"><a href="inets.html#service_names-0">service_names/0</a></li>
<li title="start-0"><a href="inets.html#start-0">start/0</a></li>
<li title="start-1"><a href="inets.html#start-1">start/1</a></li>
<li title="stop-0"><a href="inets.html#stop-0">stop/0</a></li>
<li title="start-2"><a href="inets.html#start-2">start/2</a></li>
<li title="start-3"><a href="inets.html#start-3">start/3</a></li>
<li title="stop-2"><a href="inets.html#stop-2">stop/2</a></li>
</ul>
</li>
<li id="no" title="ftp " expanded="false">ftp<ul>
<li><a href="ftp.html">
                  Top of manual page
                </a></li>
<li title="account-2"><a href="ftp.html#account-2">account/2</a></li>
<li title="append-2"><a href="ftp.html#append-2">append/2</a></li>
<li title="append-3"><a href="ftp.html#append-3">append/3</a></li>
<li title="append_bin-3"><a href="ftp.html#append_bin-3">append_bin/3</a></li>
<li title="append_chunk-2"><a href="ftp.html#append_chunk-2">append_chunk/2</a></li>
<li title="append_chunk_start-2"><a href="ftp.html#append_chunk_start-2">append_chunk_start/2</a></li>
<li title="append_chunk_end-1"><a href="ftp.html#append_chunk_end-1">append_chunk_end/1</a></li>
<li title="cd-2"><a href="ftp.html#cd-2">cd/2</a></li>
<li title="close-1"><a href="ftp.html#close-1">close/1</a></li>
<li title="delete-2"><a href="ftp.html#delete-2">delete/2</a></li>
<li title="formaterror-1"><a href="ftp.html#formaterror-1">formaterror/1</a></li>
<li title="lcd-2"><a href="ftp.html#lcd-2">lcd/2</a></li>
<li title="lpwd-1"><a href="ftp.html#lpwd-1">lpwd/1</a></li>
<li title="ls-1"><a href="ftp.html#ls-1">ls/1</a></li>
<li title="ls-2"><a href="ftp.html#ls-2">ls/2</a></li>
<li title="mkdir-2"><a href="ftp.html#mkdir-2">mkdir/2</a></li>
<li title="nlist-1"><a href="ftp.html#nlist-1">nlist/1</a></li>
<li title="nlist-2"><a href="ftp.html#nlist-2">nlist/2</a></li>
<li title="open-1"><a href="ftp.html#open-1">open/1</a></li>
<li title="open-2"><a href="ftp.html#open-2">open/2</a></li>
<li title="pwd-1"><a href="ftp.html#pwd-1">pwd/1</a></li>
<li title="pwd-1"><a href="ftp.html#pwd-1">pwd/1</a></li>
<li title="recv-2"><a href="ftp.html#recv-2">recv/2</a></li>
<li title="recv-3"><a href="ftp.html#recv-3">recv/3</a></li>
<li title="recv_bin-2"><a href="ftp.html#recv_bin-2">recv_bin/2</a></li>
<li title="recv_chunk_start-2"><a href="ftp.html#recv_chunk_start-2">recv_chunk_start/2</a></li>
<li title="recv_chunk-1"><a href="ftp.html#recv_chunk-1">recv_chunk/1</a></li>
<li title="rename-3"><a href="ftp.html#rename-3">rename/3</a></li>
<li title="rmdir-2"><a href="ftp.html#rmdir-2">rmdir/2</a></li>
<li title="send-2"><a href="ftp.html#send-2">send/2</a></li>
<li title="send-3"><a href="ftp.html#send-3">send/3</a></li>
<li title="send_bin-3"><a href="ftp.html#send_bin-3">send_bin/3</a></li>
<li title="send_chunk-2"><a href="ftp.html#send_chunk-2">send_chunk/2</a></li>
<li title="send_chunk_start-2"><a href="ftp.html#send_chunk_start-2">send_chunk_start/2</a></li>
<li title="send_chunk_end-1"><a href="ftp.html#send_chunk_end-1">send_chunk_end/1</a></li>
<li title="type-2"><a href="ftp.html#type-2">type/2</a></li>
<li title="user-3"><a href="ftp.html#user-3">user/3</a></li>
<li title="user-4"><a href="ftp.html#user-4">user/4</a></li>
<li title="quote-2"><a href="ftp.html#quote-2">quote/2</a></li>
</ul>
</li>
<li id="no" title="tftp " expanded="false">tftp<ul>
<li><a href="tftp.html">
                  Top of manual page
                </a></li>
<li title="start-1"><a href="tftp.html#start-1">start/1</a></li>
<li title="read_file-3"><a href="tftp.html#read_file-3">read_file/3</a></li>
<li title="write_file-3"><a href="tftp.html#write_file-3">write_file/3</a></li>
<li title="info-1"><a href="tftp.html#info-1">info/1</a></li>
<li title="info-1"><a href="tftp.html#info-1">info/1</a></li>
<li title="info-1"><a href="tftp.html#info-1">info/1</a></li>
<li title="change_config-2"><a href="tftp.html#change_config-2">change_config/2</a></li>
<li title="change_config-2"><a href="tftp.html#change_config-2">change_config/2</a></li>
<li title="change_config-2"><a href="tftp.html#change_config-2">change_config/2</a></li>
<li title="start-0"><a href="tftp.html#start-0">start/0</a></li>
<li title="prepare-6"><a href="tftp.html#prepare-6">prepare/6</a></li>
<li title="open-6"><a href="tftp.html#open-6">open/6</a></li>
<li title="read-1"><a href="tftp.html#read-1">read/1</a></li>
<li title="write-2"><a href="tftp.html#write-2">write/2</a></li>
<li title="abort-3"><a href="tftp.html#abort-3">abort/3</a></li>
<li title="error_msg-2"><a href="tftp.html#error_msg-2">error_msg/2</a></li>
<li title="warning_msg-2"><a href="tftp.html#warning_msg-2">warning_msg/2</a></li>
<li title="info_msg-2"><a href="tftp.html#info_msg-2">info_msg/2</a></li>
</ul>
</li>
<li id="loadscrollpos" title="httpc " expanded="true">httpc<ul>
<li><a href="httpc.html">
                  Top of manual page
                </a></li>
<li title="request-1"><a href="httpc.html#request-1">request/1</a></li>
<li title="request-2"><a href="httpc.html#request-2">request/2</a></li>
<li title="request-4"><a href="httpc.html#request-4">request/4</a></li>
<li title="request-5"><a href="httpc.html#request-5">request/5</a></li>
<li title="cancel_request-1"><a href="httpc.html#cancel_request-1">cancel_request/1</a></li>
<li title="cancel_request-2"><a href="httpc.html#cancel_request-2">cancel_request/2</a></li>
<li title="set_options-1"><a href="httpc.html#set_options-1">set_options/1</a></li>
<li title="set_options-2"><a href="httpc.html#set_options-2">set_options/2</a></li>
<li title="stream_next-1"><a href="httpc.html#stream_next-1">stream_next/1</a></li>
<li title="store_cookie-2"><a href="httpc.html#store_cookie-2">store_cookie/2</a></li>
<li title="store_cookie-3"><a href="httpc.html#store_cookie-3">store_cookie/3</a></li>
<li title="cookie_header-1"><a href="httpc.html#cookie_header-1">cookie_header/1</a></li>
<li title="cookie_header-2"><a href="httpc.html#cookie_header-2">cookie_header/2</a></li>
<li title="reset_cookies-0"><a href="httpc.html#reset_cookies-0">reset_cookies/0</a></li>
<li title="reset_cookies-1"><a href="httpc.html#reset_cookies-1">reset_cookies/1</a></li>
<li title="which_cookies-0"><a href="httpc.html#which_cookies-0">which_cookies/0</a></li>
<li title="which_cookies-1"><a href="httpc.html#which_cookies-1">which_cookies/1</a></li>
</ul>
</li>
<li id="no" title="httpd " expanded="false">httpd<ul>
<li><a href="httpd.html">
                  Top of manual page
                </a></li>
<li title="info-1"><a href="httpd.html#info-1">info/1</a></li>
<li title="info-2"><a href="httpd.html#info-2">info/2</a></li>
<li title="info-2"><a href="httpd.html#info-2">info/2</a></li>
<li title="info-3"><a href="httpd.html#info-3">info/3</a></li>
<li title="reload_config-2"><a href="httpd.html#reload_config-2">reload_config/2</a></li>
<li title="Module:do-1"><a href="httpd.html#Module:do-1">Module:do/1</a></li>
<li title="Module:load-2"><a href="httpd.html#Module:load-2">Module:load/2</a></li>
<li title="Module:store-2"><a href="httpd.html#Module:store-2">Module:store/2</a></li>
<li title="Module:remove-1"><a href="httpd.html#Module:remove-1">Module:remove/1</a></li>
<li title="parse_query-1"><a href="httpd.html#parse_query-1">parse_query/1</a></li>
</ul>
</li>
<li id="no" title="httpd_conf " expanded="false">httpd_conf<ul>
<li><a href="httpd_conf.html">
                  Top of manual page
                </a></li>
<li title="check_enum-2"><a href="httpd_conf.html#check_enum-2">check_enum/2</a></li>
<li title="clean-1"><a href="httpd_conf.html#clean-1">clean/1</a></li>
<li title="custom_clean-3"><a href="httpd_conf.html#custom_clean-3">custom_clean/3</a></li>
<li title="is_directory-1"><a href="httpd_conf.html#is_directory-1">is_directory/1</a></li>
<li title="is_file-1"><a href="httpd_conf.html#is_file-1">is_file/1</a></li>
<li title="make_integer-1"><a href="httpd_conf.html#make_integer-1">make_integer/1</a></li>
</ul>
</li>
<li id="no" title="httpd_socket " expanded="false">httpd_socket<ul>
<li><a href="httpd_socket.html">
                  Top of manual page
                </a></li>
<li title="deliver-3"><a href="httpd_socket.html#deliver-3">deliver/3</a></li>
<li title="peername-2"><a href="httpd_socket.html#peername-2">peername/2</a></li>
<li title="resolve-0"><a href="httpd_socket.html#resolve-0">resolve/0</a></li>
</ul>
</li>
<li id="no" title="httpd_util " expanded="false">httpd_util<ul>
<li><a href="httpd_util.html">
                  Top of manual page
                </a></li>
<li title="convert_request_date-1"><a href="httpd_util.html#convert_request_date-1">convert_request_date/1</a></li>
<li title="create_etag-1"><a href="httpd_util.html#create_etag-1">create_etag/1</a></li>
<li title="decode_hex-1"><a href="httpd_util.html#decode_hex-1">decode_hex/1</a></li>
<li title="day-1"><a href="httpd_util.html#day-1">day/1</a></li>
<li title="flatlength-1"><a href="httpd_util.html#flatlength-1">flatlength/1</a></li>
<li title="hexlist_to_integer-1"><a href="httpd_util.html#hexlist_to_integer-1">hexlist_to_integer/1</a></li>
<li title="integer_to_hexlist-1"><a href="httpd_util.html#integer_to_hexlist-1">integer_to_hexlist/1</a></li>
<li title="lookup-2"><a href="httpd_util.html#lookup-2">lookup/2</a></li>
<li title="lookup-3"><a href="httpd_util.html#lookup-3">lookup/3</a></li>
<li title="lookup_mime-2"><a href="httpd_util.html#lookup_mime-2">lookup_mime/2</a></li>
<li title="lookup_mime-3"><a href="httpd_util.html#lookup_mime-3">lookup_mime/3</a></li>
<li title="lookup_mime_default-2"><a href="httpd_util.html#lookup_mime_default-2">lookup_mime_default/2</a></li>
<li title="lookup_mime_default-3"><a href="httpd_util.html#lookup_mime_default-3">lookup_mime_default/3</a></li>
<li title="message-3"><a href="httpd_util.html#message-3">message/3</a></li>
<li title="month-1"><a href="httpd_util.html#month-1">month/1</a></li>
<li title="multi_lookup-2"><a href="httpd_util.html#multi_lookup-2">multi_lookup/2</a></li>
<li title="reason_phrase-1"><a href="httpd_util.html#reason_phrase-1">reason_phrase/1</a></li>
<li title="rfc1123_date-0"><a href="httpd_util.html#rfc1123_date-0">rfc1123_date/0</a></li>
<li title="rfc1123_date-2"><a href="httpd_util.html#rfc1123_date-2">rfc1123_date/2</a></li>
<li title="split-3"><a href="httpd_util.html#split-3">split/3</a></li>
<li title="split_script_path-1"><a href="httpd_util.html#split_script_path-1">split_script_path/1</a></li>
<li title="split_path-1"><a href="httpd_util.html#split_path-1">split_path/1</a></li>
<li title="strip-1"><a href="httpd_util.html#strip-1">strip/1</a></li>
<li title="suffix-1"><a href="httpd_util.html#suffix-1">suffix/1</a></li>
</ul>
</li>
<li id="no" title="mod_alias " expanded="false">mod_alias<ul>
<li><a href="mod_alias.html">
                  Top of manual page
                </a></li>
<li title="default_index-2"><a href="mod_alias.html#default_index-2">default_index/2</a></li>
<li title="path-3"><a href="mod_alias.html#path-3">path/3</a></li>
<li title="real_name-3"><a href="mod_alias.html#real_name-3">real_name/3</a></li>
<li title="real_script_name-3"><a href="mod_alias.html#real_script_name-3">real_script_name/3</a></li>
</ul>
</li>
<li id="no" title="mod_auth " expanded="false">mod_auth<ul>
<li><a href="mod_auth.html">
                  Top of manual page
                </a></li>
<li title="add_user-2"><a href="mod_auth.html#add_user-2">add_user/2</a></li>
<li title="add_user-5"><a href="mod_auth.html#add_user-5">add_user/5</a></li>
<li title="add_user-6"><a href="mod_auth.html#add_user-6">add_user/6</a></li>
<li title="delete_user-2"><a href="mod_auth.html#delete_user-2">delete_user/2</a></li>
<li title="delete_user-3"><a href="mod_auth.html#delete_user-3">delete_user/3</a></li>
<li title="delete_user-4"><a href="mod_auth.html#delete_user-4">delete_user/4</a></li>
<li title="get_user-2"><a href="mod_auth.html#get_user-2">get_user/2</a></li>
<li title="get_user-3"><a href="mod_auth.html#get_user-3">get_user/3</a></li>
<li title="get_user-4"><a href="mod_auth.html#get_user-4">get_user/4</a></li>
<li title="list_users-1"><a href="mod_auth.html#list_users-1">list_users/1</a></li>
<li title="list_users-3"><a href="mod_auth.html#list_users-3">list_users/3</a></li>
<li title="add_group_member-3"><a href="mod_auth.html#add_group_member-3">add_group_member/3</a></li>
<li title="add_group_member-4"><a href="mod_auth.html#add_group_member-4">add_group_member/4</a></li>
<li title="add_group_member-5"><a href="mod_auth.html#add_group_member-5">add_group_member/5</a></li>
<li title="delete_group_member-3"><a href="mod_auth.html#delete_group_member-3">delete_group_member/3</a></li>
<li title="delete_group_member-4"><a href="mod_auth.html#delete_group_member-4">delete_group_member/4</a></li>
<li title="delete_group_member-5"><a href="mod_auth.html#delete_group_member-5">delete_group_member/5</a></li>
<li title="list_group_members-2"><a href="mod_auth.html#list_group_members-2">list_group_members/2</a></li>
<li title="list_group_members-3"><a href="mod_auth.html#list_group_members-3">list_group_members/3</a></li>
<li title="list_group_members-4"><a href="mod_auth.html#list_group_members-4">list_group_members/4</a></li>
<li title="list_groups-1"><a href="mod_auth.html#list_groups-1">list_groups/1</a></li>
<li title="list_groups-2"><a href="mod_auth.html#list_groups-2">list_groups/2</a></li>
<li title="list_groups-3"><a href="mod_auth.html#list_groups-3">list_groups/3</a></li>
<li title="delete_group-2"><a href="mod_auth.html#delete_group-2">delete_group/2</a></li>
<li title="delete_group-4"><a href="mod_auth.html#delete_group-4">delete_group/4</a></li>
<li title="update_password-5"><a href="mod_auth.html#update_password-5">update_password/5</a></li>
<li title="update_password-6"><a href="mod_auth.html#update_password-6">update_password/6</a></li>
</ul>
</li>
<li id="no" title="mod_esi " expanded="false">mod_esi<ul>
<li><a href="mod_esi.html">
                  Top of manual page
                </a></li>
<li title="deliver-2"><a href="mod_esi.html#deliver-2">deliver/2</a></li>
<li title="Module:Function-3"><a href="mod_esi.html#Module:Function-3">Module:Function/3</a></li>
<li title="Module:Function-2"><a href="mod_esi.html#Module:Function-2">Module:Function/2</a></li>
</ul>
</li>
<li id="no" title="mod_security " expanded="false">mod_security<ul>
<li><a href="mod_security.html">
                  Top of manual page
                </a></li>
<li title="list_auth_users-1"><a href="mod_security.html#list_auth_users-1">list_auth_users/1</a></li>
<li title="list_auth_users-2"><a href="mod_security.html#list_auth_users-2">list_auth_users/2</a></li>
<li title="list_auth_users-2"><a href="mod_security.html#list_auth_users-2">list_auth_users/2</a></li>
<li title="list_auth_users-3"><a href="mod_security.html#list_auth_users-3">list_auth_users/3</a></li>
<li title="list_blocked_users-1"><a href="mod_security.html#list_blocked_users-1">list_blocked_users/1</a></li>
<li title="list_blocked_users-2"><a href="mod_security.html#list_blocked_users-2">list_blocked_users/2</a></li>
<li title="list_blocked_users-2"><a href="mod_security.html#list_blocked_users-2">list_blocked_users/2</a></li>
<li title="list_blocked_users-3"><a href="mod_security.html#list_blocked_users-3">list_blocked_users/3</a></li>
<li title="block_user-4"><a href="mod_security.html#block_user-4">block_user/4</a></li>
<li title="block_user-5"><a href="mod_security.html#block_user-5">block_user/5</a></li>
<li title="unblock_user-2"><a href="mod_security.html#unblock_user-2">unblock_user/2</a></li>
<li title="unblock_user-3"><a href="mod_security.html#unblock_user-3">unblock_user/3</a></li>
<li title="unblock_user-3"><a href="mod_security.html#unblock_user-3">unblock_user/3</a></li>
<li title="unblock_user-4"><a href="mod_security.html#unblock_user-4">unblock_user/4</a></li>
<li title="event-4"><a href="mod_security.html#event-4">event/4</a></li>
<li title="event-5"><a href="mod_security.html#event-5">event/5</a></li>
</ul>
</li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>httpc</h1></center>
  
  <h3>MODULE</h3>
<div class="REFBODY">httpc</div>
  <h3>MODULE SUMMARY</h3>
<div class="REFBODY">An HTTP/1.1 client </div>
  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
    <p>This module provides the API to a HTTP/1.1 compatible client according 
      to RFC 2616, caching is currently not supported.</p>
    <div class="note">
<div class="label">Note</div>
<div class="content"><p>
      <p>When starting the Inets application a manager process for the
	default profile will be started. The functions in this API
	that does not explicitly use a profile will accesses the
	default profile. A profile keeps track of proxy options,
	cookies and other options that can be applied to more than one
	request. </p>

      <p>If the scheme
	https is used the ssl application needs to be started.</p>

      <p>Also note that pipelining will only be used if the pipeline
      timeout is set, otherwise persistent connections without
      pipelining will be used e.i. the  client always waits for
      the previous response before sending the next request.</p>
    </p></div>
</div>
    <p>There are some usage examples in the <span class="bold_code"><a href="http_client.html">Inets User's Guide.</a></span></p>
  </p></div>
  
  <h3><a name="id2276138">COMMON DATA TYPES </a></h3>
<div class="REFBODY">
    
    <p>Type definitions that are used more than once in
      this module:</p>
    <div class="example"><pre>
boolean()    = true | false 
string()     = list of ASCII characters 
request_id() = ref() 
profile()    = atom()
path()       = string() representing a file path or directory path 
ip_address() = See inet(3)
socket_opt() = See the Options used by gen_tcp(3) and 
               ssl(3) connect(s)
    </pre></div>

  </div>
  
  <h3><a name="id2276161">HTTP DATA TYPES </a></h3>
<div class="REFBODY">
    
    <p>Type definitions that are related to HTTP:</p>
    <p>For more information about HTTP see rfc 2616</p>

    <div class="example"><pre>
method()        = head | get | put | post | trace | options | delete
request()       = {url(), headers()} | 
                  {url(), headers(), content_type(), body()}
url()           = string() - Syntax according to the URI definition in rfc 2396, ex: "http://www.erlang.org"
status_line()   = {http_version(), status_code(), reason_phrase()}
http_version()  = string() ex: "HTTP/1.1"
status_code()   = integer()
reason_phrase() = string()
content_type()  = string()
headers()       = [header()]
header()        = {field(), value()}
field()         = string() 
value()         = string() 
body()          = string() | binary() 
filename()      = string() 
    </pre></div>

  </div>
  
  <h3><a name="id2276194">SSL DATA TYPES </a></h3>
<div class="REFBODY">
    
    <p>Some type definitions relevant when using https,
      for details <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','ssl','ssl.html');">ssl(3)</a></span>: </p>
    <div class="example"><pre>
ssl_options() = {verify,     code()}   | 
                {depth,      depth()}  | 
                {certfile,   path()}   | 
                {keyfile,    path()}   | 
                {password,   string()} | 
                {cacertfile, path()}   | 
                {ciphers,    string()} 
    </pre></div>
  </div>

  <h3><a name="id2276223">HTTP CLIENT SERVICE START/STOP </a></h3>
<div class="REFBODY">
    
    
    <p>A HTTP client can be configured to start when starting the inets
      application or started dynamically in runtime by calling the
      inets application API <span class="code">inets:start(httpc, ServiceConfig)</span>, or
      <span class="code">inets:start(httpc,  ServiceConfig, How)</span>
      see <span class="bold_code"><a href="inets.html">inets(3)</a></span> Below follows a
      description of the available configuration options.</p>
    <dl>
      <dt><strong>{profile, profile()}</strong></dt>
      <dd>Name of the profile, see
	common data types below, this option is mandatory.</dd>
      <dt><strong>{data_dir, path()}</strong></dt>
      <dd>Directory where the profile
	may save persistent data, if omitted all cookies will be treated
	as session cookies.</dd>
    </dl>

    <p>The client can be stopped using inets:stop(httpc, Pid) or
    inets:stop(httpc, Profile).</p>
    
    <a name="request1"></a>
  </div>
  
  <h3>EXPORTS</h3>
    <p><a name="request-1"><span class="bold_code">request(Url) -&gt; </span></a><br><a name="request-2"><span class="bold_code">request(Url, Profile) -&gt; {ok, Result} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Url = url() </span><br>
</div> 
	<div class="REFTYPES">
<span class="bold_code">Result = {status_line(), headers(), body()} | 
                    {status_code(), body()} | request_id() </span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">Profile = profile()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">Reason = term() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Equivalent to httpc:request(get, {Url, []}, [], []).</p>

        <a name="request2"></a>
      </p></div>

    <p><a name="request-4"><span class="bold_code">request(Method, Request, HTTPOptions, Options) -&gt; </span></a><br><a name="request-5"><span class="bold_code">request(Method, Request, HTTPOptions, Options, Profile) -&gt; {ok, Result} | {ok, saved_to_file} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Method = method() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Request = request()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">HTTPOptions = http_options()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">http_options() = [http_option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">http_option() = {timeout,         timeout()} | 
                           {connect_timeout, timeout()} | 
                           {ssl,             ssl_options()} | 
                           {autoredirect,    boolean()} | 
                           {proxy_auth, {userstring(), passwordstring()}} | 
                           {version,         http_version()} | 
                           {relaxed,         boolean()}</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">timeout() = integer() &gt;= 0 | infinity</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Options = options()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">options() = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">option() = {sync,          boolean()} | 
                      {stream,        stream_to()} | 
                      {body_format,   body_format()} | 
                      {full_result,   boolean()} | 
                      {headers_as_is, boolean() |
                      {socket_opts,   socket_opts()} | 
                      {receiver,      receiver()}}</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">stream_to() = none | self | {self, once} | filename() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">socket_opts() = [socket_opt()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">receiver() = pid() | function()/1 | {Module, Function, Args} </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Module = atom() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Function = atom() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Args = list() </span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">body_format() = string | binary </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Result = {status_line(), headers(), body()} | 
                    {status_code(), body()} | request_id() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Profile = profile() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Sends a HTTP-request. The function can be both synchronous
          and asynchronous. In the later case the function will return
          {ok, RequestId} and later on the information will be delivered
          to the <span class="code">receiver</span> depending on that value. </p>

        <p>Http option (<span class="code">http_option()</span>) details: </p>
        <dl>
          <dt><strong><span class="code">timeout</span></strong></dt>
          <dd>
            <p>Timeout time for the request. </p>
            <p>The clock start ticking as soon as the request has been 
              sent. </p>
            <p>Time is in milliseconds. </p>
            <p>Defaults to <span class="code">infinity</span>. </p>
	  </dd>

          <dt><strong><span class="code">connect_timeout</span></strong></dt>
          <dd>
            <p>Connection timeout time, used during the initial request, 
              when the client is <strong>connecting</strong> to the server. </p>
            <p>Time is in milliseconds. </p>
            <p>Defaults to the value of the <span class="code">timeout</span> option. </p>
	  </dd>

          <dt><strong><span class="code">ssl</span></strong></dt>
          <dd>
            <p>If using SSL, these SSL-specific options are used. </p>
            <p>Defaults to <span class="code">[]</span>. </p>
	  </dd>

          <dt><strong><span class="code">autoredirect</span></strong></dt>
          <dd>
            <p>Should the client automatically retreive the information 
              from the new URI and return that as the result instead 
              of a 30X-result code. </p>
            <p>Note that for some 30X-result codes automatic redirect 
              is not allowed in these cases the 30X-result will always 
              be returned. </p>
            <p>Defaults to <span class="code">true</span>. </p>
	  </dd>

          <dt><strong><span class="code">proxy_auth</span></strong></dt>
          <dd>
            <p>A proxy-authorization header using the provided user name and 
              password will be added to the request. </p>
	  </dd>

          <dt><strong><span class="code">version</span></strong></dt>
          <dd>
            <p>Can be used to make the client act as an <span class="code">HTTP/1.0</span> or
	      <span class="code">HTTP/0.9</span> client. By default this is an <span class="code">HTTP/1.1</span> 
              client. When using <span class="code">HTTP/1.0</span> persistent connections will 
              not be used. </p>
            <p>Defaults to the trsing <span class="code">"HTTP/1.1"</span>. </p>
	  </dd>

          <dt><strong><span class="code">relaxed</span></strong></dt>
          <dd>
            <p>If set to true workarounds for known server deviations from
	      the HTTP-standard are enabled. </p>
            <p>Defaults to <span class="code">false</span>. </p>
	  </dd>

        </dl>

        <p>Option (<span class="code">option()</span>) details: </p>
        <dl>
          <dt><strong><span class="code">sync</span></strong></dt>
          <dd>
            <p>Shall the request be synchronous or asynchronous. </p>
            <p>Defaults to <span class="code">true</span>. </p>
	  </dd>

          <dt><strong><span class="code">stream</span></strong></dt>
          <dd>
            <p>Streams the body of a 200 or 206 response to the calling 
	      process or to a file. When streaming to the calling process 
	      using the option <span class="code">self</span> the the following stream messages
	      will be sent to that process: {http, {RequestId,
	      stream_start, Headers}, {http, {RequestId, stream,
	      BinBodyPart}, {http, {RequestId, stream_end, Headers}. When
	      streaming to to the calling processes using the option
	      <span class="code">{self, once}</span> the first message will have an additional
	      element e.i. {http, {RequestId, stream_start, Headers, Pid},
	      this is the process id that should be used as an argument to
	      http:stream_next/1 to trigger the next message to be sent to
	      the calling process. </p>
	    <p>Note that it is possible that chunked encoding will add
	      headers so that there are more headers in the stream_end
	      message than in the stream_start.
	      When streaming to a file and the request is asynchronous the
	      message {http, {RequestId, saved_to_file}} will be sent. </p>
            <p>Defaults to <span class="code">none</span>. </p>
	  </dd>

          <dt><strong><span class="code">body_format</span></strong></dt>
          <dd>
            <p>Defines if the body shall be delivered as a string or as a 
              binary. This option is only valid for the synchronous 
              request. </p>
            <p>Defaults to <span class="code">string</span>. </p>
	  </dd>

          <dt><strong><span class="code">full_result</span></strong></dt>
          <dd>
            <p>Should a "full result" be returned to the caller (that is,
              the body, the headers and the entire status-line) or not 
              (the body and the status code). </p>
            <p>Defaults to <span class="code">true</span>. </p>
	  </dd>

          <dt><strong><span class="code">header_as_is</span></strong></dt>
          <dd>
            <p>Shall the headers provided by the user be made 
              lower case or be regarded as case sensitive. </p>
            <p>Note that the http standard requires them to be 
              case insenstive. This feature should only be used if there is 
              no other way to communicate with the server or for testing 
              purpose. Also note that when this option is used no headers 
              will be automatically added, all necessary headers has to be 
              provided by the user. </p>
            <p>Defaults to <span class="code">false</span>. </p>
	  </dd>

          <dt><strong><span class="code">socket_opts</span></strong></dt>
          <dd>
            <p>Socket options to be used for this and subsequent 
              request(s). </p>
            <p>Overrides any value set by the 
              <span class="bold_code"><a href="set_options.html">set_options</a></span> 
              function. </p>
            <p>Note that the validity of the options are <strong>not</strong>
              checked in any way. </p>
            <p>Note that this may change the socket behaviour 
              (see <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','kernel','inet.html#setopts');">inet:setopts/2</a></span>) 
              for an already existing, and therefor already connected 
              request handler. </p>
            <p>By defaults the socket options set by the 
              <span class="bold_code"><a href="#set_options">set_options/1,2</a></span> 
              function is used when establishing connection. </p>
	  </dd>

          <dt><strong><span class="code">receiver</span></strong></dt>
          <dd>
            <p>Defines how the client will deliver the result for a 
              asynchroneous request (<span class="code">sync</span> has the value 
              <span class="code">false</span>). </p>

            <dl>
              <dt><strong><span class="code">pid()</span></strong></dt>
              <dd>
	        <p>Message(s) will be sent to this process in the format: </p>
<div class="example"><pre>
{http, ReplyInfo}
</pre></div>
	      </dd>

              <dt><strong><span class="code">function/1</span></strong></dt>
              <dd>
	        <p>Information will be delivered to the receiver via calls 
                  to the provided fun: </p>
<div class="example"><pre>
Receiver(ReplyInfo)
</pre></div>
  	      </dd>

              <dt><strong><span class="code">{Module, Funcion, Args}</span></strong></dt>
              <dd>
	        <p>Information will be delivered to the receiver via calls 
                  to the callback function: </p>
<div class="example"><pre>
apply(Module, Function, [ReplyInfo | Args])
</pre></div>
	      </dd>

            </dl>
            <p>In all cases above, <span class="code">ReplyInfo</span> has the following 
              structure: </p>

<div class="example"><pre>
{RequestId, saved_to_file}
{RequestId, {error, Reason}}
{RequestId, Result}
{RequestId, stream_start, Headers}
{RequestId, stream_start, Headers, HandlerPid}
{RequestId, stream,       BinBodyPart}
{RequestId, stream_end,   Headers}
</pre></div>

            <p>Defaults to the <span class="code">pid()</span> of the process calling the request 
              function (<span class="code">self()</span>). </p>
	  </dd>
        </dl>

        <a name="cancel_request"></a>
      </p></div>

    <p><a name="cancel_request-1"><span class="bold_code">cancel_request(RequestId) -&gt; </span></a><br><a name="cancel_request-2"><span class="bold_code">cancel_request(RequestId, Profile) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">RequestId = request_id() - A unique identifier as returned
        by request/4</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">Profile = profile()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Cancels an asynchronous HTTP-request. </p>

        <a name="set_options"></a>
      </p></div>

    <p><a name="set_options-1"><span class="bold_code">set_options(Options) -&gt; </span></a><br><a name="set_options-2"><span class="bold_code">set_options(Options, Profile) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Options = [Option]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Option = {proxy,                 {Proxy, NoProxy}} | 
                    {max_sessions,          MaxSessions} |
	            {max_keep_alive_length, MaxKeepAlive} | 
                    {keep_alive_timeout,    KeepAliveTimeout} |
	            {max_pipeline_length,   MaxPipeline} |  
                    {pipeline_timeout,      PipelineTimeout} | 
                    {cookies,               CookieMode} | 
                    {ipfamily,              IpFamily} | 
                    {ip,                    IpAddress} | 
                    {port,                  Port} | 
                    {socket_opts,           socket_opts()} | 
                    {verbose,               VerboseMode} </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Proxy = {Hostname, Port}</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Hostname = string() </span><br>
</div>
        <div class="REFBODY">ex: "localhost" or "foo.bar.se"</div>
        <div class="REFTYPES">
<span class="bold_code">Port = integer()</span><br>
</div>
        <div class="REFBODY">ex: 8080 </div>
        <div class="REFTYPES">
<span class="bold_code">socket_opts() = [socket_opt()]</span><br>
</div>
        <div class="REFBODY">The options are appended to the socket options used by the 
          client. </div>
        <div class="REFBODY">These are the default values when a new request handler
          is started (for the initial connect). They are passed directly 
          to the underlying transport (gen_tcp or ssl) <strong>without</strong> 
          verification! </div>
        <div class="REFTYPES">
<span class="bold_code">NoProxy = [NoProxyDesc]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">NoProxyDesc = DomainDesc | HostName | IPDesc</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">DomainDesc = "*.Domain"</span><br>
</div>
        <div class="REFBODY">ex: "*.ericsson.se"</div>
        <div class="REFTYPES">
<span class="bold_code">IpDesc = string()</span><br>
</div>
        <div class="REFBODY">ex: "134.138" or "[FEDC:BA98" (all IP-addresses starting with 134.138 or FEDC:BA98), "66.35.250.150" or "[2010:836B:4179::836B:4179]" (a complete IP-address).</div>
        <div class="REFTYPES">
<span class="bold_code">MaxSessions = integer() </span><br>
</div>
        <div class="REFBODY">Default is <strong>2</strong>. 
          Maximum number of persistent connections to a host.</div>
	<div class="REFTYPES">
<span class="bold_code">MaxKeepAlive = integer() </span><br>
</div>
        <div class="REFBODY">Default is <strong>5</strong>. 
          Maximum number of outstanding requests on the same connection to 
          a host.</div>
        <div class="REFTYPES">
<span class="bold_code">KeepAliveTimeout = integer() </span><br>
</div>
        <div class="REFBODY">Default is <strong>120000</strong> (= 2 min). 
          If a persistent connection is idle longer than the 
          keep_alive_timeout the client will close the connection. 
          The server may also have a such a time out but you should 
          not count on it!</div>
	<div class="REFTYPES">
<span class="bold_code">MaxPipeline = integer() </span><br>
</div>
        <div class="REFBODY">Default is <strong>2</strong>. 
          Maximum number of outstanding requests on a pipelined connection to a host.</div>
        <div class="REFTYPES">
<span class="bold_code">PipelineTimeout = integer() </span><br>
</div>
        <div class="REFBODY">Default is <strong>0</strong>, 
          which will result in pipelining not being used. 
          If a persistent connection is idle longer than the 
          pipeline_timeout the client will close the connection. </div>
        <div class="REFTYPES">
<span class="bold_code">CookieMode = enabled | disabled | verify </span><br>
</div>
        <div class="REFBODY">Default is <strong>disabled</strong>. 
          If Cookies are enabled all valid cookies will automatically be 
          saved in the client manager's cookie database. 
          If the option verify is used the function http:verify_cookie/2 
          has to be called for the cookie to be saved.</div>
        <div class="REFTYPES">
<span class="bold_code">IpFamily = inet | inet6 | inet6fb4 </span><br>
</div>
        <div class="REFBODY">By default <strong>inet</strong>. 
          When it is set to <span class="code">inet6fb4</span> you can use both ipv4 and ipv6. 
          It first tries <span class="code">inet6</span> and if that does not works falls back to <span class="code">inet</span>. 
          The option is here to provide a workaround for buggy ipv6 stacks to ensure that 
          ipv4 will always work.</div>
	<div class="REFTYPES">
<span class="bold_code">IpAddress = ip_address() </span><br>
</div>
        <div class="REFBODY">If the host has several network interfaces, this option specifies which one to use. 
          See gen_tcp:connect/3,4 for more info. </div>
	<div class="REFTYPES">
<span class="bold_code">Port = integer() </span><br>
</div>
        <div class="REFBODY">Specify which local port number to use. 
          See gen_tcp:connect/3,4 for more info. </div>
        <div class="REFTYPES">
<span class="bold_code">VerboseMode = false | verbose | debug | trace </span><br>
</div>
        <div class="REFBODY">Default is <strong>false</strong>. 
          This option is used to switch on (or off) 
          different levels of erlang trace on the client. 
          It is a debug feature.</div>
	<div class="REFTYPES">
<span class="bold_code">Profile = profile()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Sets options to be used for subsequent
          requests.</p>
        <div class="note">
<div class="label">Note</div>
<div class="content"><p>
          <p>If possible the client will keep its connections
            alive and use persistent connections
	    with  or without pipeline depending on configuration
	    and current circumstances. The HTTP/1.1 specification does not
            provide a guideline for how many requests that would be
            ideal to be sent on a persistent connection,
	    this very much depends on the
            application. Note that a very long queue of requests may cause a
            user perceived delays as earlier request may take a long time
            to complete. The HTTP/1.1 specification does suggest a
            limit of 2 persistent connections per server, which is the
            default value of the max_sessions option. </p>
        </p></div>
</div>

        <a name="stream_next"></a>
      </p></div>
    
     <p><a name="stream_next-1"><span class="bold_code">stream_next(Pid) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid() - as received in the stream_start message</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Triggers the next message to be streamed, e.i.
	  same behavior as active once for sockets.</p>

        <a name="verify_cookie"></a>
        <a name="store_cookie"></a>
      </p></div>
    
    <p><a name="store_cookie-2"><span class="bold_code">store_cookie(SetCookieHeaders, Url) -&gt; </span></a><br><a name="store_cookie-3"><span class="bold_code">store_cookie(SetCookieHeaders, Url, Profile) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">SetCookieHeaders = headers() - where field = "set-cookie"</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Url = url()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">Profile = profile()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Saves the cookies defined in SetCookieHeaders
          in the client profile's cookie database. You need to
          call this function if you set the option cookies to <span class="code">verify</span>.
	  If no profile is specified the default profile will be used.
	</p>

        <a name="cookie_header"></a>
      </p></div>

    <p><a name="cookie_header-1"><span class="bold_code">cookie_header(Url) -&gt; </span></a><br><a name="cookie_header-2"><span class="bold_code">cookie_header(Url, Profile) -&gt; header() | {error, Rason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Url = url()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">Profile = profile()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns the cookie header that would be sent
          when making a request to Url using the profile Profile.
	  If no profile is specified the default profile will be used.
	</p>

        <a name="reset_cookies"></a>
      </p></div>


    <p><a name="reset_cookies-0"><span class="bold_code">reset_cookies() -&gt; void()</span></a><br><a name="reset_cookies-1"><span class="bold_code">reset_cookies(Profile) -&gt; void()</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
	<div class="REFTYPES">
<span class="bold_code">Profile = profile()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Resets (clears) the cookie database for the specified Profile.
	  If no profile is specified the default profile will be used.
	</p>
      </p></div>


    <p><a name="which_cookies-0"><span class="bold_code">which_cookies() -&gt; cookies()</span></a><br><a name="which_cookies-1"><span class="bold_code">which_cookies(Profile) -&gt; cookies()</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
	<div class="REFTYPES">
<span class="bold_code">Profile = profile()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">cookies() = [cooie_stores()]</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">cookie_stores() = {cookies, icookies()} | {session_cookies, icookies()}</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">icookies() = [icookie()]</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">cookie() = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>This function produces a list of the entire cookie database.
          It is intended for debugging/testing purposes. 
	  If no profile is specified the default profile will be used.
	</p>
      </p></div>
  

  <h3><a name="id2277536">SEE ALSO</a></h3>
<div class="REFBODY">
    
    <p>RFC 2616, <span class="bold_code"><a href="inets.html">inets(3)</a></span>,
      <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','kernel','gen_tcp.html');">gen_tcp(3)</a></span>, 
      <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','ssl','ssl.html');">ssl(3)</a></span>
    </p>
  </div>
  
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2010 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>