ajhttp.c


Function ajHttpGetProxyinfo

Returns a proxy definition (if any). Any proxy string given as an argument overrides any EMBOSS_PROXY definition. This allows strings from DB definitions to override such an envvar.

Synopsis

Prototype
AjBool ajHttpGetProxyinfo (
      const AjPStr dbproxy,
      ajint* proxyport,
      AjPStr* proxyname,
      AjPStr* proxyauth,
      AjPStr* proxycreds
);

TypeNameRead/WriteDescription
const AjPStrdbproxyInputPrimary proxy string (if any)
ajint*proxyportOutputProxy port
AjPStr*proxynameOutputProxy name
AjPStr*proxyauthOutputProxy authentication type (if any)
AjPStr*proxycredsOutputProxy auth credentials (if any)
AjBool RETURNajTrue if a proxy was defined

Input
dbproxy:(Input)Primary proxy string (if any)
Output
proxyport:(Output)Proxy port
proxyname:(Output)Proxy name
proxyauth:(Output)Proxy authentication type (if any)
proxycreds:(Output)Proxy auth credentials (if any)
Returns
AjBool:ajTrue if a proxy was defined

Description

Returns a proxy definition (if any). Any proxy string given as an argument overrides any EMBOSS_PROXY definition. This allows strings from DB definitions to override such an envvar.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpGetVersion

Returns the HTTP version. Any supplied version takes precedence over an EMBOSS_HTTPVERSION definition so allowing DB entries to override such a setting.

Synopsis

Prototype
AjBool ajHttpGetVersion (
      const AjPStr version,
      AjPStr* httpver
);

TypeNameRead/WriteDescription
const AjPStrversionInputVersion or NULL (or zero-length string)
AjPStr*httpverOutputHTTP version
AjBool RETURNajTrue if a version was defined

Input
version:(Input)Version or NULL (or zero-length string)
Output
httpver:(Output)HTTP version
Returns
AjBool:ajTrue if a version was defined

Description

Returns the HTTP version. Any supplied version takes precedence over an EMBOSS_HTTPVERSION definition so allowing DB entries to override such a setting.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpOpen

Opens an HTTP connection

Synopsis

Prototype
FILE* ajHttpOpen (
      const AjPStr dbname,
      const AjPStr host,
      ajint iport,
      const AjPStr get,
      struct AJSOCKET* Psock
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name (for error reporting)
const AjPStrhostInputHost name
ajintiportInputPort
const AjPStrgetInputGET string
struct AJSOCKET*PsockModifySocket returned to caller
FILE* RETURNOpen file on success, NULL on failure

Input
dbname:(Input)Database name (for error reporting)
host:(Input)Host name
iport:(Input)Port
get:(Input)GET string
Input & Output
Psock:(Modify)Socket returned to caller
Returns
FILE*:Open file on success, NULL on failure

Description

Opens an HTTP connection

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpOpenProxy

Opens an HTTP connection via a proxy

Synopsis

Prototype
FILE* ajHttpOpenProxy (
      const AjPStr dbname,
      const AjPStr proxyname,
      ajint proxyport,
      const AjPStr proxyauth,
      const AjPStr proxycreds,
      const AjPStr host,
      ajint iport,
      const AjPStr get,
      struct AJSOCKET* Psock
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabse name (for error reporting)
const AjPStrproxynameInputProxy name
ajintproxyportInputProxy port
const AjPStrproxyauthInputProxy auth type (if any)
const AjPStrproxycredsInputProxy auth credentials (if any)
const AjPStrhostInputHost name
ajintiportInputPort
const AjPStrgetInputGET string
struct AJSOCKET*PsockModifySocket returned to caller
FILE* RETURNOpen file on success, NULL on failure

Input
dbname:(Input)Databse name (for error reporting)
proxyname:(Input)Proxy name
proxyport:(Input)Proxy port
proxyauth:(Input)Proxy auth type (if any)
proxycreds:(Input)Proxy auth credentials (if any)
host:(Input)Host name
iport:(Input)Port
get:(Input)GET string
Input & Output
Psock:(Modify)Socket returned to caller
Returns
FILE*:Open file on success, NULL on failure

Description

Opens an HTTP connection via a proxy

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpUrlrefNew

Initialise a URL components object

Synopsis

Prototype
AjPUrlref ajHttpUrlrefNew (
      void
);

TypeNameRead/WriteDescription
AjPUrlref RETURNURL Components

Returns
AjPUrlref:URL Components

Description

Initialise a URL components object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpUrlrefDel

Delete URL components object

Synopsis

Prototype
void ajHttpUrlrefDel (
      AjPUrlref* thys
);

TypeNameRead/WriteDescription
AjPUrlref*thysModifyURL components object
void RETURN

Input & Output
thys:(Modify)URL components object
Returns
void:No return value

Description

Delete URL components object

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpUrlrefParseC

Parse an IPV4/6 URL into its components

Synopsis

Prototype
void ajHttpUrlrefParseC (
      AjPUrlref* parts,
      const char* url
);

TypeNameRead/WriteDescription
AjPUrlref*partsModifyURL components object
const char*urlModifyURL
void RETURN

Input & Output
parts:(Modify)URL components object
url:(Modify)URL
Returns
void:No return value

Description

Parse an IPV4/6 URL into its components

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpUrlrefSplitPort

Separate any port from a host specification (IPV4/6)

Synopsis

Prototype
void ajHttpUrlrefSplitPort (
      AjPUrlref urli
);

TypeNameRead/WriteDescription
AjPUrlrefurliModifyURL components object
void RETURN

Input & Output
urli:(Modify)URL components object
Returns
void:No return value

Description

Separate any port from a host specification (IPV4/6)

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpUrlrefSplitUsername

Separate any username[:password] from a host specification (IPV4/6)

Synopsis

Prototype
void ajHttpUrlrefSplitUsername (
      AjPUrlref urli
);

TypeNameRead/WriteDescription
AjPUrlrefurliModifyURL components object
void RETURN

Input & Output
urli:(Modify)URL components object
Returns
void:No return value

Description

Separate any username[:password] from a host specification (IPV4/6)

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpQueryUrl

Returns the components of a URL (IPV4/6) An equivalent for seqHttpUrl().

Synopsis

Prototype
AjBool ajHttpQueryUrl (
      const AjPQuery qry,
      ajint* iport,
      AjPStr* host,
      AjPStr* urlget
);

TypeNameRead/WriteDescription
const AjPQueryqryInputDatabase query
ajint*iportOutputPort
AjPStr*hostOutputHost name
AjPStr*urlgetOutputURL for the HTTP header GET
AjBool RETURNajTrue if the URL was parsed

Input
qry:(Input)Database query
Output
iport:(Output)Port
host:(Output)Host name
urlget:(Output)URL for the HTTP header GET
Returns
AjBool:ajTrue if the URL was parsed

Description

Returns the components of a URL (IPV4/6) An equivalent for seqHttpUrl().

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpUrlDeconstruct

Deconstruct a URL (IPV4/6)

Synopsis

Prototype
void ajHttpUrlDeconstruct (
      const AjPStr url,
      ajint* iport,
      AjPStr* host,
      AjPStr* urlget
);

TypeNameRead/WriteDescription
const AjPStrurlInputurl
ajint*iportOutputPort
AjPStr*hostOutputHost name
AjPStr*urlgetOutputURL for the HTTP header GET
void RETURN

Input
url:(Input)url
Output
iport:(Output)Port
host:(Output)Host name
urlget:(Output)URL for the HTTP header GET
Returns
void:No return value

Description

Deconstruct a URL (IPV4/6)

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpRedirect

Reads the header of http response in given buffer buff, if it includes a redirection response updates the host, port and get parameters using the 'Location' header

Synopsis

Prototype
AjBool ajHttpRedirect (
      AjPFilebuff buff,
      AjPStr* host,
      ajint* port,
      AjPStr* path
);

TypeNameRead/WriteDescription
AjPFilebuffbuffModifyfile buffer
AjPStr*hostOutputHost name
ajint*portOutputPort
AjPStr*pathOutputpart of URL after port number
AjBool RETURNreturns true if the header includes a redirection response

Output
host:(Output)Host name
port:(Output)Port
path:(Output)part of URL after port number
Input & Output
buff:(Modify)file buffer
Returns
AjBool:returns true if the header includes a redirection response

Description

Reads the header of http response in given buffer buff, if it includes a redirection response updates the host, port and get parameters using the 'Location' header

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajHttpRead

Reads the header of http response in given buffer buff, if it includes a redirection response updates the host, port and get parameters using the 'Location' header

Synopsis

Prototype
AjPFilebuff ajHttpRead (
      const AjPStr dbhttpver,
      const AjPStr dbname,
      const AjPStr dbproxy,
      const AjPStr host,
      ajint port,
      const AjPStr dbpath
);

TypeNameRead/WriteDescription
const AjPStrdbhttpverInputDB http version
const AjPStrdbnameInputDB name
const AjPStrdbproxyInputDB proxy
const AjPStrhostInputHost name
ajintportInputPort
const AjPStrdbpathInputpart of URL after port number
AjPFilebuff RETURNhttp response

Input
dbhttpver:(Input)DB http version
dbname:(Input)DB name
dbproxy:(Input)DB proxy
host:(Input)Host name
port:(Input)Port
dbpath:(Input)part of URL after port number
Returns
AjPFilebuff:http response

Description

Reads the header of http response in given buffer buff, if it includes a redirection response updates the host, port and get parameters using the 'Location' header

See Also

See other functions in this section

Availability

In release 6.4.0