Important: URL Access Manager is deprecated as of Mac OS X v10.4. You should use CFNetwork instead (as described in CFNetwork Programming Guide).
| Framework | Carbon/Carbon.h |
| Declared in | URLAccess.h |
Important: URL Access Manager is deprecated as of Mac OS X v10.4. You should use CFNetwork instead (as described in CFNetwork Programming Guide).
CFNetwork provides better reliability and performance and is used by Apple’s own applications. URL Access Manager is no longer being enhanced or improved.
The URL Access Manager is an API that you can use to perform data transfer to and from a URL from within your application. It includes support for automatic decompression of compressed files and for automatic file extraction from Stuffit archives (with version 5.0 of Stuffit).
The URL Access Manager allows you to use any of the following protocols during download operations: File Transfer Protocol (FTP), Hypertext Transfer Protocol (HTTP), secure Hypertext Transfer Protocol (HTTPS), or a URL representing a local file (begins with file://). You might use the latter to test your application on a computer that does not have access to an HTTP or FTP server. For upload operations, you must use an FTP URL.
This document describes the URL Access Manager API through version 2.0.3.
URLGetURLAccessVersion Deprecated in Mac OS X v10.4
URLDisposeReference Deprecated in Mac OS X v10.4
URLNewReference Deprecated in Mac OS X v10.4
URLGetProperty Deprecated in Mac OS X v10.4
URLGetPropertySize Deprecated in Mac OS X v10.4
URLSetProperty Deprecated in Mac OS X v10.4
URLDownload Deprecated in Mac OS X v10.4
URLSimpleDownload Deprecated in Mac OS X v10.4
URLSimpleUpload Deprecated in Mac OS X v10.4
URLUpload Deprecated in Mac OS X v10.4
URLGetBuffer Deprecated in Mac OS X v10.4
URLGetDataAvailable Deprecated in Mac OS X v10.4
URLOpen Deprecated in Mac OS X v10.4
URLReleaseBuffer Deprecated in Mac OS X v10.4
URLAbort Deprecated in Mac OS X v10.4
URLGetCurrentState Deprecated in Mac OS X v10.4
URLGetError Deprecated in Mac OS X v10.4
URLGetFileInfo Deprecated in Mac OS X v10.4
URLIdle Deprecated in Mac OS X v10.4
DisposeURLNotifyUPP Deprecated in Mac OS X v10.4
DisposeURLSystemEventUPP Deprecated in Mac OS X v10.4
InvokeURLNotifyUPP Deprecated in Mac OS X v10.4
InvokeURLSystemEventUPP Deprecated in Mac OS X v10.4
NewURLNotifyUPP Deprecated in Mac OS X v10.4
NewURLSystemEventUPP Deprecated in Mac OS X v10.4
Defines a pointer to your notification callback function that handles certain data transfer events that occur during data transfer operations.
typedef OSStatus (*URLNotifyProcPtr) ( void * userContext, URLEvent event, URLCallbackInfo * callbackInfo );
If you name your function MyURLNotifyProc,
you would declare it like this:
OSStatus MyURLNotifyProc ( void * userContext, URLEvent event, URLCallbackInfo * callbackInfo );
A pointer to application-defined storage that
your application previously passed to the function URLOpen. Your application can use this
to set up its context when your notification callback function is
called.
The data transfer event that your application
wishes to be notified of. See “Data Transfer Event Constants” for
a description of possible values. The type of event that can trigger
your callback depends on the event mask you passed in the eventRegister parameter
of the function URLOpen,
and whether you pass a valid file specification in the fileSpec parameter
of URLOpen. For more information,
see the discussion.
A pointer to a structure of type URLCallbackInfo. On
return, the structure contains information about the data transfer
event that occurred. The URL Access Manager passes this information
to your callback function via the callbackInfo parameter
of the function InvokeURLNotifyUPP.
A result
code. See “URL Access Manager Result Codes.” Your notification
callback function should process the data transfer event and return noErr.
Your notification callback function handles certain data transfer
events that occur during data transfer operations performed by the
function URLOpen. You can define
an event notification function and the events for which you want
to receive notification only if you do not specify a file in which
to store the data for download operations. In order to be notified
of these events, you must pass a UPP to your notification callback
function in the notifyProc parameter.
You indicate the type of data transfer events you want to receive via
a bitmask in the eventRegister parameter.
Note that if you pass a valid file specification to URLOpen, your callback
function will not be notified of data available and transaction
completed events as identified by the constants kURLDataAvailableEvent and kURLTransactionCompleteEvent.
If you pass a valid file specification to URLOpen, your callback function notified
if any of the following events occur: kURLPercentEvent, kURLPeriodicEvent, kURLPropertyChangedEvent, kURLSystemEvent, kURLInitiatedEvent, kURLResourceFoundEvent, kURLDownloadingEvent, kURLUploadingEvent, kURLAbortInitiatedEvent, kURLCompletedEvent,
and kURLErrorOccurredEvent.
When your callback is called, it should process the event
immediately and return 0. You may wish your callback function to
update its user interface, allocate and deallocate memory, or call
the Thread Manager function NewThread.
Do not call the function URLDisposeReference from
your notification callback function. Doing so may cause your application
to stop working.
URLAccess.hDefines a pointer to your system event notification callback that handles update events that occur while a dialog box is displayed during a data transfer operation.
typedef OSStatus (*URLSystemEventProcPtr) ( void * userContext, EventRecord * event );
If you name your function MyURLSystemEventProc,
you would declare it like this:
OSStatus MyURLSystemEventProc ( void * userContext, EventRecord * event );
A pointer to application-defined storage that
your application previously passed to the function URLSimpleDownload, URLDownload, URLSimpleUpload, or URLUpload. Your application can use
this value to set up its context when the system event callback
function is called.
A pointer to an event record containing information about the system event that occurred during the data transfer operation.
A result
code. See “URL Access Manager Result Codes.” Your system event
callback function should process the system event and return noErr.
You pass a pointer to your callback function in the eventProc parameter
of the function URLSimpleDownload, URLSimpleUpload, URLDownload, or URLUpload if you want
update events to be passed to your application while a dialog box
is displayed by these functions. (In Mac OS X, this is not necessary,
since all dialog boxes are moveable). In order for these functions
to display a dialog box, you must set the mask constant kURLDisplayProgressFlag or kURLDisplayAuthFlag in
the bitmask passed in the openFlags parameter.
Call the function NewURLSystemEventUPP to
create a UPP to your system event notification callback. If you
do not write your own system event notification callback, these
functions will display a nonmovable modal dialog box.
When your callback is called, it should process the event
immediately and return 0. You may wish your callback function to
update its user interface, allocate and deallocate memory, or call
the Thread Manager function NewThread.
Do not call the function URLDisposeReference from
your callback function. Doing so may cause your application to stop
working.
URLAccess.hContains information about a data transfer event.
struct URLCallbackInfo {
UInt32 version;
URLReference urlRef;
const char * property;
UInt32 currentSize;
EventRecord * systemEvent;
};
typedef struct URLCallbackInfo URLCallbackInfo;
versionThe version of this structure. This value is currently 0.
urlRefA reference to the URL associated with the data transfer event.
propertyA pointer to a C string representing the name of the URL property that has changed, if relevant. This field is only valid if a property change event occurs as identified by the event constant kURLPropertyChangedEvent, described in “Data Transfer Event Constants.” or a description of name constants and data types of the corresponding property values, see “Universal URL Property Name Constants” and “HTTP and HTTPS URL Property Name Constants.” You should specify this field if the event involves a change in a property value.
currentSizeThe current total size (in bytes) of the data that has been downloaded and processed by the client.
systemEventA pointer to an event record containing information about the system event that occurred, if relevant. If the event is not a system event, as identified by the event constant kURLSystemEvent, described in “Data Transfer Event Constants,” this field is not valid.
The URLCallbackInfo type represents a structure that contains information about the data transfer event that you want notification of. The URL Access Manager passes a pointer to this structure in the callbackInfo parameter of your notification callback function. For information on how to write a notification callback function, see URLNotifyProcPtr.
URLAccess.h
typedef URLNotifyProcPtr URLNotifyUPP;
For more information, see the description of the callback function URLNotifyProcPtr.
URLAccess.h
Represents a reference to a URL.
typedef struct OpaqueURLReference * URLReference;
The URLReference type represents a reference to an opaque structure that identifies a URL. You should call the function URLNewReference to create a URL reference. The function URLDisposeReference disposes of a URL reference when no longer needed. You pass a reference of this type to URL Access Manager functions that operate on a URL in some way.
URLAccess.h
typedef URLSystemEventProcPtr URLSystemEventUPP;
For more information, see the description of the callback function URLSystemEventProcPtr.
URLAccess.hRepresents the default value of the property value identified
by the property name constant kURLAuthType.
enum {
kUserNameAndPasswordFlag = 0x00000001
};
kUserNameAndPasswordFlagRepresents the default value of the property
value identified by the property name constant kURLAuthType,
described in “Universal URL Property Name Constants.” This value indicates
that both the user name and password are used for authentication.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
This constant represents the default value of the authentication
type property value. The authentication type property value is identified
by the property name constant kURLAuthType,
described in “Universal URL Property Name Constants.” If you do not set the kURLAuthType property,
the default value will be used for the authentication type. In this
case, both the user name and password are used for authentication
purposes.
Identify data transfer events that occur during a data transfer operation.
typedef UInt32 URLEvent;
enum {
kURLInitiatedEvent = kURLInitiatingState,
kURLResourceFoundEvent = kURLResourceFoundState,
kURLDownloadingEvent = kURLDownloadingState,
kURLAbortInitiatedEvent = kURLAbortingState,
kURLCompletedEvent = kURLCompletedState,
kURLErrorOccurredEvent = kURLErrorOccurredState,
kURLDataAvailableEvent = kURLDataAvailableState,
kURLTransactionCompleteEvent = kURLTransactionCompleteState,
kURLUploadingEvent = kURLUploadingState,
kURLSystemEvent = 29,
kURLPercentEvent = 30,
kURLPeriodicEvent = 31,
kURLPropertyChangedEvent = 32
};
kURLInitiatedEventIndicates the function URLOpen has been called but the location
specified by the URL reference has not yet been accessed.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLResourceFoundEventIndicates that the location specified by the URL reference has been accessed and is valid.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDownloadingEventIndicates that a download operation is in progress.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLAbortInitiatedEventIndicates that a data transfer operation has
been aborted. When your application calls the function URLAbort, the URL Access
Manager changes the state returned by the function URLGetCurrentState to kURLAbortingState and
passes the constant kURLAbortInitiatedEvent to your
notification callback function. When data transfer is terminated,
the URL Access Manager changes the state returned by URLGetCurrentState to kURLCompletedState and
passes the constant kURLCompletedEvent in
the event parameter of
your notification callback function.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLCompletedEventIndicates that all operations associated with
a call to URLOpen have been completed.
This includes the successful completion of a download or upload
operation or the completion of cleanup work after aborting a download
or upload operation. For example, when a data transfer operation
is aborted, the URL Access Manager changes the state returned by
the function URLGetCurrentState to kURLCompletedState and
passes the constant kURLCompletedEvent in
the event parameter of
your notification callback function.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLErrorOccurredEventIndicates that an error occurred during data
transfer. If you receive this event, you may wish to call the function URLGetError to determine
the nature of the error.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDataAvailableEventIndicates that data is available in buffers.
If you receive this event, you can call the function URLGetBuffer to obtain the next buffer
of data. You may wish to call the function URLGetDataAvailable to determine the
amount of data available for retrieval in a download operation.
Note that if you pass a valid file specification in the fileSpec parameter
of URLOpen, your notification
callback function will not be called for data available events.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLTransactionCompleteEventIndicates that a download operation is complete
because there is no more data to retrieve from buffers. Note that
if you pass a valid file specification in the fileSpec parameter
of URLOpen, your notification
callback function will not be called for transaction completed events.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLUploadingEventIndicates that an upload operation is in progress.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLSystemEventIndicates that a system event has occurred.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLPercentEventIndicates that the size of the data being downloaded is known. In this case, an increment of one percent of the data was transferred into buffers.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLPeriodicEventIndicates that a time interval of approximately one quarter of a second has passed.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLPropertyChangedEventIndicates that a property such as a filename
has become known or changed. In this case, the name of the changed
property will be passed to your notification function via the property field
of the callbackInfo structure.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
The URLEvent enumeration
defines constants that identify data transfer events that occur during
a data transfer operation performed by URLOpen. In order to be notified of
these events, you must pass a UPP to your data transfer notification
callback in the notifyProc parameter.
You indicate the type of data transfer events you want to receive
via a bitmask in the eventRegister parameter.
For a description of this bitmask, see “Data Transfer Event Mask Constants.”
Represent a mask that identifies the data transfer events occurring during a data transfer operation that your application wants notification of.
typedef unsigned long URLEventMask;
enum {
kURLInitiatedEventMask = 1 << (kURLInitiatedEvent - 1),
kURLResourceFoundEventMask = 1 << (kURLResourceFoundEvent
- 1),
kURLDownloadingMask = 1 << (kURLDownloadingEvent - 1),
kURLUploadingMask = 1 << (kURLUploadingEvent - 1),
kURLAbortInitiatedMask = 1 << (kURLAbortInitiatedEvent
- 1),
kURLCompletedEventMask = 1 << (kURLCompletedEvent - 1),
kURLErrorOccurredEventMask = 1 << (kURLErrorOccurredEvent
- 1),
kURLDataAvailableEventMask = 1 << (kURLDataAvailableEvent
- 1),
kURLTransactionCompleteEventMask = 1 << (kURLTransactionCompleteEvent
- 1),
kURLSystemEventMask = 1 << (kURLSystemEvent - 1),
kURLPercentEventMask = 1 << (kURLPercentEvent - 1),
kURLPeriodicEventMask = 1 << (kURLPeriodicEvent - 1),
kURLPropertyChangedEventMask = 1 << (kURLPropertyChangedEvent
- 1),
kURLAllBufferEventsMask = kURLDataAvailableEventMask + kURLTransactionCompleteEventMask,
kURLAllNonBufferEventsMask = kURLInitiatedEventMask + kURLDownloadingMask
+ kURLUploadingMask + kURLAbortInitiatedMask + kURLCompletedEventMask
+ kURLErrorOccurredEventMask + kURLPercentEventMask + kURLPeriodicEventMask
+ kURLPropertyChangedEventMask,
kURLAllEventsMask = 0xFFFFFFFF
};
kURLInitiatedEventMaskIf the bit specified by this mask is set, your
notification callback function will be notified when the function URLOpen has been called
but the location specified by the URL reference has not yet been
accessed.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLResourceFoundEventMaskIf the bit specified by this mask is set, your notification callback function will be notified when the location specified by a URL reference has been accessed and is valid.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDownloadingMaskIf the bit specified by this mask is set, your notification callback function will be notified when a download operation is in progress.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLUploadingMaskIf the bit specified by this mask is set, your notification callback function will be notified when an upload operation is in progress.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLAbortInitiatedMaskIf the bit specified by this mask is set, your
notification callback function will be notified when a download
or upload operation has been aborted. When your application calls
the function URLAbort,
the URL Access Manager changes the state returned by the function URLGetCurrentState to kURLAbortingState and
passes the constant kURLAbortInitiatedEvent to your
notification callback function. When data transfer is terminated,
the URL Access Manager changes the state returned by URLGetCurrentState to kURLCompletedState and
passes the constant kURLCompletedEvent in
the event parameter of
your notification callback function.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLCompletedEventMaskIf the bit specified by this mask is set, your
notification callback function will be notified when all operations
associated with a call to the function URLOpen have been completed. This indicates
either the successful completion of an operation or the completion
of cleanup work after aborting the operation. For example, when
a data transfer operation is aborted, the URL Access Manager changes
the state returned by the function URLGetCurrentState to kURLCompletedState and
passes the constant kURLCompletedEvent in
the event parameter of
your notification callback function.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLErrorOccurredEventMaskIf the bit specified by this mask is set, your
notification callback function will be notified when an error has
occurred. If you receive this event, you may wish to call the function URLGetError to determine
the nature of the error.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDataAvailableEventMaskIf the bit specified by this mask is set, your
notification callback function will be notified when data is available
in buffers. If you receive this event, you may wish to call the
function URLGetDataAvailable to
determine the amount of data available for retrieval in a download
operation. Note that if you pass a valid file specification in the fileSpec parameter
of the function URLOpen,
your notification callback function will not be called for data available
events.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLTransactionCompleteEventMaskIf the bit specified by this mask is set, your
notification callback function will be notified when the operation
is complete because there is no more data to retrieve from buffers.
Note that if you pass a valid file specification in the fileSpec parameter
of the function URLOpen,
your notification callback function will not be called for transaction
completed events.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLSystemEventMaskAvailable in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLPercentEventMaskIf the bit specified by this mask is set, your notification callback function will be notified when an increment of one percent of the data has been transferred into buffers. This occurs only when the size of the data being transferred is known. This information is useful if you want the URL Access Manager to display a progress indicator.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLPeriodicEventMaskIf the bit specified by this mask is set, your notification callback function will be notified when a time interval of approximately one quarter of a second has passed. You can use this event to report the progress of the download operation when the size of the data is unknown or for other processing that you wish to perform at regular intervals.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLPropertyChangedEventMaskIf the bit specified by this mask is set, your notification callback function will be notified when the value of a URL property, such as a filename or user name, has become known or changes.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLAllBufferEventsMaskIf the bit specified by this mask is set, your
notification callback function will be notified when a buffer-related
event indicated by the event constants kURLDataAvailableEvent or kURLTransactionCompleteEvent occurred.
If you pass a file specification in the fileSpec parameter
of the function URLOpen,
your notification callback function will not be called for buffer-related
events.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLAllNonBufferEventsMaskIf the bit specified by this mask is set, your
notification callback function will be notified when an event unrelated
to a buffer occurred. This includes all events except those represented
by the constants kURLDataAvailableEvent and kURLTransactionCompleteEvent.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLAllEventsMaskIf the bit specified by this mask is set, your
notification callback function will be notified when any of the
above data transfer events occur. If you pass a file specification
in the fileSpec parameter
of the function URLOpen,
your notification callback function will not be called for buffer-related
events.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
The URLEventMask enumeration
defines masks that identify the data transfer events occurring during
a call to the function URLOpen that
your application wants notification of. For a description of data
transfer events, see “Data Transfer Event Constants.” You can define an event
notification function and the events for which you want to receive notification
only if you do not specify a file in which to store the data for
downloads. You can indicate which events you want to receive notification
of via a bitmask in the eventRegister parameter
of URLOpen.
Represent a mask that identifies the data transfer options to use when uploading or downloading data.
typedef UInt32 URLOpenFlags;
enum {
kURLReplaceExistingFlag = 1 << 0,
kURLBinHexFileFlag = 1 << 1,
kURLExpandFileFlag = 1 << 2,
kURLDisplayProgressFlag = 1 << 3,
kURLDisplayAuthFlag = 1 << 4,
kURLUploadFlag = 1 << 5,
kURLIsDirectoryHintFlag = 1 << 6,
kURLDoNotTryAnonymousFlag = 1 << 7,
kURLDirectoryListingFlag = 1 << 8,
kURLExpandAndVerifyFlag = 1 << 9,
kURLNoAutoRedirectFlag = 1 << 10,
kURLDebinhexOnlyFlag = 1 << 11,
kURLDoNotDeleteOnErrorFlag = 1 << 12,
kURLResumeDownloadFlag = 1 << 13,
kURLReservedFlag = (unsigned long) 1 << 31
};
kURLReplaceExistingFlagIf the bit specified by this mask is set and
the destination file or directory exists, the file or directory
contents are replaced by the newly downloaded or uploaded data.
If this bit is not set and the name of the file is specified and
does exist, the URL Access Manager returns the result code kURLDestinationExistsError.
If the name of the file or directory is not specified, the file
or directory already exists, and the bit specified by this mask
is not set, a number is appended to the name before any extension until
a unique name is created, and the data is transferred to the new
file or directory name without notifying the calling application
that the name has changed. In the case of a download operation,
your application can check the destination parameter
of the functions URLSimpleDownload and URLDownload to obtain
the new filename.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLBinHexFileFlagIf the bit specified by this mask is set, the
URL Access Manager converts a nontext file that has a resource fork
to BinHex format before
uploading it.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLExpandFileFlagIf the bit specified by this mask is set, files
in BinHex format are
decoded. If version 5.0 of the Stuffit Engine is installed in the
System Folder, the URL Access Manager uses it to expand the file.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDisplayProgressFlagIf the bit specified by this mask is set, the
URL Access Manager displays a nonmovable modal progress indicator
during data transfer operations only if you have not provided a
system event notification callback. On Mac OS X, dialog boxes will
always be moveable. To handle data transfer events that occur while
a progress indicator is being displayed, pass a UPP to your data
transfer event notification callback in the eventProc parameter
of the functions URLSimpleDownload, URLDownload, URLSimpleUpload, and URLUpload.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDisplayAuthFlagIf the bit specified by this mask is set, the
URL Access Manager displays a nonmovable modal authentication dialog
box when user authentication is required only if you have not provided
a system event notification callback. On Mac OS X, dialog boxes
will always be moveable. To handle data transfer events that occur
while an authentication dialog box is being displayed, pass a UPP
to your data transfer event notification callback in the eventProc parameter
of the functions URLSimpleDownload, URLDownload, URLSimpleUpload, and URLUpload. If the bit
specified by this mask is clear, the user name and password properties
of the URL are used for authentication purposes. If these are not
set, the URL Access Manager returns the result code kURLAuthenticationError.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLUploadFlagIf the bit specified by this mask is set, the
function URLOpen will upload
the file or directory to the specified URL.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLIsDirectoryHintFlagIf the bit specified by this mask is set, download
operations assume that the URL points to a directory. Note that
if you pass a pathname that specifies a file in the url parameter
of the function URLSimpleDownload,
the file is downloaded regardless of whether you specify kURLDirectoryListingFlag or KURLIsDirectoryHintFlag in
the openFlags parameter.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDoNotTryAnonymousFlagIf the bits specified by this mask is set,
when FTP authentication occurs, the functions URLSimpleDownload, URLDownload, URLSimpleUpload, URLUpload, and URLOpen will not try to log on anonymously.
Instead, they will rely on the setting of the mask constant kURLDisplayAuthFlag.
If the bit specified by the kURLDoNotTryAnonymousFlag mask
is not set, these functions will first attempt to log on anonymously.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDirectoryListingFlagIf the bit specified by this mask is set, a
listing of the directory, rather than the entire directory, is downloaded.
If the URL points to a file instead of a directory, the file is
downloaded. Note that if you pass a pathname that specifies a file
in the url parameter
of the function URLSimpleDownload, the
file is downloaded regardless of whether you specify kURLDirectoryListingFlag or KURLIsDirectoryHintFlag in
the openFlags parameter.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLExpandAndVerifyFlagIf this flag is available (that is, the File Signing shared library is available) and the bit specified by this mask is set, the signature attached to the file is verified. Success indicates that the file was signed by the certificate authority, but the certificate will not be displayed until after the file is downloaded.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLNoAutoRedirectFlagIf the bit specified by this mask is set, if an HTTP request returns a “redirect” status (300, 301, or 302), the transfer will complete without attempting to redirect to the next URL. Otherwise, redirects are followed until actual data is encountered or an error is returned.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDebinhexOnlyFlagIf the bit specified by this mask is set, the
internal engine is used to decode files, rather than the external
Stuffit Engine, even if Stuffit is installed. This prevents the
display of the Stuffit progress user interface. If you set this
bit, you must also set the kURLExpandFileFlag mask.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDoNotDeleteOnErrorFlagDo not delete the downloaded file if an error or abort occurs. This flag applies to downloading only and should be used if interested in later resuming the download.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLResumeDownloadFlagThe passed in file is partially downloaded,
attempt to resume it. Currently works for HTTP only. If no FSSpec passed
in, this flag will be ignored. Overridden by kURLReplaceExistingFlag.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLReservedFlagReserved for internal use.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
The URLOpenFlags enumeration
defines masks you can use to identify the data transfer options
you want used when performing data transfer operations. You pass
this mask in the openFlags parameter
of the functions URLSimpleDownload, URLDownload, URLSimpleUpload, URLUpload, and URLOpen. The options
that you can specify for upload and download operations differ,
as do those that you can specify for the low-level function URLOpen. For a description
of the options you can specify in each case, see the appropriate function
discussions.
Identifies the current state of a data transfer operation.
typedef UInt32 URLState;
enum {
kURLNullState = 0,
kURLInitiatingState = 1,
kURLLookingUpHostState = 2,
kURLConnectingState = 3,
kURLResourceFoundState = 4,
kURLDownloadingState = 5,
kURLDataAvailableState = 0x10 + kURLDownloadingState,
kURLTransactionCompleteState = 6,
kURLErrorOccurredState = 7,
kURLAbortingState = 8,
kURLCompletedState = 9,
kURLUploadingState = 10
};
kURLNullStateIndicates that the function URLOpen has not yet been called.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLInitiatingStateIndicates that the function URLOpen has been called, but the location specified
by the URL reference has not yet been accessed. The stream enters this
state from the kURLNullState state.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLLookingUpHostStateIndicates that the function URLOpen has been called, and that the
host is being looked up. The stream enters this state from the kURLInitiatingState state.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLConnectingStateIndicates that the function URLOpen has been called, and a connection
is being made. The stream enters this state from the kURLLookingUpHostState state.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLResourceFoundStateIndicates that the location specified by the
URL reference has been accessed and is valid. The stream enters
this state from the kURLConnectingState state.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDownloadingStateIndicates that the download operation is in
progress but there is currently no data in the buffers. The stream
enters this state initially from the kURLResourceFoundState state.
During a download operation, the stream’s state may alternate
between the kURLDownloadingState and
the kURLDataAvailableState states.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLDataAvailableStateIndicates that the download operation is in
progress and data is available in the buffers. The stream initially
enters this state from the kURLDownloadingState state.
During a download operation, the stream’s state may alternate
between the kURLDownloadingState and
the kURLDataAvailableState states.
If the stream is in the data available state, you may want to call
the function URLGetDataAvailable to
determine the amount of data available for download. If you pass NULL in
the fileSpec parameter
of the function URLOpen,
you will need to call the function URLGetBuffer to obtain the next buffer
of data.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLTransactionCompleteStateIndicates that a download or upload operation
is complete. The stream can enter this state from the kURLDownloadingState state.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLErrorOccurredStateIndicates that an error occurred during data
transfer. The stream can enter this state from any state except
the kURLAbortingState state.
If the stream is in this state, you may wish to call the function URLGetError to determine the
nature of the error.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLAbortingStateIndicates that a download or upload operation
is aborting. The stream enters this state from the kURLErrorOccurredState state
or as a result of calling the function URLOpen when the stream is in any other
state. When your application calls the function URLAbort, the URL Access Manager changes
the state returned by the function URLGetCurrentState to kURLAbortingState and
passes the constant kURLAbortInitiatedEvent to your
notification callback function.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLCompletedStateIndicates that there is no more activity to
be performed on this stream. In this case, the data transfer has
either completed successfully or been aborted. The stream enters
this state from the kURLTransactionCompleteState or
the kURLAbortingState state.
When data transfer is terminated after a data transfer operation
is aborted, the URL Access Manager changes the state returned by URLGetCurrentState to kURLCompletedState and
passes the constant kURLCompletedEvent in
the event parameter of
your notification callback function.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLUploadingStateIndicates that an upload operation is in progress.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
The URLState enumeration
defines constants that identify the status of a data transfer operation
with respect to a URL. The function URLGetCurrentState passes back one of these
constants in the state parameter
to indicate the status of a data transfer operation. All constants
except kURLDataAvailableState and kURLCompletedState can
be returned at any time. If you pass a valid file specification
in the fileSpec parameter
of the function URLOpen,
your notification callback function will not be notified of data
available and transaction completed states as identified by the
constants kURLDataAvailableState and kURLTransactionCompleteState.
Identify property values specific to HTTP and HTTPS URLs.
#define kURLHTTPRequestMethod "URLHTTPRequestMethod" #define kURLHTTPRequestHeader "URLHTTPRequestHeader" #define kURLHTTPRequestBody "URLHTTPRequestBody" #define kURLHTTPRespHeader "URLHTTPRespHeader" #define kURLHTTPUserAgent "URLHTTPUserAgent" #define kURLHTTPRedirectedURL "URLHTTPRedirectedURL" #define kURLSSLCipherSuite "URLSSLCipherSuite"
kURLHTTPRequestMethodIdentifies the HTTP request method property value. You use this name constant to set or obtain a C string that represents the HTTP method to be used in the request. If you are posting a form, you must set this property to the string "POST".
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLHTTPRequestHeaderIdentifies the HTTP request header property
value. You use this name constant to set or obtain a C string that
represents the HTTP header to be used in the request. You may set
this property to contain all headers needed for the request. If
you are posting a form and have set the properties identified by
the name constants kURLHTTPRequestMethod and kURLHTTPRequestBody,
you do not need to set the property identified by this tag.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLHTTPRequestBodyIdentifies the HTTP request body property
value. You use this name constant to set or obtain a buffer of data
that represents the HTTP body to be provided in the request. If
you set the property identified by this tag but not that identified
by the name constant kURLHTTPHeader,
a body-length header is automatically added to the request. If you
are posting a form, you must set this property to the form data
you want sent.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLHTTPRespHeaderIdentifies the HTTP response header property value. You use this name constant to obtain a C string that represents the HTTP response header that was received.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLHTTPUserAgentIdentifies the user agent property value. You use this name constant to set or obtain a C string that represents the HTTP user agent string that is embedded in HTTP requests. By default, the URL Access Manager sets the user agent string to "URL Access 1.0 (Macintosh; PPC)".
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLHTTPRedirectedURLIdentifies the redirected URL property value. You use this name constant to obtain a C string that represents the URL that you were redirected to.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLSSLCipherSuiteIdentifies the SSL cipher suite property value.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
These constants represent Apple-defined name constants that
identify property values specific to HTTP and HTTPS URLs. For a
description of the name constants that identify property values
universal to all URLs, see Universal URL Property Name Constants.
You pass one of these name constants in the property parameter
of the functions URLSetProperty and URLGetProperty, respectively,
to set or obtain a particular property value. Note that you can
only set HTTP and HTTPS property values identified by the constants kURLHTTPRequestMethod , kURLHTTPRequestHeader, kURLHTTPRequestBody,
and kURLHTTPUserAgent.
You must also pass the correct data type corresponding to the property
value in the propertyBuffer parameter
of these functions.
Prior to version 2.0.3 of the URL Access Manager, the data
type of the property value identified by the name constant kURLHTTPRequestBody was
a C string. In 2.0.3 and later, the data type is a buffer of data.
Identify property values universal to all URLs.
#define kURLURL "URLString" #define kURLResourceSize "URLResourceSize" #define kURLLastModifiedTime "URLLastModifiedTime" #define kURLMIMEType "URLMIMEType" #define kURLFileType "URLFileType" #define kURLFileCreator "URLFileCreator" #define kURLCharacterSet "URLCharacterSet" #define kURLResourceName "URLResourceName" #define kURLHost "URLHost" #define kURLAuthType "URLAuthType" #define kURLUserName "URLUserName" #define kURLPassword "URLPassword" #define kURLStatusString "URLStatusString" #define kURLIsSecure "URLIsSecure" #define kURLCertificate "URLCertificate" #define kURLTotalItems "URLTotalItems" #define kURLConnectTimeout "URLConnectTimeout"
kURLURLIdentifies the name string property value. You use this name constant to obtain a C string that represents the URL.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLResourceSizeIdentifies the resource size property value.
You use this name constant to obtain a value of type Size that
represents the total size of the data at the location specified
by the URL.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLLastModifiedTimeIdentifies the modification time property
value. You use this name constant to obtain a value of type UInt32 that
represents the last time the data was modified.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLMIMETypeIdentifies the MIME type property value. You use this name constant to obtain a Pascal string that represents the MIME type of the URL.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLFileTypeIdentifies the file type property value.
You use this name constant to set or obtain a value of type OSType that
represents the file type as specified in a call to the function URLOpen. If the file
type was not specified, kURLFileType obtains
the file type compatible with the MIME type.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLFileCreatorIdentifies the file creator property value.
You use this name constant to set or obtain a value of type OSType that
represents the file creator as specified in a call to the function URLOpen. If the file
creator was not specified, kURLFileType obtains
the file type compatible with the MIME type.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLCharacterSetIdentifies the character set property value. You use this name constant to obtain a Pascal string that represents the character set used by the URL, as returned by the HTTP server.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLResourceNameIdentifies the resource name property value. You use this name constant to obtain a Pascal string that represents the name associated with the data to be downloaded.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLHostIdentifies the host property value. You use this name constant to obtain a Pascal string that represents the host on which the data is located.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLAuthTypeIdentifies the authentication type property
value. You use this name constant to obtain a value that represents
the type of authentication that the download operation requires.
The default authentication type is kUserNameAndPasswordFlag,
described in Authentication Type Constant.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLUserNameIdentifies the user name property value. You use this name constant to set or obtain a Pascal string that represents the user name used for authentication.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLPasswordIdentifies the password property value. You use this name constant to set or obtain a Pascal string that represents the password used for authentication.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLStatusStringIdentifies the status property value. You use this name constant to obtain a Pascal string that represents the current status of the data stream. You can use this property to display the status of the data transfer operation.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLIsSecureIdentifies the security property value. You use this name constant to get a Boolean value that indicates whether the download operation is secure.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLCertificateIdentifies the certificate property value. You use this name constant to obtain a buffer of data that represents the certificate provided by a remote server.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLTotalItemsIdentifies the total items property value.
You use this name constant to obtain a value of type UInt32 that
represents the total number of items being uploaded or downloaded.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
kURLConnectTimeoutIdentifies the connection timeout property value.
Available in Mac OS X v10.0 and later.
Declared in URLAccess.h
These constants represent Apple-defined name constants that
identify property values universal to all URLs. For a description
of the name constants that identify property values specific to
HTTP and HTTPS URLs, see HTTP and HTTPS URL Property Name Constants.
You pass one of these name constants in the property parameter
of the functions URLSetProperty and URLGetProperty, respectively,
to set or obtain a particular property value. Note that you can
only set the universal property values identified by the constants kURLPassword and kURLUserName.
You must also pass the correct data type corresponding to the property
value in the propertyBuffer parameter
of these functions.
The most common result codes returned by URL Access Manager
are listed in the table below. The following result codes may also be returned; noErr (0), nsvErr (-35), fnfErr (-43), paramErr (-50),
and dirNFErr (-120).