The URL functions are listed below.
Copies a URL from a specified location in a source marshal buffer to a target marshal buffer.
INKMLoc INKUrlClone (INKMBuffer
dest_bufp
, INKMBuffer
src_bufp
, INKMLoc
src_url_loc
)
and
src_bufp
are the
source and destination marshal buffers.dest_bufp
is
the source URL location within the source marshal
buffer.src_url_loc
Copies the contents of the URL at location
within the
marshal buffer
src_url_loc
to a location
within the marshal buffer
src_bufp
.dest_bufp
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
Release the returned handle with a call to
INKHandleMLocRelease
.
Returns the INKMLoc
location of the
copied URL.
INK_ERROR_PTR
if an error occurs.
Copies a URL from a specified location in a source marshal buffer to a specified location in a target marshal buffer.
INKReturnCode INKUrlCopy (INKMBuffer
dest_bufp
, INKMLoc
dest_url_loc
, INKMBuffer
src_bufp
, INKMLoc
src_url_loc
)
and
src_bufp
are the
source and destination marshal buffers.dest_bufp
and
src_url_loc
are the
source and destination URL locations within the source and
destination marshal buffers. The type
dest_url_loc
INKMLoc
is used for marshal buffer
locations.
Copies the contents of the URL at location
within the
marshal buffer
src_url_loc
to the
location src_bufp
within the marshal buffer
dest_url_loc
.
dest_bufp
INKUrlCopy
works correctly even if
and
src_bufp
point to
different marshal buffers. It is important to create the destination
URL (its marshal buffer and dest_bufp
INKMLoc
) before you copy into it.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Creates a new URL in a marshal buffer.
INKMLoc INKUrlCreate (INKMBuffer
bufp
)
Creates a new URL within the marshal buffer
. Release the
resulting handle with a call to
bufp
INKHandleMLocRelease
and destroy the URL
with a call to INKUrlDestroy
. Note that
if you destroy the URL, then you must also release the
handle.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A location handle for the URL within the marshal buffer.
INK_ERROR_PTR
if an error occurs.
Destroys a specific URL within a marshal buffer.
INKReturnCode INKUrlDestroy (INKMBuffer
bufp
, INKMLoc
url_loc
)
Destroys the URL located at
within the
marshal buffer
url_loc
.bufp
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
Caution | |
---|---|
Do not forget to release the handle
|
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Formats a URL stored in a marshal buffer to an
INKIOBuffer
.
INKReturnCode INKUrlPrint (INKMBuffer
bufp
, INKMLoc
url_loc
, INKIOBuffer
iobufp
)
Formats a URL stored in an
INKMBuffer
to an
INKIOBuffer
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Gets the FTP type of a specific URL.
int INKUrlFtpTypeGet (INKMBuffer
bufp
, INKMLoc
url_loc
)
Retrieves the FTP type portion of the URL located at
within the
marshal buffer
url_loc
.bufp
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
Returns 65
if the FTP type is ASCII.
Return 73
if the FTP type is binary.
INK_ERROR_PTR
if an error occurs.
Sets the FTP type of a specific URL.
INKReturnCode INKUrlFtpTypeSet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
type
)
Sets the FTP type portion of the URL located at
within the
marshal buffer url_loc
to
the value bufp
. Valid values for the
type
argument are:type
0
, 65('A')
, 97('a')
, 69('E')
, 101('e')
, 73
('I')
, and 105('i')
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Gets the host portion of a specific URL.
const char* INKUrlHostGet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
*length
)
Retrieves the host portion of the URL located at
within the
marshal buffer url_loc
.
The length of the returned string is placed in the
bufp
argument.length
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A pointer to the host portion of the specified URL.
Release with a call to
INKHandleStringRelease
.
INK_ERROR_PTR
if an error occurs.
Note | |
---|---|
The returned string is not guaranteed to be null-terminated. |
Sets the host portion of a URL to a specific value.
INKReturnCode INKUrlHostSet (INKMBuffer
bufp
, INKMLoc
url_loc
, const char
*value
, int
length
)
Sets the host portion of the URL located at
within the
marshal buffer url_loc
to
the string bufp
. If value
length
is -1, then INKUrlHostSet
assumes that value is
null-terminated. Otherwise, the length of the string
is taken to be
value
. The string is
copied to within length
,
so it is okay to modify or delete
bufp
after calling
value
INKUrlHostSet
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Gets a specified HTTP fragment of a URL.
const char* INKUrlHttpFragmentGet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
*length
)
Retrieves the HTTP fragment portion of the URL located
at
within the
marshal buffer url_loc
.
bufp
INKUrlHttpFragmentGet
places the length
of the returned string in the
argument.length
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A pointer to the HTTP fragment portion of the specified
URL. Release with a call to
INKHandleStringRelease
.
INK_ERROR_PTR
if an error occurs.
Note | |
---|---|
The returned string is not guaranteed to be null-terminated. |
Sets a specified HTTP fragment within a URL.
INKReturnCode INKUrlHttpFragmentSet (INKMBuffer
bufp
, INKMLoc
url_loc
, const char
*value
, int
length
)
Sets the HTTP fragment portion of the URL located at
within the
marshal buffer url_loc
to
the string bufp
. If
value
is -1, then
length
INKUrlHttpFragmentSet
assumes that value
is null-terminated. Otherwise, the length of the string
is taken to be
value
. The string is
copied to within length
,
so it is okay to modify or delete
bufp
after calling
value
INKUrlHttpFragmentSet
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Gets the HTTP params portion of a specified URL.
const char* INKUrlHttpParamsGet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
*length
)
Retrieves the HTTP params portion of the URL located at
within the
marshal buffer url_loc
.
bufp
INKUrlHttpParamsGet
places the length of
the returned string in the
argument.length
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A pointer to the HTTP params portion of the specified
URL. Release with a call to
INKHandleStringRelease
.
INK_ERROR_PTR
if an error occurs.
Note | |
---|---|
The returned string is not guaranteed to be null-terminated. |
Sets the HTTP params portion of a specified URL.
INKReturnCode INKUrlHttpParamsSet (INKMBuffer
bufp
, INKMLoc
url_loc
, const char
*value
, int
length
)
Sets the HTTP params portion of the URL located at
within the
marshal buffer url_loc
to
the string bufp
. If
value
is -1, then
length
INKUrlHttpParamsSet
assumes that value is
null-terminated. Otherwise, the length of the string
is taken to be
value
.
length
INKUrlHttpParamsSet
copies the string to
within
, so it is
okay to modify or delete
bufp
after calling
value
INKUrlHttpParamsSet
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Gets the HTTP query portion of a specified URL.
const char* INKUrlHttpQueryGet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
*length
)
Retrieves the HTTP query portion of the URL located at
within the
marshal buffer url_loc
.
bufp
INKUrlHttpQueryGet
places the length of
the returned string in the
argument.length
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A pointer to the HTTP query portion of the specified
URL. Release with a call to
INKHandleStringRelease
.
INK_ERROR_PTR
if an error occurs.
Note | |
---|---|
The returned string is not guaranteed to be null-terminated. |
Sets the HTTP query portion of a specified URL.
INKReturnCode INKUrlHttpQuerySet (INKMBuffer
bufp
, INKMLoc
url_loc
, const char
*value
, int
length
)
Sets the HTTP query portion of the URL located at
within the
marshal buffer url_loc
to
the string bufp
. If
value
is -1, then
length
INKUrlHttpQuerySet
assumes that value is
null-terminated. Otherwise, the length of the string
is taken to be
value
.
length
INKUrlHttpQuerySet
copies the string to
within
, so it's
okay to modify or delete
bufp
after calling
value
INKUrlHttpQuerySet
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Calculates the length of a URL's string representation.
int INKUrlLengthGet (INKMBuffer
bufp
, INKMLoc
url_loc
)
Calculates the length of URL located at
within the
marshal buffer url_loc
if
it was returned as a string. This length is the same as
the length returned by
bufp
INKUrlStringGet
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
Returns the calculated length.
INK_ERROR
if an error occurs.
Parses the specified URL.
int INKUrlParse (INKMBuffer
bufp
, INKMLoc
url_loc
, const char
**start
, const char
*end
)
Parses a URL. The
pointer is both
an input and an output parameter, and marks the start of the
URL to be parsed. After a successful parse, the
start
pointer equals
the start
pointer. The
end
pointer must be
one byte after the last character you want to parse.The URL
parsing routine assumes that everything between
end
and
start
is part of the
URL. It is up to higher-level parsing routines, such as
end
INKHttpHdrParseReq
, to determine the
actual end of the URL.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
Returns INK_PARSE_DONE
if
successful.
Returns INK_PARSE_ERROR
if an error occurs.
Gets the password portion of a specified URL.
const char* INKUrlPasswordGet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
*length
)
Retrieves the password portion of the URL located at
within the
marshal buffer url_loc
.
bufp
INKUrlPasswordGet
places the length of
the returned string in the
argument.length
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A pointer to the password portion of the specified URL.
Release with a call to
INKHandleStringRelease
.
INK_ERROR_PTR
if an error occurs.
Note | |
---|---|
The returned string is not guaranteed to be null-terminated. |
Sets the password portion of a specified URL.
INKReturnCode INKUrlPasswordSet (INKMBuffer
bufp
, INKMLoc
url_loc
, const char
*value
, int
length
)
Sets the password portion of the URL located at
within the
marshal buffer url_loc
to
the string bufp
. If
value
is -1, then
length
INKUrlPasswordSet
assumes that value is
null-terminated. Otherwise, the length of the string
is taken to be
value
.
length
INKUrlPasswordSet
copies the string to
within
, so it is
okay to modify or delete
bufp
after calling
value
INKUrlPasswordSet
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Gets the path portion of a specified URL.
const char* INKUrlPathGet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
*length
)
Retrieves the path portion of the URL located at
within the
marshal buffer url_loc
.
bufp
INKUrlPathGet
places the length of the
returned string in the
argument.length
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A pointer to the path portion of the specified URL.
Release with a call to
INKHandleStringRelease
.
INK_ERROR_PTR
if an error occurs.
Note | |
---|---|
The returned string is not guaranteed to be null-terminated. If the URL contains a query portion, then it is not included in the response (see INKUrlHttpQueryGet). |
Sets the path portion of a specified URL.
INKReturnCode INKUrlPathSet (INKMBuffer
bufp
, INKMLoc
url_loc
, const char
*value
, int
length
)
Sets the path portion of the URL located at
within the
marshal buffer url_loc
to
the string bufp
. If
value
is -1, then
length
INKUrlPathSet
assumes that value is
null-terminated. Otherwise, the length of the string
is taken to be
value
.
length
INKUrlPathSet
copies the string to within
, so it is okay to
modify or delete bufp
after calling value
INKUrlPathSet
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Gets the port number portion of a specified URL.
int INKUrlPortGet (INKMBuffer
bufp
, INKMLoc
url_loc
)
Retrieves the port number portion of the URL located at
within the
marshal buffer
url_loc
.bufp
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
The port number portion of the specified URL.
INK_ERROR
if an error occurs.
Sets the port number portion of a URL to a specified value.
INKReturnCode INKUrlPortSet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
port
)
Sets the port number portion of the URL located at
within the
marshal buffer url_loc
to
the value bufp
. port
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Gets the scheme portion of a specified URL.
const char* INKUrlSchemeGet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
*length
)
Retrieves the scheme portion of the URL located at
within the
marshal buffer url_loc
.
bufp
INKUrlSchemeGet
places the length of the
returned string in the
argument.length
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A pointer to the scheme portion of the specified URL.
Release with a call to
INKHandleStringRelease
.
INK_ERROR_PTR
if an error occurs.
Note | |
---|---|
The returned string is not guaranteed to be null-terminated. |
Sets the scheme portion of a specified URL.
INKReturnCode INKUrlSchemeSet (INKMBuffer
bufp
, INKMLoc
url_loc
, const char
*value
, int
length
)
Sets the scheme portion of the URL located at
within the
marshal buffer url_loc
to
the string bufp
. If
value
is -1, then
length
INKUrlSchemeSet
assumes that value is
null-terminated. Otherwise, the length of the string
is taken to be
value
.
length
INKUrlSchemeSet
copies the string to
within
, so it's
okay to modify or delete
bufp
after calling
value
INKUrlSchemeSet
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.
Constructs a string representation of the URL located at
within the marshal
buffer url_loc
.bufp
char* INKUrlStringGet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
*length
)
Constructs a string representation of the URL located at
within the
marshal buffer url_loc
.
bufp
INKUrlStringGet
stores the length of the
allocated string in the parameter
(this is the
same length
length
that INKUrlLengthGet
returns).
The returned string is allocated by a call to
INKmalloc
; it should be freed by a call
to INKfree
. If
is
length
NULL
, then no attempt is made to dereference
it.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A null-terminated string.
INK_ERROR_PTR
if there is an error.
Gets the user portion of a specified URL.
const char* INKUrlUserGet (INKMBuffer
bufp
, INKMLoc
url_loc
, int
*length
)
Retrieves the user portion of the URL located at
within the
marshal buffer url_loc
.
bufp
INKUrlUserGet
places the length of the
returned string in the
argument.length
If in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
A pointer to the user portion of the specified URL.
Release with a call to
INKHandleStringRelease
.
INK_ERROR_PTR
if an error occurs.
Note | |
---|---|
The returned string is not guaranteed to be null-terminated. |
Sets the user portion of a specified URL.
INKReturnCode INKUrlUserSet (INKMBuffer
bufp
, INKMLoc
url_loc
, const char
*value
, int
length
)
Sets the user portion of the URL located at
within the
marshal buffer url_loc
to
the string bufp
. If
value
is -1, then
length
INKUrlUserSet
assumes that value is
null-terminated. Otherwise, the length of the string
is taken to be
value
. length
INKUrlUserSet
copies the string
to within
, so it
is okay to modify or delete
bufp
after calling
value
INKUrlUserSet
.
If it is in a transaction header, then call after READ_REQUEST_HDR_HOOK
.
INK_SUCCESS
if successful.
INK_ERROR
if an error occurs.