eyBuildLib API Reference : eyBuildLib
ebhttpc - HTTP client library
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
HTTP client user agent library.
ebHCCreate( ) - create a HTTP client user-agent object
HTTP_CLIENT * ebHCCreate (void)
This routine is to create a HTTP client user-agent object.
pointer to user-agent object, or NULL if lack memory.
ebHCDestroy( ) - destroy HTTP client user-agent object
int ebHCDestroy ( HTTP_CLIENT * hc /* http client handle */ )
This routine is to destroy the HTTP client user-agent object.
OK, or or error code if less zero.
ebHCResetHeader( ) - reset the HTTP header list into default
int ebHCResetHeader ( HTTP_CLIENT * hc )
This routine is to reset the HTTP header list into default.
OK, or or error code if less zero.
ebHCAddHeader( ) - add a HTTP header line for current user agent
int ebHCAddHeader ( HTTP_CLIENT * hc, const char * name, const char * value )
This routine is to add a HTTP header line for current user agent.
OK, or or error code if less zero.
ebHCSetHeader( ) - add a HTTP header line for current user agent
int ebHCSetHeader ( HTTP_CLIENT * hc, const char * header )
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".
OK, or or error code if less zero.
ebHCDelHeader( ) - delete a HTTP header line from header list
int ebHCDelHeader ( HTTP_CLIENT * hc, const char * name )
This routine is to delete a HTTP header line from header list.
OK, ERROR if not found such header string.
ebHCClearHeaders( ) - remove all HTTP header line from header list
int ebHCClearHeaders ( HTTP_CLIENT * hc )
This routine is to remove all HTTP header line from header list.
OK, or or error code if less zero.
ebHCAddCookie( ) - add a HTTP cookie item into current user agent
int ebHCAddCookie ( HTTP_CLIENT * hc, const char * name, const char * value, time_t expire, ... )
This routine is to add a HTTP cookie item into current user agent.
OK, or or error code if less zero.
ebHCDelCookie( ) - delete a HTTP cookie item from current user agent
int ebHCDelCookie ( HTTP_CLIENT * hc, const char * name )
This routine is to delete a HTTP cookie item from current user agent.
OK, ERROR if not found such cookie string.
ebHCClearCookies( ) - remove all HTTP cookie items from current user agent
int ebHCClearCookies ( HTTP_CLIENT * hc )
This routine is to remove all HTTP cookie items from current user agent.
OK, or or error code if less zero.
ebHCAddPost( ) - add a HTTP post item into current user agent
int ebHCAddPost ( HTTP_CLIENT * hc, const char * name, const char * value, BOOL isfile )
This routine adds a HTTP post item into current user agent.
OK, or or error code if less zero.
ebHCAddPostField( ) - add a HTTP post filed item into current user agent
int ebHCAddPostField ( HTTP_CLIENT * hc, const char * name, const char * value )
This routine adds a HTTP post filed item into current user agent.
OK, or or error code if less zero.
ebHCAddPostFile( ) - add a HTTP post file item into current user agent
int ebHCAddPostFile ( HTTP_CLIENT * hc, const char * name, const char * value )
This routine adds a HTTP post file item into current user agent.
OK, or or error code if less zero.
ebHCDelPost( ) - delete a HTTP post item from current user agent
int ebHCDelPost ( HTTP_CLIENT * hc, const char * name )
This routine deletes a HTTP post item from current user agent.
OK, ERROR if not found such post item.
ebHCClearPosts( ) - remove all HTTP post items from current user agent
int ebHCClearPosts ( HTTP_CLIENT * hc )
This routine is to remove all HTTP post items from current user agent.
OK, or or error code if less zero.
ebHCSetPostString( ) - setup a post string for current user agent.
int ebHCSetPostString ( HTTP_CLIENT * hc, const char * poststring )
This routine is to setup a post string for current user agent.
OK, or or error code if less zero.
ebHCSetResInflate( ) - setup a temp file for inflate the compressed response
int ebHCSetResInflate ( HTTP_CLIENT * hc, const char * tmpfile )
This routine is to setup a temp file for inflate the compressed response.
OK, or or error code if less zero.
ebHCSetProxy( ) - setup a HTTP proxy for current user agent
int ebHCSetProxy ( HTTP_CLIENT * hc, const char * addr, short port )
This routine is to setup a HTTP proxy for current user agent
OK, or error code if less zero.
ebHCSetConnectTimeout( ) - set the max connetion wait before timeout
int ebHCSetConnectTimeout ( HTTP_CLIENT * hc, /* http client handle */ int timeout /* microsecond */ )
This routine is to set the max connetion wait before timeout (microsecond).
OK/ERROR
ebHCSetRecvTimeout( ) - set the max receive wait before timeout
int ebHCSetRecvTimeout ( HTTP_CLIENT * hc, /* http client handle */ int timeout /* microsecond */ )
This routine is to set the max connetion wait before timeout (microsecond).
OK/ERROR
ebHCSetAuthorization( ) - set the HTTP authorization account
int ebHCSetAuthorization ( HTTP_CLIENT * hc, const char * realm, const char * user, const char * pswd )
This routine is to set the HTTP authorization account (BASIC).
OK/ERROR
ebHCSetAutoRedirect( ) - set the max times of automatic redirection
int ebHCSetAutoRedirect ( HTTP_CLIENT * hc, int maxtimes )
This routine is to set the max times of automatic redirection. If maxtimes less or equal to zero, automatic redirection will be disabled.
OK/ERROR
ebHCSetAutoParseCookie( ) - set automatically parse cookie or not
int ebHCSetAutoParseCookie ( HTTP_CLIENT * hc, BOOL blenable )
This routine is to set automatically parse cookie or not. The default action of HTTPC is parse cookie automatically.
OK/ERROR
ebHCRequestRemote( ) - connect remote host and send the request
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 */ )
This routine is to connect remote host and send the request.
OK, or or error code if less zero.
ebHCSetAutoRemovePost( ) - set auto remove HTTP post items or not
int ebHCSetAutoRemovePost ( HTTP_CLIENT * hc, BOOL blopt )
This routine is to set remove HTTP post items from current user agent automatically or not.
OK/ERROR.
ebHCRequest( ) - request remote server and get the response header
int ebHCRequest ( HTTP_CLIENT * hc, /* http client handle */ const char * requrl, /* full url */ const char * method /* request method, GET/POST */ )
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).
OK, or or error code if less zero.
ebHCGetRawResponse( ) - get the raw response only when receive response error.
int ebHCGetRawResponse ( HTTP_CLIENT * hc, /* http client handle */ char * pbuf, /* store raw data */ size_t size )
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.
the total length of raw response, or ERROR if unavailable.
ebHCResCleanup( ) - clean up the response content
int ebHCResCleanup ( HTTP_CLIENT * hc )
This routine is to clean up the response content.
OK/ERROR
ebHCRecvHeader( ) - receive response header
int ebHCRecvHeader ( HTTP_CLIENT * hc )
This routine is to receive response header.
OK, or or error code if less zero.
ebHCReadResponse( ) - read response conetent from user agent
int ebHCReadResponse ( HTTP_CLIENT * hc, void * pbuf, size_t len )
This routine is to read response conetent from user agent.
length of read, or error code if less zero.
ebHCGetResHeaderNumber( ) - get the number of response headers.
int ebHCGetResHeaderNumber ( HTTP_CLIENT * hc )
This routine is to get the number of response header.
the number of response headers
ebHCGetResHeaderByIndex( ) - get response header by index
char * ebHCGetResHeaderByIndex ( HTTP_CLIENT * hc, size_t index )
This routine is to get response header by index
pointer to response header, or a blank string "".
ebHCGetResHeader( ) - get response header by header name
char * ebHCGetResHeader ( HTTP_CLIENT * hc, const char * header )
This routine is to get response header by header name.
pointer to response header, or a blank string "" if not found.
ebHCGetResCookieNumber( ) - get the number of response cookies
int ebHCGetCookieNumber ( HTTP_CLIENT * hc )
This routine is to get the number of response cookies.
the number of response cookies.
ebHCGetResCookieByIndex( ) - get response cookie by index
char * ebHCGetCookieByIndex ( HTTP_CLIENT * hc, size_t index, EB_HCCOOKIE * cookie )
This routine is to get response header by index
pointer to response header, or a blank string "".
ebHCGetCookie( ) - get response cookie by cookie name
char * ebHCGetCookie ( HTTP_CLIENT * hc, const char * name, EB_HCCOOKIE * cookie )
This routine is to get response cookie by cookie name, if parameter cookie is not NULL, it will return detail of the cookie.
pointer to cookie value, or a blank string "" if not found.
ebHCGetResEtag( ) - get the ETag of response.
char * ebHCGetResEtag ( HTTP_CLIENT * hc )
This routine is to get the ETag of response.
pointer to ETag, or a blank string if not found
ebHCGetResAcceptRanges( ) - get the content accept ranges.
char * ebHCGetResAcceptRanges ( HTTP_CLIENT * hc )
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.
pointer to content accept ranges, or a blank string if not found
ebHCGetResContentRange( ) - get the content range of response
int ebHCGetResContentRange ( HTTP_CLIENT * hc, size_t * start, size_t * end, size_t * total )
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.
OK, or ERROR if not contain a valid range.
ebHCGetResCode( ) - get the HTTP response code
int ebHCGetResCode ( HTTP_CLIENT * hc )
This routine is to get the HTTP response code.
a HTTP response code
ebHCGetResLastModify( ) - get last modified time of response
time_t ebHCGetResLastModify ( HTTP_CLIENT * hc )
This routine is to get last modified time of response.
time of last modified, or 0 if has not set.
ebHCGetResCharset( ) - get charset of response
char * ebHCGetResCharset ( HTTP_CLIENT * hc )
This routine is to get charset of response.
a HTTP response code
ebHCGetResContentType( ) - get the content type of response
char * ebHCGetResContentType ( HTTP_CLIENT * hc )
This routine is to get the content type of response.
pointer to the content type of response
ebHCGetResContentEncode( ) - get the content encoding of response
char * ebHCGetResContentEncoding ( HTTP_CLIENT * hc )
This routine is to get the content type of response.
pointer to the content type of response
ebHCGetResContentLength( ) - get the content length of response
int ebHCGetResContentLength ( HTTP_CLIENT * hc )
This routine is to get the content length of response.
content length of response
ebHCGetResAttachedFilename( ) - get the attached filename of response
char * ebHCGetResAttachedFilename ( HTTP_CLIENT * hc )
This routine is to get the attached filename of response.
pointer to attached filename of response, or blank string if it is not set.
ebHCGetError( ) - get the error description of specific error code
char * ebHCGetError ( int errcode, char * errbuf )
This routine is to get the error string of specific error code
pointer to the error description