eyBuildLib API Reference : eyBuildLib

ebhttpc

NAME

ebhttpc - HTTP client library

ROUTINES

ebHCCreate( ) - create a HTTP client user-agent object
ebHCDestroy( ) - destroy HTTP client user-agent object
ebHCResetHeader( ) - reset the HTTP header list into default
ebHCAddHeader( ) - add a HTTP header line for current user agent
ebHCSetHeader( ) - add a HTTP header line for current user agent
ebHCDelHeader( ) - delete a HTTP header line from header list
ebHCClearHeaders( ) - remove all HTTP header line from header list
ebHCAddCookie( ) - add a HTTP cookie item into current user agent
ebHCDelCookie( ) - delete a HTTP cookie item from current user agent
ebHCClearCookies( ) - remove all HTTP cookie items from current user agent
ebHCAddPost( ) - add a HTTP post item into current user agent
ebHCAddPostField( ) - add a HTTP post filed item into current user agent
ebHCAddPostFile( ) - add a HTTP post file item into current user agent
ebHCDelPost( ) - delete a HTTP post item from current user agent
ebHCClearPosts( ) - remove all HTTP post items from current user agent
ebHCSetPostString( ) - setup a post string for current user agent.
ebHCSetResInflate( ) - setup a temp file for inflate the compressed response
ebHCSetProxy( ) - setup a HTTP proxy for current user agent
ebHCSetConnectTimeout( ) - set the max connetion wait before timeout
ebHCSetRecvTimeout( ) - set the max receive wait before timeout
ebHCSetAuthorization( ) - set the HTTP authorization account
ebHCSetAutoRedirect( ) - set the max times of automatic redirection
ebHCSetAutoParseCookie( ) - set automatically parse cookie or not
ebHCRequestRemote( ) - connect remote host and send the request
ebHCSetAutoRemovePost( ) - set auto remove HTTP post items or not
ebHCRequest( ) - request remote server and get the response header
ebHCGetRawResponse( ) - get the raw response only when receive response error.
ebHCResCleanup( ) - clean up the response content
ebHCRecvHeader( ) - receive response header
ebHCReadResponse( ) - read response conetent from user agent
ebHCGetResHeaderNumber( ) - get the number of response headers.
ebHCGetResHeaderByIndex( ) - get response header by index
ebHCGetResHeader( ) - get response header by header name
ebHCGetResCookieNumber( ) - get the number of response cookies
ebHCGetResCookieByIndex( ) - get response cookie by index
ebHCGetCookie( ) - get response cookie by cookie name
ebHCGetResEtag( ) - get the ETag of response.
ebHCGetResAcceptRanges( ) - get the content accept ranges.
ebHCGetResContentRange( ) - get the content range of response
ebHCGetResCode( ) - get the HTTP response code
ebHCGetResLastModify( ) - get last modified time of response
ebHCGetResCharset( ) - get charset of response
ebHCGetResContentType( ) - get the content type of response
ebHCGetResContentEncode( ) - get the content encoding of response
ebHCGetResContentLength( ) - get the content length of response
ebHCGetResAttachedFilename( ) - get the attached filename of response
ebHCGetError( ) - get the error description of specific error code

DESCRIPTION

HTTP client user agent library.


eyBuildLib : Routines

ebHCCreate( )

NAME

ebHCCreate( ) - create a HTTP client user-agent object

SYNOPSIS

HTTP_CLIENT * ebHCCreate (void)

DESCRIPTION

This routine is to create a HTTP client user-agent object.

RETURNS

pointer to user-agent object, or NULL if lack memory.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCDestroy( )

NAME

ebHCDestroy( ) - destroy HTTP client user-agent object

SYNOPSIS

int ebHCDestroy
    (
    HTTP_CLIENT * hc          /* http client handle */
    )

DESCRIPTION

This routine is to destroy the HTTP client user-agent object.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCResetHeader( )

NAME

ebHCResetHeader( ) - reset the HTTP header list into default

SYNOPSIS

int ebHCResetHeader
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to reset the HTTP header list into default.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCAddHeader( )

NAME

ebHCAddHeader( ) - add a HTTP header line for current user agent

SYNOPSIS

int ebHCAddHeader
    (
    HTTP_CLIENT * hc,
    const char *  name,
    const char *  value
    )

DESCRIPTION

This routine is to add a HTTP header line for current user agent.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetHeader( )

NAME

ebHCSetHeader( ) - add a HTTP header line for current user agent

SYNOPSIS

int ebHCSetHeader
    (
    HTTP_CLIENT * hc,
    const char *  header
    )

DESCRIPTION

This routine is to add a HTTP header line for current user agent. It will not replace the exist header. The header parameter should be format as "name: value".

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCDelHeader( )

NAME

ebHCDelHeader( ) - delete a HTTP header line from header list

SYNOPSIS

int ebHCDelHeader
    (
    HTTP_CLIENT * hc,
    const char *  name
    )

DESCRIPTION

This routine is to delete a HTTP header line from header list.

RETURNS

OK, ERROR if not found such header string.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCClearHeaders( )

NAME

ebHCClearHeaders( ) - remove all HTTP header line from header list

SYNOPSIS

int ebHCClearHeaders
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to remove all HTTP header line from header list.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCAddCookie( )

NAME

ebHCAddCookie( ) - add a HTTP cookie item into current user agent

SYNOPSIS

int ebHCAddCookie
    (
    HTTP_CLIENT * hc,
    const char *  name,
    const char *  value,
    time_t        expire,
                  ...
    )

DESCRIPTION

This routine is to add a HTTP cookie item into current user agent.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCDelCookie( )

NAME

ebHCDelCookie( ) - delete a HTTP cookie item from current user agent

SYNOPSIS

int ebHCDelCookie
    (
    HTTP_CLIENT * hc,
    const char *  name
    )

DESCRIPTION

This routine is to delete a HTTP cookie item from current user agent.

RETURNS

OK, ERROR if not found such cookie string.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCClearCookies( )

NAME

ebHCClearCookies( ) - remove all HTTP cookie items from current user agent

SYNOPSIS

int ebHCClearCookies
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to remove all HTTP cookie items from current user agent.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCAddPost( )

NAME

ebHCAddPost( ) - add a HTTP post item into current user agent

SYNOPSIS

int ebHCAddPost
    (
    HTTP_CLIENT * hc,
    const char *  name,
    const char *  value,
    BOOL          isfile
    )

DESCRIPTION

This routine adds a HTTP post item into current user agent.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCAddPostField( )

NAME

ebHCAddPostField( ) - add a HTTP post filed item into current user agent

SYNOPSIS

int ebHCAddPostField
    (
    HTTP_CLIENT * hc,
    const char *  name,
    const char *  value
    )

DESCRIPTION

This routine adds a HTTP post filed item into current user agent.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCAddPostFile( )

NAME

ebHCAddPostFile( ) - add a HTTP post file item into current user agent

SYNOPSIS

int ebHCAddPostFile
    (
    HTTP_CLIENT * hc,
    const char *  name,
    const char *  value
    )

DESCRIPTION

This routine adds a HTTP post file item into current user agent.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCDelPost( )

NAME

ebHCDelPost( ) - delete a HTTP post item from current user agent

SYNOPSIS

int ebHCDelPost
    (
    HTTP_CLIENT * hc,
    const char *  name
    )

DESCRIPTION

This routine deletes a HTTP post item from current user agent.

RETURNS

OK, ERROR if not found such post item.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCClearPosts( )

NAME

ebHCClearPosts( ) - remove all HTTP post items from current user agent

SYNOPSIS

int ebHCClearPosts
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to remove all HTTP post items from current user agent.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetPostString( )

NAME

ebHCSetPostString( ) - setup a post string for current user agent.

SYNOPSIS

int ebHCSetPostString
    (
    HTTP_CLIENT * hc,
    const char *  poststring
    )

DESCRIPTION

This routine is to setup a post string for current user agent.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetResInflate( )

NAME

ebHCSetResInflate( ) - setup a temp file for inflate the compressed response

SYNOPSIS

int ebHCSetResInflate
    (
    HTTP_CLIENT * hc,
    const char *  tmpfile
    )

DESCRIPTION

This routine is to setup a temp file for inflate the compressed response.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetProxy( )

NAME

ebHCSetProxy( ) - setup a HTTP proxy for current user agent

SYNOPSIS

int ebHCSetProxy
    (
    HTTP_CLIENT * hc,
    const char *  addr,
    short         port
    )

DESCRIPTION

This routine is to setup a HTTP proxy for current user agent

RETURNS

OK, or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetConnectTimeout( )

NAME

ebHCSetConnectTimeout( ) - set the max connetion wait before timeout

SYNOPSIS

int ebHCSetConnectTimeout
    (
    HTTP_CLIENT * hc,         /* http client handle */
    int           timeout     /* microsecond */
    )

DESCRIPTION

This routine is to set the max connetion wait before timeout (microsecond).

RETURNS

OK/ERROR

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetRecvTimeout( )

NAME

ebHCSetRecvTimeout( ) - set the max receive wait before timeout

SYNOPSIS

int ebHCSetRecvTimeout
    (
    HTTP_CLIENT * hc,         /* http client handle */
    int           timeout     /* microsecond */
    )

DESCRIPTION

This routine is to set the max connetion wait before timeout (microsecond).

RETURNS

OK/ERROR

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetAuthorization( )

NAME

ebHCSetAuthorization( ) - set the HTTP authorization account

SYNOPSIS

int ebHCSetAuthorization
    (
    HTTP_CLIENT * hc,
    const char *  realm,
    const char *  user,
    const char *  pswd
    )

DESCRIPTION

This routine is to set the HTTP authorization account (BASIC).

RETURNS

OK/ERROR

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetAutoRedirect( )

NAME

ebHCSetAutoRedirect( ) - set the max times of automatic redirection

SYNOPSIS

int ebHCSetAutoRedirect
    (
    HTTP_CLIENT * hc,
    int           maxtimes
    )

DESCRIPTION

This routine is to set the max times of automatic redirection. If maxtimes less or equal to zero, automatic redirection will be disabled.

RETURNS

OK/ERROR

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetAutoParseCookie( )

NAME

ebHCSetAutoParseCookie( ) - set automatically parse cookie or not

SYNOPSIS

int ebHCSetAutoParseCookie
    (
    HTTP_CLIENT * hc,
    BOOL          blenable
    )

DESCRIPTION

This routine is to set automatically parse cookie or not. The default action of HTTPC is parse cookie automatically.

RETURNS

OK/ERROR

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCRequestRemote( )

NAME

ebHCRequestRemote( ) - connect remote host and send the request

SYNOPSIS

int ebHCRequestRemote
    (
    HTTP_CLIENT * hc,         /* http client handle */
    const char *  requrl,     /* full url */
    int           method,     /* request method, default is GET */
    int           enctype,    /* encode type, default is ULR encoude */
    int           version     /* version 0 or 1 for HTTP/1.0 or HTTP/1.1 */
    )

DESCRIPTION

This routine is to connect remote host and send the request.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCSetAutoRemovePost( )

NAME

ebHCSetAutoRemovePost( ) - set auto remove HTTP post items or not

SYNOPSIS

int ebHCSetAutoRemovePost
    (
    HTTP_CLIENT * hc,
    BOOL          blopt
    )

DESCRIPTION

This routine is to set remove HTTP post items from current user agent automatically or not.

RETURNS

OK/ERROR.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCRequest( )

NAME

ebHCRequest( ) - request remote server and get the response header

SYNOPSIS

int ebHCRequest
    (
    HTTP_CLIENT * hc,         /* http client handle */
    const char *  requrl,     /* full url */
    const char *  method      /* request method, GET/POST */
    )

DESCRIPTION

This routine is to request remote server and get the response header. It will remove all HTTP post items from current user agent automatically. To disabe automatically remove HTTP post items, user should call ebHCSetAutoRemovePost(hc, FASLE).

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetRawResponse( )

NAME

ebHCGetRawResponse( ) - get the raw response only when receive response error.

SYNOPSIS

int ebHCGetRawResponse
    (
    HTTP_CLIENT * hc,         /* http client handle */
    char *        pbuf,       /* store raw data */
    size_t        size
    )

DESCRIPTION

This routine is to get the raw response only when receives response error. The request errcode should be HC_ERROR_INVALID_RES_HEADER or HC_ERROR_SOCKET_OPERATION.

RETURNS

the total length of raw response, or ERROR if unavailable.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCResCleanup( )

NAME

ebHCResCleanup( ) - clean up the response content

SYNOPSIS

int ebHCResCleanup
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to clean up the response content.

RETURNS

OK/ERROR

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCRecvHeader( )

NAME

ebHCRecvHeader( ) - receive response header

SYNOPSIS

int ebHCRecvHeader
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to receive response header.

RETURNS

OK, or or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCReadResponse( )

NAME

ebHCReadResponse( ) - read response conetent from user agent

SYNOPSIS

int ebHCReadResponse
    (
    HTTP_CLIENT * hc,
    void *        pbuf,
    size_t        len
    )

DESCRIPTION

This routine is to read response conetent from user agent.

RETURNS

length of read, or error code if less zero.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResHeaderNumber( )

NAME

ebHCGetResHeaderNumber( ) - get the number of response headers.

SYNOPSIS

int ebHCGetResHeaderNumber
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get the number of response header.

RETURNS

the number of response headers

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResHeaderByIndex( )

NAME

ebHCGetResHeaderByIndex( ) - get response header by index

SYNOPSIS

char * ebHCGetResHeaderByIndex
    (
    HTTP_CLIENT * hc,
    size_t        index
    )

DESCRIPTION

This routine is to get response header by index

RETURNS

pointer to response header, or a blank string "".

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResHeader( )

NAME

ebHCGetResHeader( ) - get response header by header name

SYNOPSIS

char * ebHCGetResHeader
    (
    HTTP_CLIENT * hc,
    const char *  header
    )

DESCRIPTION

This routine is to get response header by header name.

RETURNS

pointer to response header, or a blank string "" if not found.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResCookieNumber( )

NAME

ebHCGetResCookieNumber( ) - get the number of response cookies

SYNOPSIS

int ebHCGetCookieNumber
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get the number of response cookies.

RETURNS

the number of response cookies.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResCookieByIndex( )

NAME

ebHCGetResCookieByIndex( ) - get response cookie by index

SYNOPSIS

char * ebHCGetCookieByIndex
    (
    HTTP_CLIENT * hc,
    size_t        index,
    EB_HCCOOKIE * cookie
    )

DESCRIPTION

This routine is to get response header by index

RETURNS

pointer to response header, or a blank string "".

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetCookie( )

NAME

ebHCGetCookie( ) - get response cookie by cookie name

SYNOPSIS

char * ebHCGetCookie
    (
    HTTP_CLIENT * hc,
    const char *  name,
    EB_HCCOOKIE * cookie
    )

DESCRIPTION

This routine is to get response cookie by cookie name, if parameter cookie is not NULL, it will return detail of the cookie.

RETURNS

pointer to cookie value, or a blank string "" if not found.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResEtag( )

NAME

ebHCGetResEtag( ) - get the ETag of response.

SYNOPSIS

char * ebHCGetResEtag
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get the ETag of response.

RETURNS

pointer to ETag, or a blank string if not found

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResAcceptRanges( )

NAME

ebHCGetResAcceptRanges( ) - get the content accept ranges.

SYNOPSIS

char * ebHCGetResAcceptRanges
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get the content accept ranges. The accept ranges may be "bytes", or "none" if advise the client not to attempt a range request.

RETURNS

pointer to content accept ranges, or a blank string if not found

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResContentRange( )

NAME

ebHCGetResContentRange( ) - get the content range of response

SYNOPSIS

int ebHCGetResContentRange
    (
    HTTP_CLIENT * hc,
    size_t *      start,
    size_t *      end,
    size_t *      total
    )

DESCRIPTION

This routine is to get the content range of response. If the returned value of *total is 0, it means the total length is unknown.

RETURNS

OK, or ERROR if not contain a valid range.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResCode( )

NAME

ebHCGetResCode( ) - get the HTTP response code

SYNOPSIS

int ebHCGetResCode
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get the HTTP response code.

RETURNS

a HTTP response code

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResLastModify( )

NAME

ebHCGetResLastModify( ) - get last modified time of response

SYNOPSIS

time_t ebHCGetResLastModify
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get last modified time of response.

RETURNS

time of last modified, or 0 if has not set.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResCharset( )

NAME

ebHCGetResCharset( ) - get charset of response

SYNOPSIS

char * ebHCGetResCharset
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get charset of response.

RETURNS

a HTTP response code

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResContentType( )

NAME

ebHCGetResContentType( ) - get the content type of response

SYNOPSIS

char * ebHCGetResContentType
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get the content type of response.

RETURNS

pointer to the content type of response

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResContentEncode( )

NAME

ebHCGetResContentEncode( ) - get the content encoding of response

SYNOPSIS

char * ebHCGetResContentEncoding
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get the content type of response.

RETURNS

pointer to the content type of response

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResContentLength( )

NAME

ebHCGetResContentLength( ) - get the content length of response

SYNOPSIS

int ebHCGetResContentLength
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get the content length of response.

RETURNS

content length of response

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetResAttachedFilename( )

NAME

ebHCGetResAttachedFilename( ) - get the attached filename of response

SYNOPSIS

char * ebHCGetResAttachedFilename
    (
    HTTP_CLIENT * hc
    )

DESCRIPTION

This routine is to get the attached filename of response.

RETURNS

pointer to attached filename of response, or blank string if it is not set.

SEE ALSO

ebhttpc


eyBuildLib : Routines

ebHCGetError( )

NAME

ebHCGetError( ) - get the error description of specific error code

SYNOPSIS

char * ebHCGetError
    (
    int    errcode,
    char * errbuf
    )

DESCRIPTION

This routine is to get the error string of specific error code

RETURNS

pointer to the error description

SEE ALSO

ebhttpc