## GskHttpHeader

GskHttpHeader — Base class for HTTP headers.

## Synopsis

                        GskHttpAuthorization;
                        GskHttpAuthenticate;
                        GskHttpCharSet;
                        GskHttpCookie;
                        GskHttpLanguageSet;
                        GskHttpMediaTypeSet;
                        GskHttpContentEncodingSet;
                        GskHttpTransferEncodingSet;
                        GskHttpRangeSet;
    enum                GskHttpStatus;
    enum                GskHttpVerb;
    enum                GskHttpRange;
    enum                GskHttpContentEncoding;
    enum                GskHttpTransferEncoding;
    enum                GskHttpConnection;
    GskHttpMediaTypeSet * gsk_http_media_type_set_new       (const char *type,
                                                             const char *subtype,
                                                             gfloat quality);
    void                gsk_http_media_type_set_free        (GskHttpMediaTypeSet *set);
    GskHttpCharSet *    gsk_http_char_set_new               (const char *charset_name,
                                                             gfloat quality);
    void                gsk_http_char_set_free              (GskHttpCharSet *char_set);
    GskHttpContentEncodingSet * gsk_http_content_encoding_set_new
                                                            (GskHttpContentEncoding encoding,
                                                             gfloat quality);
    void                gsk_http_content_encoding_set_free  (GskHttpContentEncodingSet *encoding_set);
    GskHttpTransferEncodingSet * gsk_http_transfer_encoding_set_new
                                                            (GskHttpTransferEncoding encoding,
                                                             gfloat quality);
    void                gsk_http_transfer_encoding_set_free (GskHttpTransferEncodingSet *encoding_set);
    GskHttpRangeSet *   gsk_http_range_set_new              (GskHttpRange range_type);
    void                gsk_http_range_set_free             (GskHttpRangeSet *set);
    GskHttpLanguageSet * gsk_http_language_set_new          (const char *language,
                                                             gfloat quality);
    void                gsk_http_language_set_free          (GskHttpLanguageSet *set);
    GskHttpAuthenticate * gsk_http_authenticate_new_basic   (const char *realm);
    GskHttpAuthenticate * gsk_http_authenticate_new_digest  (const char *realm,
                                                             const char *domain,
                                                             const char *nonce,
                                                             const char *opaque,
                                                             const char *algorithm);
    GskHttpAuthenticate * gsk_http_authenticate_new_unknown (const char *auth_scheme_name,
                                                             const char *realm,
                                                             const char *options);
    GskHttpAuthorization * gsk_http_authorization_new_basic (const char *user,
                                                             const char *password);
    GskHttpAuthorization * gsk_http_authorization_new_respond_post
                                                            (const GskHttpAuthenticate *,
                                                             const char *user,
                                                             const char *password,
                                                             guint post_data_len,
                                                             gconstpointer post_data,
                                                             GError **error);
    GskHttpAuthorization * gsk_http_authorization_new_unknown
                                                            (const char *auth_scheme_name,
                                                             const char *response);
    const char *        gsk_http_authorization_peek_response_digest
                                                            (GskHttpAuthorization *);
    GskHttpAuthorization * gsk_http_authorization_copy      (const GskHttpAuthorization *);
    GskHttpAuthorization * gsk_http_authorization_new_digest
                                                            (const char *realm,
                                                             const char *domain,
                                                             const char *nonce,
                                                             const char *opaque,
                                                             const char *algorithm,
                                                             const char *user,
                                                             const char *password,
                                                             const char *response_digest,
                                                             const char *entity_digest);
    GskHttpAuthorization * gsk_http_authorization_new_respond
                                                            (const GskHttpAuthenticate *,
                                                             const char *user,
                                                             const char *password,
                                                             GError **error);
    void                gsk_http_authorization_set_nonce    (GskHttpAuthorization *,
                                                             const char *nonce);
    GskHttpCookie *     gsk_http_cookie_new                 (const char *key,
                                                             const char *value,
                                                             const char *path,
                                                             const char *domain,
                                                             const char *expire_date,
                                                             const char *comment,
                                                             int max_age);
    GskHttpCookie *     gsk_http_cookie_copy                (const GskHttpCookie *orig);
    void                gsk_http_cookie_free                (GskHttpCookie *orig);
                        GskHttpHeaderClass;
                        GskHttpHeader;
    enum                GskHttpParseFlags;
    GskHttpConnection   gsk_http_header_get_connection      (GskHttpHeader *header);
    GskHttpHeader *     gsk_http_header_from_buffer         (GskBuffer *input,
                                                             gboolean is_request,
                                                             GskHttpParseFlags flags,
                                                             GError **error);
    void                gsk_http_header_to_buffer           (GskHttpHeader *header,
                                                             GskBuffer *output);
    void                gsk_http_header_set_content_encoding
                                                            (GskHttpHeader *header,
                                                             const char *encoding);
    #define             gsk_http_header_get_content_encoding(header)
    #define             gsk_http_header_set_date            (header, date)
    #define             gsk_http_header_get_date            (header)
    void                gsk_http_header_add_misc            (GskHttpHeader *header,
                                                             const char *key,
                                                             const char *value);
    const char *        gsk_http_header_lookup_misc         (GskHttpHeader *header,
                                                             const char *key);
    void                gsk_http_header_remove_misc         (GskHttpHeader *header,
                                                             const char *key);
                        GskHttpHeaderLineParser;
    gboolean            (*GskHttpHeaderLineParserFunc)      (GskHttpHeader *header,
                                                             const char *text,
                                                             gpointer data);
    GHashTable *        gsk_http_header_get_parser_table    (gboolean is_request);
    void                (*GskHttpHeaderPrintFunc)           (const char *text,
                                                             gpointer data);
    void                gsk_http_header_print               (GskHttpHeader *http_header,
                                                             GskHttpHeaderPrintFunc print_func,
                                                             gpointer print_data);
    #define             gsk_http_header_set_connection_type (header, connection_type)
    #define             gsk_http_header_get_connection_type (header)
    #define             gsk_http_header_set_transfer_encoding(header, enc)
    #define             gsk_http_header_get_transfer_encoding(header)
    #define             gsk_http_header_get_content_type    (header)
    #define             gsk_http_header_set_content_type    (header, content_type)
    #define             gsk_http_header_get_content_subtype (header)
    #define             gsk_http_header_set_content_subtype (header, content_type)
    #define             gsk_http_header_set_content_length  (header, len)
    #define             gsk_http_header_get_content_length  (header)
    #define             gsk_http_header_get_content_charset (header)
    void                gsk_http_header_add_accepted_range  (GskHttpHeader *header,
                                                             GskHttpRange range);
    void                gsk_http_header_add_pragma          (GskHttpHeader *header,
                                                             const char *pragma);
    #define             gsk_http_header_set_content_charset (header, content_type)
    #define             gsk_http_header_set_range           (header, start, end)
    #define             gsk_http_header_get_range_start     (header)
    #define             gsk_http_header_get_range_end       (header)
    void                gsk_http_header_set_string          (gpointer http_header,
                                                             char **p_str,
                                                             const char *str);
    void                gsk_http_header_set_string_val      (gpointer http_header,
                                                             char **p_str,
                                                             const GValue *value);
    char *              gsk_http_header_cut_string          (gpointer http_header,
                                                             const char *start,
                                                             const char *end);
    void                gsk_http_header_free_string         (gpointer http_header,
                                                             char *str);
    void                gsk_http_header_set_connection_string
                                                            (GskHttpHeader *header,
                                                             const char *str);
    void                gsk_http_header_set_content_encoding_string
                                                            (GskHttpHeader *header,
                                                             const char *str);
    void                gsk_http_header_set_transfer_encoding_string
                                                            (GskHttpHeader *header,
                                                             const char *str);
    void                gsk_http_header_set_version         (GskHttpHeader *header,
                                                             gint major,
                                                             gint minor);

## Object Hierarchy

      GObject
       +----GskHttpHeader
             +----GskHttpRequest
             +----GskHttpResponse

## Properties

      "connection"               GskHttpConnection     : Read / Write
      "connection-string"        gchar*                : Read / Write
      "content-charset"          gchar*                : Read / Write
      "content-encoding"         GskHttpContentEncoding  : Read / Write
      "content-encoding-string"  gchar*                : Read / Write
      "content-length"           gint                  : Read / Write
      "content-subtype"          gchar*                : Read / Write
      "content-type"             gchar*                : Read / Write
      "date"                     gint                  : Read / Write
      "major-version"            guint                 : Read / Write
      "minor-version"            guint                 : Read / Write
      "range-end"                gint                  : Read / Write
      "range-start"              gint                  : Read / Write
      "transfer-encoding"        GskHttpTransferEncoding  : Read / Write
      "transfer-encoding-string" gchar*                : Read / Write

## Description

The class provides methods and structure to parse and examime HTTP requests and responses.

## Details

### GskHttpAuthorization

    typedef struct {
      GskHttpAuthMode mode;
      char           *auth_scheme_name;
      union
      {
        struct {
          char                   *response;
        } unknown;
        struct {
          char                   *user;
          char                   *password;
        } basic;
        struct {
          char                   *realm;
          char                   *domain;
          char                   *nonce;
          char                   *opaque;
          char                   *algorithm;
          char                   *user;
          char                   *password;
          char                   *response_digest;
          char                   *entity_digest;
        } digest;
      } info;
    } GskHttpAuthorization;

A response to a Authenticate: challenge. This string may provide a cryptographic proof that the client-side has access to a secret key.

From RFC 2616, Section 14.8: If a request is authenticated and a realm specified, the same credentials SHOULD be valid for all other requests within this realm (assuming that the authentication scheme itself does not require otherwise, such as credentials that vary according to a challenge value or using synchronized clocks).

The details of authentification are in a sister RFC, namely RFC 2617, "HTTP Authentication: Basic and Digest Access Authentication", by J Franks, et al.

### GskHttpAuthenticate

    typedef struct {
      GskHttpAuthMode mode;
      char           *auth_scheme_name;
      char           *realm;
      union
      {
        struct {
          char                   *options;
        } unknown;
        /* no members:
        struct {
        } basic;
        */
        struct {
          char                   *domain;
          char                   *nonce;
          char                   *opaque;
          gboolean                is_stale;
          char                   *algorithm;
        } digest;
      } info;
    } GskHttpAuthenticate;

XXX: should be a list of possible authenification strategies.

The WWW-Authenticate response-header field MUST be included in 401 (Unauthorized) response messages. The field value consists of at least one challenge that indicates the authentication scheme(s) and parameters applicable to the Request-URI.

### GskHttpCharSet

    typedef struct {
      /*< public: read-only >*/
      char                 *charset_name;
      gfloat                quality;                /* -1 if not present */
    } GskHttpCharSet;

A character set, along with optional quality factor. The default quality is 1.0. See also `gsk_http_request_add_charsets()` and `gsk_http_response_set_charset()`. The HTTP standard does not concretely define the Character Set strings that are mentioned in RFC 2616, Section 3.4. But it recommends the documents RFC 2279 "UTF-8, a transformation format of Unicode and ISO-10646"; and RFC 2277 "IETF Policy on Character Sets and Languages".

...

char *`charset_name`; | the name of the character set, as recommended by IETF policy.
gfloat `quality`; | ranking of the character set, on a range from 0 to 1.

### GskHttpCookie

    typedef struct {
      /*< public: read-only >*/
      char                   *key;
      char                   *value;
      char                   *domain;
      char                   *path;
      char                   *expire_date;
      char                   *comment;
      int                     max_age;
      gboolean                secure;               /* default is FALSE */
      guint                   version;              /* default is 0, unspecified */
    } GskHttpCookie;

See RFC 2964 "Use of HTTP State Management" and RFC 2965 "HTTP State Management Mechanism".

### GskHttpLanguageSet

    typedef struct {
      /*< public: read-only >*/

      /* these give a language (with optional dialect specifier) */
      char                 *language;
      gfloat                quality;                /* -1 if not present */
    } GskHttpLanguageSet;

A list of natural languages that may be acceptable to the client. Examples: en, en-US, en-cockney, i-cherokee, x-pig-latin.

This is intended for human languages - computer languages are specifically prohibited.

Any two-letter primary tag ('en') must be an ISO-639 language abbreviation. Any two-letter subtag ('US') must be an ISO-3166 country abbreviation.

char *`language`; | the ASCII text of the language name.
gfloat `quality`; | quality from 0 to 1, or -1 for unspecified.

### GskHttpMediaTypeSet

    typedef struct {
      /*< public: read-only >*/
      char                 *type;
      char                 *subtype;
      gfloat                quality;                /* -1 if not present */
    } GskHttpMediaTypeSet;

A list of media types that the client can handle, and some quality factors to break ties.

char *`type`; | standard types like "image" or "text", or "x-"-prefixed types which are not well standardized. May be "*" to mean any major type.
char *`subtype`; | specific format of data: "html" or "jpeg". May be "*" to mean any subtype.
gfloat `quality`; | quality from 0 to 1, or -1 for unspecified.

### GskHttpContentEncodingSet

    typedef struct {
      /*< public: read-only >*/
      GskHttpContentEncoding       encoding;
      gfloat                       quality;       /* -1 if not present */
    } GskHttpContentEncodingSet;

A node in a list of content-encodings allowed by the server. Each element may have an associated quality. If the quality is -1, then it is implicit, but for comparison purposes it should be treated at +1.

GskHttpContentEncoding `encoding`; | the encoding being rated.
gfloat `quality`; | quality from 0 to 1, or -1 for unspecified.

### GskHttpTransferEncodingSet

    typedef struct {
      /*< public: read-only >*/
      GskHttpTransferEncoding      encoding;
      gfloat                       quality;       /* -1 if not present */
    } GskHttpTransferEncodingSet;

A node in a list of transfer-encodings allowed by the server. Each element may have an associated quality. If the quality is -1, then it is implicit, but for comparison purposes it should be treated at +1.

GskHttpTransferEncoding `encoding`; | the encoding being rated.
gfloat `quality`; | quality from 0 to 1, or -1 for unspecified.

### GskHttpRangeSet

    typedef struct {
      /*< public: read-only >*/
      GskHttpRange          range_type;
    } GskHttpRangeSet;

A node in a list of range-specifiers allowed by the server. Each element may have an associated quality. If the quality is -1, then it is implicit, but for comparison purposes it should be treated at +1.

This mechanism is rather pointless, as there is only one valid unit allowed, 'bytes'.

GskHttpRange `range_type`; | the units permitted for partial content requests.

### enum GskHttpStatus

    typedef enum
    {
      GSK_HTTP_STATUS_CONTINUE                      = 100,
      GSK_HTTP_STATUS_SWITCHING_PROTOCOLS           = 101,
      GSK_HTTP_STATUS_OK                            = 200,
      GSK_HTTP_STATUS_CREATED                       = 201,
      GSK_HTTP_STATUS_ACCEPTED                      = 202,
      GSK_HTTP_STATUS_NONAUTHORITATIVE_INFO         = 203,
      GSK_HTTP_STATUS_NO_CONTENT                    = 204,
      GSK_HTTP_STATUS_RESET_CONTENT                 = 205,
      GSK_HTTP_STATUS_PARTIAL_CONTENT               = 206,
      GSK_HTTP_STATUS_MULTIPLE_CHOICES              = 300,
      GSK_HTTP_STATUS_MOVED_PERMANENTLY             = 301,
      GSK_HTTP_STATUS_FOUND                         = 302,
      GSK_HTTP_STATUS_SEE_OTHER                     = 303,
      GSK_HTTP_STATUS_NOT_MODIFIED                  = 304,
      GSK_HTTP_STATUS_USE_PROXY                     = 305,
      GSK_HTTP_STATUS_TEMPORARY_REDIRECT            = 306,
      GSK_HTTP_STATUS_BAD_REQUEST                   = 400,
      GSK_HTTP_STATUS_UNAUTHORIZED                  = 401,
      GSK_HTTP_STATUS_PAYMENT_REQUIRED              = 402,
      GSK_HTTP_STATUS_FORBIDDEN                     = 403,
      GSK_HTTP_STATUS_NOT_FOUND                     = 404,
      GSK_HTTP_STATUS_METHOD_NOT_ALLOWED            = 405,
      GSK_HTTP_STATUS_NOT_ACCEPTABLE                = 406,
      GSK_HTTP_STATUS_PROXY_AUTH_REQUIRED           = 407,
      GSK_HTTP_STATUS_REQUEST_TIMEOUT               = 408,
      GSK_HTTP_STATUS_CONFLICT                      = 409,
      GSK_HTTP_STATUS_GONE                          = 410,
      GSK_HTTP_STATUS_LENGTH_REQUIRED               = 411,
      GSK_HTTP_STATUS_PRECONDITION_FAILED           = 412,
      GSK_HTTP_STATUS_ENTITY_TOO_LARGE              = 413,
      GSK_HTTP_STATUS_URI_TOO_LARGE                 = 414,
      GSK_HTTP_STATUS_UNSUPPORTED_MEDIA             = 415,
      GSK_HTTP_STATUS_BAD_RANGE                     = 416,
      GSK_HTTP_STATUS_EXPECTATION_FAILED            = 417,
      GSK_HTTP_STATUS_INTERNAL_SERVER_ERROR         = 500,
      GSK_HTTP_STATUS_NOT_IMPLEMENTED               = 501,
      GSK_HTTP_STATUS_BAD_GATEWAY                   = 502,
      GSK_HTTP_STATUS_SERVICE_UNAVAILABLE           = 503,
      GSK_HTTP_STATUS_GATEWAY_TIMEOUT               = 504,
      GSK_HTTP_STATUS_UNSUPPORTED_VERSION           = 505
    } GskHttpStatus;

Status code corresponding to the number on the first line of an HTTP response. This enum takes on the same numerical value.

`GSK_HTTP_STATUS_CONTINUE`

[From RFC 2616, Section 8.2.3; see also Section 10.1.1] The purpose of the 100 (Continue) status (see section 10.1.1) is to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body. In some cases, it might either be inappropriate or highly inefficient for the client to send the body if the server will reject the message without looking at the body. Currently, GSK has only very limited support for this protocol.

`GSK_HTTP_STATUS_SWITCHING_PROTOCOLS`

Rarely used. [From RFC 2616, Section 10.1.2] The server understands and is willing to comply with the client's request, via the Upgrade message header field (section 14.42), for a change in the application protocol being used on this connection. The server will switch protocols to those defined by the response's Upgrade header field immediately after the empty line which terminates the 101 response. The protocol SHOULD be switched only when it is advantageous to do so. For example, switching to a newer version of HTTP is advantageous over older versions, and switching to a real-time, synchronous protocol might be advantageous when delivering resources that use such features.

`GSK_HTTP_STATUS_OK` | The standard response to indicate that the request is about to be successfully executed. Section 10.2.1 states what content will be available (it depends on the request's verb.)

`GSK_HTTP_STATUS_CREATED`

[From RFC 2616, Section 10.2.2] The request has been fulfilled and resulted in a new resource being created. The newly created resource can be referenced by the URI(s) returned in the entity of the response, with the most specific URI for the resource given by a Location header field. The response SHOULD include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. The origin server MUST create the resource before returning the 201 status code. If the action cannot be carried out immediately, the server SHOULD respond with 202 (Accepted) response instead. A 201 response MAY contain an ETag response header field indicating the current value of the entity tag for the requested variant just created, see section 14.19.

`GSK_HTTP_STATUS_ACCEPTED`

[From RFC 2616, Section 10.2.3] The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place. There is no facility for re-sending a status code from an asynchronous operation such as this. The 202 response is intentionally non-committal. Its purpose is to allow a server to accept a request for some other process (perhaps a batch-oriented process that is only run once per day) without requiring that the user agent's connection to the server persist until the process is completed. The entity returned with this response SHOULD include an indication of the request's current status and either a pointer to a status monitor or some estimate of when the user can expect the request to be fulfilled.

`GSK_HTTP_STATUS_NONAUTHORITATIVE_INFO`

[From RFC 2616, Section 10.2.4] The returned metainformation in the entity-header is not the definitive set as available from the origin server, but is gathered from a local or a third-party copy. The set presented MAY be a subset or superset of the original version. For example, including local annotation information about the resource might result in a superset of the metainformation known by the origin server. Use of this response code is not required and is only appropriate when the response would otherwise be 200 (OK).

`GSK_HTTP_STATUS_NO_CONTENT`

[From RFC 2616, Section 10.2.5] The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation. The response MAY include new or updated metainformation in the form of entity-headers, which if present SHOULD be associated with the requested variant. If the client is a user agent, it SHOULD NOT change its document view from that which caused the request to be sent. This response is primarily intended to allow input for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation SHOULD be applied to the document currently in the user agent's active view. The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields.

`GSK_HTTP_STATUS_RESET_CONTENT`

[From RFC 2616, Section 10.2.6] The server has fulfilled the request and the user agent SHOULD reset the document view which caused the request to be sent. This response is primarily intended to allow input for actions to take place via user input, followed by a clearing of the form in which the input is given so that the user can easily initiate another input action. The response MUST NOT include an entity.

`GSK_HTTP_STATUS_PARTIAL_CONTENT`

[From RFC 2616, Section 10.2.7] The server has fulfilled the partial GET request for the resource. The request MUST have included a Range header field (section 14.35) indicating the desired range, and MAY have included an If-Range header field (section 14.27) to make the request conditional. [by daveb] In addition, the response must contain several normally optional fields, namely Content-Range, Date, and either ETag or Content-Location. Furthermore if must have cache-info, i.e. Expires, Cache-Control, and/or Vary. See the RFC for the painful details.

`GSK_HTTP_STATUS_MULTIPLE_CHOICES`

[From RFC 2616, Section 10.3.1] The requested resource corresponds to any one of a set of representations, each with its own specific location, and agent- driven negotiation information (section 12) is being provided so that the user (or user agent) can select a preferred representation and redirect its request to that location. Unless it was a HEAD request, the response SHOULD include an entity containing a list of resource characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content- Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice MAY be performed automatically. However, this specification does not define any standard for such automatic selection. If the server has a preferred choice of representation, it SHOULD include the specific URI for that representation in the Location field; user agents MAY use the Location field value for automatic redirection. This response is cacheable unless indicated otherwise.

`GSK_HTTP_STATUS_MOVED_PERMANENTLY`

[From RFC 2616, Section 10.3.2] The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise. The new permanent URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s). If the 301 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued. Note: When automatically redirecting a POST request after receiving a 301 status code, some existing HTTP/1.0 user agents will erroneously change it into a GET request.

`GSK_HTTP_STATUS_FOUND`

[From RFC 2616, Section 10.3.3] The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field. The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s). [There's more detail in the RFC]

`GSK_HTTP_STATUS_SEE_OTHER`

[From RFC 2616, Section 10.3.4] The response to the request can be found under a different URI and SHOULD be retrieved using a GET method on that resource. This method exists primarily to allow the output of a POST-activated script to redirect the user agent to a selected resource. The new URI is not a substitute reference for the originally requested resource. The 303 response MUST NOT be cached, but the response to the second (redirected) request might be cacheable. The different URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s). Note: Many pre-HTTP/1.1 user agents do not understand the 303 status. When interoperability with such clients is a concern, the 302 status code may be used instead, since most user agents react to a 302 response as described here for 303.

`GSK_HTTP_STATUS_NOT_MODIFIED`

[From RFC 2616, Section 10.3.5] If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields. The response MUST include the following header fields: - Date, unless its omission is required by section 14.18.1 If a clockless origin server obeys these rules, and proxies and clients add their own Date to any response received without one (as already specified by [RFC 2068], section 14.19), caches will operate correctly. - ETag and/or Content-Location, if the header would have been sent in a 200 response to the same request - Expires, Cache-Control, and/or Vary, if the field-value might differ from that sent in any previous response for the same variant If the conditional GET used a strong cache validator (see section 13.3.3), the response SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response MUST NOT include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers. If a 304 response indicates an entity not currently cached, then the cache MUST disregard the response and repeat the request without the conditional. If a cache uses a received 304 response to update a cache entry, the cache MUST update the entry to reflect any new field values given in the response.

`GSK_HTTP_STATUS_USE_PROXY`

[From RFC 2616, Section 10.3.6] The requested resource MUST be accessed through the proxy given by the Location field. The Location field gives the URI of the proxy. The recipient is expected to repeat this single request via the proxy. 305 responses MUST only be generated by origin servers. Note: RFC 2068 was not clear that 305 was intended to redirect a single request, and to be generated by origin servers only. Not observing these limitations has significant security consequences.

`GSK_HTTP_STATUS_TEMPORARY_REDIRECT`

[From RFC 2616, Section 10.3.8] The requested resource resides temporarily under a different URI. Since the redirection MAY be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field. The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s) , since many pre-HTTP/1.1 user agents do not understand the 307 status. Therefore, the note SHOULD contain the information necessary for a user to repeat the original request on the new URI. If the 307 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.

`GSK_HTTP_STATUS_BAD_REQUEST` | [From RFC 2616, Section 10.4.1] The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

`GSK_HTTP_STATUS_UNAUTHORIZED`

[From RFC 2616, Section 10.4.2] The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.47) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user SHOULD be presented the entity that was given in the response, since that entity might include relevant diagnostic information. HTTP access authentication is explained in "HTTP Authentication: Basic and Digest Access Authentication" [43].

`GSK_HTTP_STATUS_PAYMENT_REQUIRED` | Gotta love this one. [From RFC 2616, Section 10.4.3] This code is reserved for future use.

`GSK_HTTP_STATUS_FORBIDDEN`

[From RFC 2616, Section 10.4.4] The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.

`GSK_HTTP_STATUS_NOT_FOUND`

[From RFC 2616, Section 10.4.5] The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

`GSK_HTTP_STATUS_METHOD_NOT_ALLOWED` | [From RFC 2616, Section 10.4.6] The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource.

`GSK_HTTP_STATUS_NOT_ACCEPTABLE`

[From RFC 2616, Section 10.4.7] The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request. Unless it was a HEAD request, the response SHOULD include an entity containing a list of available entity characteristics and location(s) from which the user or user agent can choose the one most appropriate. The entity format is specified by the media type given in the Content-Type header field. Depending upon the format and the capabilities of the user agent, selection of the most appropriate choice MAY be performed automatically. However, this specification does not define any standard for such automatic selection. Note: HTTP/1.1 servers are allowed to return responses which are not acceptable according to the accept headers sent in the request. In some cases, this may even be preferable to sending a 406 response. User agents are encouraged to inspect the headers of an incoming response to determine if it is acceptable. If the response could be unacceptable, a user agent SHOULD temporarily stop receipt of more data and query the user for a decision on further actions.

`GSK_HTTP_STATUS_PROXY_AUTH_REQUIRED`

[From RFC 2616, Section 10.4.8] This code is similar to 401 (Unauthorized), but indicates that the client must first authenticate itself with the proxy. The proxy MUST return a Proxy-Authenticate header field (section 14.33) containing a challenge applicable to the proxy for the requested resource. The client MAY repeat the request with a suitable Proxy-Authorization header field (section 14.34). HTTP access authentication is explained in "HTTP Authentication: Basic and Digest Access Authentication". RFC 2617.

`GSK_HTTP_STATUS_REQUEST_TIMEOUT` | [From RFC 2616, Section 10.4.9] The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.

`GSK_HTTP_STATUS_CONFLICT`

[From RFC 2616, Section 10.4.10] The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user agent to fix the problem; however, that might not be possible and is not required. Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the entity being PUT included changes to a resource which conflict with those made by an earlier (third-party) request, the server might use the 409 response to indicate that it can't complete the request. In this case, the response entity would likely contain a list of the differences between the two versions in a format defined by the response Content-Type.

`GSK_HTTP_STATUS_GONE`

[From RFC 2616, Section 10.4.11] The requested resource is no longer available at the server and no forwarding address is known. This condition is expected to be considered permanent. Clients with link editing capabilities SHOULD delete references to the Request-URI after user approval. If the server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) SHOULD be used instead. This response is cacheable unless indicated otherwise. The 410 response is primarily intended to assist the task of web maintenance by notifying the recipient that the resource is intentionally unavailable and that the server owners desire that remote links to that resource be removed. Such an event is common for limited-time, promotional services and for resources belonging to individuals no longer working at the server's site. It is not necessary to mark all permanently unavailable resources as "gone" or to keep the mark for any length of time -- that is left to the discretion of the server owner.

`GSK_HTTP_STATUS_LENGTH_REQUIRED` | [From RFC 2616, Section 10.4.12] The server refuses to accept the request without a defined Content- Length. The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the message-body in the request message.

`GSK_HTTP_STATUS_PRECONDITION_FAILED`

[From RFC 2616, Section 10.4.13] The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server. This response code allows the client to place preconditions on the current resource metainformation (header field data) and thus prevent the requested method from being applied to a resource other than the one intended.

`GSK_HTTP_STATUS_ENTITY_TOO_LARGE`

[From RFC 2616, Section 10.4.14] The server is refusing to process a request because the request entity is larger than the server is willing or able to process. The server MAY close the connection to prevent the client from continuing the request. If the condition is temporary, the server SHOULD include a Retry- After header field to indicate that it is temporary and after what time the client MAY try again.

`GSK_HTTP_STATUS_URI_TOO_LARGE`

[From RFC 2616, Section 10.4.15] The server is refusing to service the request because the Request-URI is longer than the server is willing to interpret. This rare condition is only likely to occur when a client has improperly converted a POST request to a GET request with long query information, when the client has descended into a URI "black hole" of redirection (e.g., a redirected URI prefix that points to a suffix of itself), or when the server is under attack by a client attempting to exploit security holes present in some servers using fixed-length buffers for reading or manipulating the Request-URI.

`GSK_HTTP_STATUS_UNSUPPORTED_MEDIA` | [From RFC 2616, Section 10.4.16] The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.

`GSK_HTTP_STATUS_BAD_RANGE`

[From RFC 2616, Section 10.4.17] A server SHOULD return a response with this status code if a request included a Range request-header field (section 14.35), and none of the range-specifier values in this field overlap the current extent of the selected resource, and the request did not include an If-Range request-header field. (For byte-ranges, this means that the first- byte-pos of all of the byte-range-spec values were greater than the current length of the selected resource.) When this status code is returned for a byte-range request, the response SHOULD include a Content-Range entity-header field specifying the current length of the selected resource (see section 14.16). This response MUST NOT use the multipart/byteranges content- type.

`GSK_HTTP_STATUS_EXPECTATION_FAILED` | [From RFC 2616, Section 10.4.18] The expectation given in an Expect request-header field (see section 14.20) could not be met by this server, or, if the server is a proxy, the server has unambiguous evidence that the request could not be met by the next-hop server.
`GSK_HTTP_STATUS_INTERNAL_SERVER_ERROR` | [From RFC 2616, Section 10.5.1] The server encountered an unexpected condition which prevented it from fulfilling the request.
`GSK_HTTP_STATUS_NOT_IMPLEMENTED` | [From RFC 2616, Section 10.5.2] The server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.
`GSK_HTTP_STATUS_BAD_GATEWAY` | [From RFC 2616, Section 10.5.3] The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.

`GSK_HTTP_STATUS_SERVICE_UNAVAILABLE`

[From RFC 2616, Section 10.5.4] The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response. Note: The existence of the 503 status code does not imply that a server must use it when becoming overloaded. Some servers may wish to simply refuse the connection.

`GSK_HTTP_STATUS_GATEWAY_TIMEOUT`

[From RFC 2616, Section 10.5.5] The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request. Note: Note to implementors: some deployed proxies are known to return 400 or 500 when DNS lookups time out.

`GSK_HTTP_STATUS_UNSUPPORTED_VERSION`

[From RFC 2616, Section 10.5.6] The server does not support, or refuses to support, the HTTP protocol version that was used in the request message. The server is indicating that it is unable or unwilling to complete the request using the same major version as the client, as described in section 3.1, other than with this error message. The response SHOULD contain an entity describing why that version is not supported and what other protocols are supported by that server.

### enum GskHttpVerb

    typedef enum
    {
      GSK_HTTP_VERB_GET,
      GSK_HTTP_VERB_POST,
      GSK_HTTP_VERB_PUT,
      GSK_HTTP_VERB_HEAD,
      GSK_HTTP_VERB_OPTIONS,
      GSK_HTTP_VERB_DELETE,
      GSK_HTTP_VERB_TRACE,
      GSK_HTTP_VERB_CONNECT
    } GskHttpVerb;

The type of action requested by the User or User-Agent. It is common practice that GET and HEAD requests are "safe"-- they are intended for information retrieval are should never have harmful side-effects.

Some additional methods are idempotent, meaning that running the command more than once SHOULD have no effect. In particular, PUT, DELETE, OPTIONS, and TRACE have this property, as well as the safe methods GET and HEAD.

`GSK_HTTP_VERB_GET`

[RFC 2616; 9.3] The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process. The semantics of the GET method change to a "conditional GET" if the request message includes an If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match, or If-Range header field. A conditional GET method requests that the entity be transferred only under the circumstances described by the conditional header field(s). The conditional GET method is intended to reduce unnecessary network usage by allowing cached entities to be refreshed without requiring multiple requests or transferring data already held by the client. The semantics of the GET method change to a "partial GET" if the request message includes a Range header field. A partial GET requests that only part of the entity be transferred, as described in section 14.35. The partial GET method is intended to reduce unnecessary network usage by allowing partially-retrieved entities to be completed without transferring data already held by the client. The response to a GET request is cacheable if and only if it meets the requirements for HTTP caching described in section 13. See section 15.1.3 for security considerations when used for forms.

`GSK_HTTP_VERB_POST`

[RFC 2616; 9.5] The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions: - Annotation of existing resources; - Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles; - Providing a block of data, such as the result of submitting a form, to a data-handling process; - Extending a database through an append operation. The actual function performed by the POST method is determined by the server and is usually dependent on the Request-URI. The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it, a news article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a database. The action performed by the POST method might not result in a resource that can be identified by a URI. In this case, either 200 (OK) or 204 (No Content) is the appropriate response status, depending on whether or not the response includes an entity that describes the result. If a resource has been created on the origin server, the response SHOULD be 201 (Created) and contain an entity which describes the status of the request and refers to the new resource, and a Location header (see section 14.30). Responses to this method are not cacheable, unless the response includes appropriate Cache-Control or Expires header fields. However, the 303 (See Other) response can be used to direct the user agent to retrieve a cacheable resource. POST requests MUST obey the message transmission requirements set out in section 8.2. See section 15.1.3 for security considerations.

`GSK_HTTP_VERB_PUT`

[RFC 2616; 9.6] The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI. If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response. If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request. If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem. The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a 501 (Not Implemented) response in such cases. If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable. The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI, it MUST send a 301 (Moved Permanently) response; the user agent MAY then make its own decision regarding whether or not to redirect the request. A single resource MAY be identified by many different URIs. For example, an article might have a URI for identifying "the current version" which is separate from the URI identifying each particular version. In this case, a PUT request on a general URI might result in several other URIs being defined by the origin server. HTTP/1.1 does not define how a PUT method affects the state of an origin server. PUT requests MUST obey the message transmission requirements set out in section 8.2. Unless otherwise specified for a particular entity-header, the entity-headers in the PUT request SHOULD be applied to the resource created or modified by the PUT.

`GSK_HTTP_VERB_HEAD`

[RFC 2616; 9.4] The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification. The response to a HEAD request MAY be cacheable in the sense that the information contained in the response MAY be used to update a previously cached entity from that resource. If the new field values indicate that the cached entity differs from the current entity (as would be indicated by a change in Content-Length, Content-MD5, ETag or Last-Modified), then the cache MUST treat the cache entry as stale.

`GSK_HTTP_VERB_OPTIONS`

[RFC 2616; 9.2] The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval. Responses to this method are not cacheable. If the OPTIONS request includes an entity-body (as indicated by the presence of Content-Length or Transfer-Encoding), then the media type MUST be indicated by a Content-Type field. Although this specification does not define any use for such a body, future extensions to HTTP might use the OPTIONS body to make more detailed queries on the server. A server that does not support such an extension MAY discard the request body. If the Request-URI is an asterisk ("*"), the OPTIONS request is intended to apply to the server in general rather than to a specific resource. Since a server's communication options typically depend on the resource, the "*" request is only useful as a "ping" or "no-op" type of method; it does nothing beyond allowing the client to test the capabilities of the server. For example, this can be used to test a proxy for HTTP/1.1 compliance (or lack thereof). If the Request-URI is not an asterisk, the OPTIONS request applies only to the options that are available when communicating with that resource. A 200 response SHOULD include any header fields that indicate optional features implemented by the server and applicable to that resource (e.g., Allow), possibly including extensions not defined by this specification. The response body, if any, SHOULD also include information about the communication options. The format for such a body is not defined by this specification, but might be defined by future extensions to HTTP. Content negotiation MAY be used to select the appropriate response format. If no response body is included, the response MUST include a Content-Length field with a field-value of "0". The Max-Forwards request-header field MAY be used to target a specific proxy in the request chain. When a proxy receives an OPTIONS request on an absoluteURI for which request forwarding is permitted, the proxy MUST check for a Max-Forwards field. If the Max-Forwards field-value is zero ("0"), the proxy MUST NOT forward the message; instead, the proxy SHOULD respond with its own communication options. If the Max-Forwards field-value is an integer greater than zero, the proxy MUST decrement the field-value when it forwards the request. If no Max-Forwards field is present in the request, then the forwarded request MUST NOT include a Max-Forwards field.

`GSK_HTTP_VERB_DELETE`

[RFC 2616; 9.7] The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location. A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity. If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable.

`GSK_HTTP_VERB_TRACE`

[RFC 2616; 9.8] The TRACE method is used to invoke a remote, application-layer loop- back of the request message. The final recipient of the request SHOULD reflect the message received back to the client as the entity-body of a 200 (OK) response. The final recipient is either the origin server or the first proxy or gateway to receive a Max-Forwards value of zero (0) in the request (see section 14.31). A TRACE request MUST NOT include an entity. TRACE allows the client to see what is being received at the other end of the request chain and use that data for testing or diagnostic information. The value of the Via header field (section 14.45) is of particular interest, since it acts as a trace of the request chain. Use of the Max-Forwards header field allows the client to limit the length of the request chain, which is useful for testing a chain of proxies forwarding messages in an infinite loop. If the request is valid, the response SHOULD contain the entire request message in the entity-body, with a Content-Type of "message/http". Responses to this method MUST NOT be cached.

`GSK_HTTP_VERB_CONNECT` | [RFC 2616; 9.9] This specification reserves the method name CONNECT for use with a proxy that can dynamically switch to being a tunnel (e.g. SSL tunneling [44]).

### enum GskHttpRange

    typedef enum
    {
      GSK_HTTP_RANGE_BYTES
    } GskHttpRange;

This gives units, or allowed units, for the Content-Range. This is used when you want to retreive part of a document. (Not all servers support that, of course.)

Currently, only bytes are allowed.

`GSK_HTTP_RANGE_BYTES` | Indicate that the range of the partial content will be given in bytes.

### enum GskHttpContentEncoding

    typedef enum {
      GSK_HTTP_CONTENT_ENCODING_IDENTITY,
      GSK_HTTP_CONTENT_ENCODING_GZIP,
      GSK_HTTP_CONTENT_ENCODING_COMPRESS,
      GSK_HTTP_CONTENT_ENCODING_UNRECOGNIZED = 0x100
    } GskHttpContentEncoding;

This gives ways in which content can be encoded. The default encoding is "identity", which means that the data is not re-encoded as all: it is sent as itself.

Currently, all non-identity encodings are compression schemes.

XXX: the spec says that multiple content-encodings are allowed, and that they are applied left-to-right. But we won't even parse such a line, due to the limited types of content-encoding we are aware of.

`GSK_HTTP_CONTENT_ENCODING_IDENTITY` | Transfer the data without any special encoding.
`GSK_HTTP_CONTENT_ENCODING_GZIP` | Transfer the data after compressing it with gzip. RFC 1952.
`GSK_HTTP_CONTENT_ENCODING_COMPRESS` | Transfer the data after compressing it with compress, the classic unix program. There is no RFC corresponding to this format. (See RFC 2616, Section 3.5 for an apologetic explanation).
`GSK_HTTP_CONTENT_ENCODING_UNRECOGNIZED` | An unrecognized type of content-encoding was requested.

### enum GskHttpTransferEncoding

    typedef enum {
      GSK_HTTP_TRANSFER_ENCODING_NONE    = 0,
      GSK_HTTP_TRANSFER_ENCODING_CHUNKED = 1,
      GSK_HTTP_TRANSFER_ENCODING_UNRECOGNIZED = 0x100
    } GskHttpTransferEncoding;

[RFC 2616, Section 3.6] Transfer-coding values are used to indicate an encoding transformation that has been, can be, or may need to be applied to an entity-body in order to ensure "safe transport" through the network.

`GSK_HTTP_TRANSFER_ENCODING_NONE` | The data is transferred unmodified.
`GSK_HTTP_TRANSFER_ENCODING_CHUNKED` | The data is transferred in length-prefixed packets.
`GSK_HTTP_TRANSFER_ENCODING_UNRECOGNIZED` | An unrecognized transfer encoding was received.

### enum GskHttpConnection

    typedef enum
    {
      GSK_HTTP_CONNECTION_NONE       = 0,
      GSK_HTTP_CONNECTION_CLOSE      = 1,
      GSK_HTTP_CONNECTION_KEEPALIVE  = 2,
    } GskHttpConnection;

Specify what should happen once the transaction is done.

This is used to support persistent connections, which can be more efficient than making a new connection for each transaction.

`GSK_HTTP_CONNECTION_NONE` | The default behavior applies: HTTP/1.0 clients treat this as CLOSE; HTTP/1.1 clients treat this as KEEPALIVE.
`GSK_HTTP_CONNECTION_CLOSE` | Close the connection after this transaction.
`GSK_HTTP_CONNECTION_KEEPALIVE` | Try to keep the connection alive after this transaction. This is not always possible: for example, if Transfer-Encoding chunked is not supported but the server doesn't know the length in advance.

### gsk_http_media_type_set_new ()

    GskHttpMediaTypeSet * gsk_http_media_type_set_new       (const char *type,
                                                             const char *subtype,
                                                             gfloat quality);

Allocate a new node in a GskHttpMediaTypeSet list.

`type` : | major type of the media to allow, like "text" or "image". An asterisk can be used to allow any major type.
`subtype` : | format of the media to allow, like "html", "plain" or "jpeg". An asterisk can be used to allow any format.
`quality` : | relative preference for this encoding. -1 means "not specified", which has a default of 1.
Returns : | the newly allocated node.

### gsk_http_media_type_set_free ()

    void                gsk_http_media_type_set_free        (GskHttpMediaTypeSet *set);

Free the memory associated with the media-type-set node.

`set` : | the media type set to deallocate.

### gsk_http_char_set_new ()

    GskHttpCharSet *    gsk_http_char_set_new               (const char *charset_name,
                                                             gfloat quality);

Allocate a single GskHttpCharSet preference. You may wish to build a list of these.

`charset_name` : | name of the character set.
`quality` : | quality from 0 to 1, or -1 if no quality flag was given.
Returns : | the new character-set.

### gsk_http_char_set_free ()

    void                gsk_http_char_set_free              (GskHttpCharSet *char_set);

Deallocate a GskHttpCharSet.

`char_set` : | character set to free.

### gsk_http_content_encoding_set_new ()

    GskHttpContentEncodingSet * gsk_http_content_encoding_set_new
                                                            (GskHttpContentEncoding encoding,
                                                             gfloat quality);

Allocate a new node in a GskHttpContentEncodingSet list.

`encoding` : | the encoding to list a preference for.
`quality` : | relative preference for this encoding. A value of -1 means that the quality was omitted, which means it should be treated as 1.
Returns : | the new encoding node.

### gsk_http_content_encoding_set_free ()

    void                gsk_http_content_encoding_set_free  (GskHttpContentEncodingSet *encoding_set);

Deallocate the encoding.

`encoding_set` : | the encoding set to deallocate.

### gsk_http_transfer_encoding_set_new ()

    GskHttpTransferEncodingSet * gsk_http_transfer_encoding_set_new
                                                            (GskHttpTransferEncoding encoding,
                                                             gfloat quality);

Allocate a new node in a GskHttpTransferEncodingSet list.

`encoding` : | the encoding to list a preference for.
`quality` : | relative preference for this encoding. A value of -1 means that the quality was omitted, which means it should be treated as 1.
Returns : | the new encoding node.

### gsk_http_transfer_encoding_set_free ()

    void                gsk_http_transfer_encoding_set_free (GskHttpTransferEncodingSet *encoding_set);

Deallocate the encoding (a single node in the list).

`encoding_set` : | the encoding set to deallocate.

### gsk_http_range_set_new ()

    GskHttpRangeSet *   gsk_http_range_set_new              (GskHttpRange range_type);

Allocate a node telling what units are available for specifying partial content.

`range_type` : | allocate a new node in a allowable range units list.
Returns : | the newly allocated node.

### gsk_http_range_set_free ()

    void                gsk_http_range_set_free             (GskHttpRangeSet *set);

Free the memory associated with the node in the range-set.

`set` : | range-unit node to deallocate.

### gsk_http_language_set_new ()

    GskHttpLanguageSet * gsk_http_language_set_new          (const char *language,
                                                             gfloat quality);

Allocate a new node in a GskHttpLanguageSet list. Though any ASCII string is basically allowed, a two letter language code (en, de, pl, it, etc) is the usual start of the language name; a two letter country code (US, UK, DE, etc) is the second more optional part, like "en-US".

`language` : | the human language code to list a preference for.
`quality` : | relative preference for this encoding. A value of -1 means that the quality was omitted, which means it should be treated as 1.
Returns : | the new language node.

### gsk_http_language_set_free ()

    void                gsk_http_language_set_free          (GskHttpLanguageSet *set);

Deallocate the node in the language-set.

`set` : | the language set node to deallocate.

### gsk_http_authenticate_new_basic ()

    GskHttpAuthenticate * gsk_http_authenticate_new_basic   (const char *realm);

Create an GskHttpAuthenticate for basic authentication. Basic authentication is very insecure: the password is merely transmitted base64 encoded.

`realm` : | the area on the site to authenticate for. This is the name used by the RFC.
Returns : | the new challenge.

### gsk_http_authenticate_new_digest ()

    GskHttpAuthenticate * gsk_http_authenticate_new_digest  (const char *realm,
                                                             const char *domain,
                                                             const char *nonce,
                                                             const char *opaque,
                                                             const char *algorithm);

Create an GskHttpAuthenticate for Digest authentication. Digest authentication improves Basic authentication by using a hash of the password.

`realm` : | the area on the site to authenticate for.
`domain` : |
`nonce` : | value hashed into the digest to keep it secure against replay attacks.
`opaque` : | value which must be sent back to the server, which the client does not interpret.
`algorithm` : | digest algorithm. Only MD5 is supported for now, and is equivalent to specifying NULL.
Returns : | the new challenge.

### gsk_http_authenticate_new_unknown ()

    GskHttpAuthenticate * gsk_http_authenticate_new_unknown (const char *auth_scheme_name,
                                                             const char *realm,
                                                             const char *options);

Handling your special purpose authenticator. Note that Basic and Digest authenticator parsers are built-in to GSK, this is only for other types.

It is given from the server to the client. The client must response (in another message) with an authorization.

The purpose of a challenge in cryptographic systems is to randomize the transaction so that an attacker cannot use the same Authorization lines to get access to a machine.

Of course, if you use an insecure transport layer, it is MUCH harder to make things secure -- using SSL is recommended.

Some WWW-Authenticate header is required in a GSK_HTTP_STATUS_UNAUTHORIZED response message.

`auth_scheme_name` : |
`realm` : |
`options` : |
Returns : | the new challenge.

### gsk_http_authorization_new_basic ()

    GskHttpAuthorization * gsk_http_authorization_new_basic (const char *user,
                                                             const char *password);

Basic HTTP authentication response. Not very secure because your password is provided plain-text.

`user` : | name of the account to authenticate for.
`password` : | password of the account to authenticate for.
Returns : | the response to the authentication request.

### gsk_http_authorization_new_respond_post ()

    GskHttpAuthorization * gsk_http_authorization_new_respond_post
                                                            (const GskHttpAuthenticate *,
                                                             const char *user,
                                                             const char *password,
                                                             guint post_data_len,
                                                             gconstpointer post_data,
                                                             GError **error);

`Param1` : |
`user` : |
`password` : |
`post_data_len` : |
`post_data` : |
`error` : |
Returns : |

### gsk_http_authorization_new_unknown ()

    GskHttpAuthorization * gsk_http_authorization_new_unknown
                                                            (const char *auth_scheme_name,
                                                             const char *response);

Arbitrary authorization response.

We recommend you use `gsk_http_authorization_new_digest()` instead, or `gsk_http_authorization_new_basic()` if that's all the server can do.

`auth_scheme_name` : | name of the authentification scheme.
`response` : |
Returns : | the response to the authentication request.

### gsk_http_authorization_peek_response_digest ()

    const char *        gsk_http_authorization_peek_response_digest
                                                            (GskHttpAuthorization *);

`Param1` : |
Returns : |

### gsk_http_authorization_copy ()

    GskHttpAuthorization * gsk_http_authorization_copy      (const GskHttpAuthorization *);

`Param1` : |
Returns : |

### gsk_http_authorization_new_digest ()

    GskHttpAuthorization * gsk_http_authorization_new_digest
                                                            (const char *realm,
                                                             const char *domain,
                                                             const char *nonce,
                                                             const char *opaque,
                                                             const char *algorithm,
                                                             const char *user,
                                                             const char *password,
                                                             const char *response_digest,
                                                             const char *entity_digest);

Create a new Digest-based authentication response. Many of the parameters must match the Authenticate header.

The response_digest is a value computed from nonce, user, and password. The security of Digest authentication derives from the difficulty of computing the password from the digest, since the password itself is not transmitted cleartext.

`realm` : | the area on the site to authenticate for.
`domain` : |
`nonce` : | value hashed into the digest to keep it secure against replay attacks.
`opaque` : | value which must be sent back to the server, which the client does not interpret.
`algorithm` : | digest algorithm. Only MD5 is supported for now, and is equivalent to specifying NULL.
`user` : | name of the account to authenticate for.
`password` : | password of the account to authenticate for. [unnecessary if you have the response digest] This value is NOT transmitted to the remote host.
`response_digest` : | the securely-hashed response. If NULL, Gsk will compute the response.
`entity_digest` : | the securely-hashed information about your POST content.
Returns : | the response to the authentication request.

### gsk_http_authorization_new_respond ()

    GskHttpAuthorization * gsk_http_authorization_new_respond
                                                            (const GskHttpAuthenticate *,
                                                             const char *user,
                                                             const char *password,
                                                             GError **error);

Attempt to use the given user/password pair as authentication information for the given request.

`Param1` : |
`user` : | the username of the account (or whatever) to use.
`password` : | password of the account to authenticate for.
`error` : | optional place to put the error if something goes wrong.
Returns : | the new response, or NULL if something goes wrong.

### gsk_http_authorization_set_nonce ()

    void                gsk_http_authorization_set_nonce    (GskHttpAuthorization *,
                                                             const char *nonce);

`Param1` : |
`nonce` : |

### gsk_http_cookie_new ()

    GskHttpCookie *     gsk_http_cookie_new                 (const char *key,
                                                             const char *value,
                                                             const char *path,
                                                             const char *domain,
                                                             const char *expire_date,
                                                             const char *comment,
                                                             int max_age);

Allocate a cookie. Once allocated, it cannot be changed.

Cookies are a mechanism for tracking users. The remote host sends a Set-Cookie directive which, should be client choose to accept it, may be sent with subsequent relevant requests.

NOTE: GSK does not automatically handle cookies. That is up to the application.

TODO: GSK should have a cookie database mechanism.

See RFC 2964 and 2965.

`key` : | token used to identify the cookie.
`value` : | information associated with the cookie.
`path` : | applicable area in server directory structure for this cookie.
`domain` : | domain names this cookie applies to.
`expire_date` : | when this cookie should be discarded.
`comment` : | miscellaneous information about this cookie.
`max_age` : | maximum number of seconds that this cookie should be retained.
Returns : | the newly allocated cookie.

### gsk_http_cookie_copy ()

    GskHttpCookie *     gsk_http_cookie_copy                (const GskHttpCookie *orig);

Copy a cookie.

`orig` : | the cookie to copy.
Returns : | the new cookie.

### gsk_http_cookie_free ()

    void                gsk_http_cookie_free                (GskHttpCookie *orig);

Free the memory associated with the cookie.

`orig` : | the cookie to deallocate.

### GskHttpHeaderClass

    typedef struct {
      GObjectClass                  base_class;
    } GskHttpHeaderClass;

Virtual functions of HTTP headers (none, for now).

GObjectClass `base_class`; | object system.

### GskHttpHeader

    typedef struct {
      guint16                       http_major_version;             /* always 1 */
      guint16                       http_minor_version;

      GskHttpConnection             connection_type;

      GskHttpTransferEncoding       transfer_encoding_type;
      GskHttpContentEncoding        content_encoding_type;
      GskHttpRangeSet              *accepted_range_units;  /* Accept-Ranges */

      char                         *unrecognized_transfer_encoding;
      char                         *unrecognized_content_encoding;

      char                     *content_encoding;     /* Content-Encoding */

      unsigned                  has_content_type : 1;

      char                     *content_type;             /* Content-Type */
      char                     *content_subtype;
      char                     *content_charset;
      GSList                   *content_additional;

      /* NULL-terminated array of language tags from the Content-Language
       * header, or NULL if header not present. */
      char                    **content_languages;

      /* Bytes ranges. Both with be == -1 if there is no Range tag. */
      int                           range_start;
      int                           range_end;

      /* may be set to ((time_t) -1) to omit them. */
      glong                         date;

      /* From the Content-Length header. */
      gint64                        content_length;

      /* Key/value searchable header lines. */
      GHashTable                   *header_lines;

      /* Error messages.  */
      GSList                       *errors;		      /* list of char* Error: directives */

      /* General headers.  */
      GSList                       *pragmas;

      /* and actual accumulated parse error (a bit of a hack) */
      GError                       *g_error;
    } GskHttpHeader;

Base class for all HTTP headers.

guint16 `http_major_version`; | The major version of the HTTP protocol, according to the header. This must always by '1'.
guint16 `http_minor_version`; | The minor version of the HTTP protocol, according to the header. This must always by '0' or '1'.
GskHttpConnection `connection_type`; | Whether to close or keep alive the connection at the end of the current transaction.
GskHttpTransferEncoding `transfer_encoding_type`; | Type of encoding used to package the header for transmission across the transport.
GskHttpContentEncoding `content_encoding_type`; | Type of encoding used encode the content. This is mostly used to support compressed transactions.
GskHttpRangeSet *`accepted_range_units`; |
char *`unrecognized_transfer_encoding`; | A string, if the header has an unknown transfer encoding.
char *`unrecognized_content_encoding`; | A string, if the header has an unknown content encoding.
char *`content_encoding`; |
char *`content_type`; | major type of the content. Typical examples are 'text' or 'image'. Types beginning with 'x-' are for unstandardized extensions.
char *`content_subtype`; | minor type of the content. Typical examples depend on the major type. For 'text', one encounters 'plain' and 'html'. For 'image', one encounters 'jpeg', 'png', 'gif' etc.
char *`content_charset`; |
GSList *`content_additional`; |
char **`content_languages`; |
int `range_start`; | First byte to transmit, or -1 if not using partial ranges.
int `range_end`; | Immediately after the last byte to transport, or -1 if no end range given.
glong `date`; | The date of the transaction, in UNIX time, or -1 if not specified.
gint64 `content_length`; | The length of the content associated with this side of this transaction.
GHashTable *`header_lines`; | Hash-table of key->value mappings, for headers which are not handled directly by this implementation.
GSList *`errors`; |
GSList *`pragmas`; | A list of strings from Pragma: header lines.
GError *`g_error`; | A GError that indicates what last went wrong with this header. Usually NULL.

### enum GskHttpParseFlags

    typedef enum
    {
      GSK_HTTP_PARSE_STRICT = (1 << 0),

      /* instead of giving up on unknown headers, just
       * add them as misc-headers */
      GSK_HTTP_PARSE_SAVE_ERRORS = (1 << 1)
    } GskHttpParseFlags;

Flags which affect how headers are parsed.

`GSK_HTTP_PARSE_STRICT` | Require the header to be in strict(er) HTTP conformance when parsing.
`GSK_HTTP_PARSE_SAVE_ERRORS` | Add headers that don't parse correctly into the misc-headers hashtable.

### gsk_http_header_get_connection ()

    GskHttpConnection   gsk_http_header_get_connection      (GskHttpHeader *header);

Returns the connection semantics. Note that this will never return GSK_HTTP_CONNECTION_NONE; it will figure out if the default is keep-alive or close.

Use `gsk_http_header_get_connection_type()` to get the actual connection-type that will be transmitted over the wire (with NONE meaning that there is no Connection: header).

Note that the client can make Connection: requests, but the server is allowed to ignore keep-alive directives. So calling this on the request gets the client's suggestions, and calling this on the response gets the server's intentions.

`header` : | the HTTP header to query.
Returns : | the connection semantics.

### gsk_http_header_from_buffer ()

    GskHttpHeader *     gsk_http_header_from_buffer         (GskBuffer *input,
                                                             gboolean is_request,
                                                             GskHttpParseFlags flags,
                                                             GError **error);

Parse the HTTP header from the buffer.

`input` : | the buffer from which to parse the request.
`is_request` : | whether this is a request; otherwise, it is a response.
`flags` : | preferences for parsing.
`error` : |
Returns : | a new reference to the header.

### gsk_http_header_to_buffer ()

    void                gsk_http_header_to_buffer           (GskHttpHeader *header,
                                                             GskBuffer *output);

Appends an HTTP header into a buffer.

`header` : | the HTTP header to write into the buffer.
`output` : | the buffer to store the header in, as text.

### gsk_http_header_set_content_encoding ()

    void                gsk_http_header_set_content_encoding
                                                            (GskHttpHeader *header,
                                                             const char *encoding);

Set encoding method for the content. The actual encoding is done transparently by GskHttpClient and GskHttpServer usually. Encoding is only used for POST and PUT requests and any response that has a body (most do). The default is the identity encoding.

`header` : | the header to affect.
`encoding` : | the new content encoding method.

### gsk_http_header_get_content_encoding()

    #define             gsk_http_header_get_content_encoding(header)

Get encoding method for the content. (The actual encoding is done transparently by GskHttpClient and GskHttpServer usually.)

`header` : | the header to query.

### gsk_http_header_set_date()

    #define             gsk_http_header_set_date(header, date)

The date of the request. Defines as the same as "orig-date in RFC 822". Basically, clients should only send dates with POST or PUT data, and even then it is optional. Servers should usually send dates, but if there is no content then the date is optional. The precise rules are set out in [RFC 2616, Section 14.18].

`header` : | The HTTP header to affect.
`date` : | The date, as a unix time number.

### gsk_http_header_get_date()

    #define             gsk_http_header_get_date(header)

Get the Date on the request, or -1 if not set.

`header` : | The HTTP header to query.

### gsk_http_header_add_misc ()

    void                gsk_http_header_add_misc            (GskHttpHeader *header,
                                                             const char *key,
                                                             const char *value);

Add a raw header line to the header, with an associated value.

`header` : | the header to affect.
`key` : | a case-insensitive ASCII string for the key for this foreign header. This key should not be a standard HTTP tag.
`value` : | a case-sensitive value for that key.

### gsk_http_header_lookup_misc ()

    const char *        gsk_http_header_lookup_misc         (GskHttpHeader *header,
                                                             const char *key);

Lookup a miscellaneous HTTP header. All headers that begin with X- are stored in here.

`header` : | the header to query.
`key` : | a case-insensitive ASCII string for the key for this foreign header. This key should not be a standard HTTP tag. returns: value of the key.
Returns : |

### gsk_http_header_remove_misc ()

    void                gsk_http_header_remove_misc         (GskHttpHeader *header,
                                                             const char *key);

Remove a raw header line from the header.

`header` : | the header to affect.
`key` : | a case-insensitive ASCII string for the key for this foreign header. This key should not be a standard HTTP tag.

### GskHttpHeaderLineParser

    typedef struct {
      const char *name;
      GskHttpHeaderLineParserFunc func;
      gpointer data;
    } GskHttpHeaderLineParser;

A structure giving a HTTP header line field-name, and a function to parse the value of that kind of field.

const char *`name`; | the name of the field in lowercase, i.e. "date" or "content-length".
GskHttpHeaderLineParserFunc `func`; | function to call to parse the value of that field. So if a "Date: Thu Jun 5 06:27:39 PDT 2003" line comes in, then this function will be called with "Thu Jun 5 06:27:39 PDT 2003", and a header to add that information to.
gpointer `data`; | data to pass to function.

### GskHttpHeaderLineParserFunc ()

    gboolean            (*GskHttpHeaderLineParserFunc)      (GskHttpHeader *header,
                                                             const char *text,
                                                             gpointer data);

A function to be invoked with the value of a specific type of header-line. This will add information to `header` frequently. If it encounters a parse error, it can indicate that by returning FALSE.

`header` : | header to affect by this line.
`text` : | value of the header line. That is, everything that follows the initial colon and space(s). So for the header line "Content-Length: 42", the `text` should merely be "42".
`data` : | pointer from the GskHttpHeaderLineParser to give auxilliary info.
Returns : | whether it was able to process the value.

### gsk_http_header_get_parser_table ()

    GHashTable *        gsk_http_header_get_parser_table    (gboolean is_request);

Obtain a hash-table which maps lowercased HTTP header keys to GskHttpHeaderLineParser's. There are different maps for requests and responses.

`is_request` : | whether to get the parse table for request (versus for responses).
Returns : | the hash-table mapping, which is global and should not be freed.

### GskHttpHeaderPrintFunc ()

    void                (*GskHttpHeaderPrintFunc)           (const char *text,
                                                             gpointer data);

Function to print a line of HTTP header data.

`text` : | NUL-terminated line of HTTP header.
`data` : | print_data argument of `gsk_http_header_print()`.

### gsk_http_header_print ()

    void                gsk_http_header_print               (GskHttpHeader *http_header,
                                                             GskHttpHeaderPrintFunc print_func,
                                                             gpointer print_data);

Print the HTTP header line-by-line, through a generic printing function. This could conceivable save memory and allow better streaming.

`http_header` : | the header to output, line-by-line.
`print_func` : | a function to call on each line of output.
`print_data` : | data to pass to `print_func`.

### gsk_http_header_set_connection_type()

    #define             gsk_http_header_set_connection_type(header, connection_type)

Change the Connection type reflected in this header.

[From RFC 2616, Section 14.10] The Connection general-header field allows the sender to specify options that are desired for that particular connection and MUST NOT be communicated by proxies over further connections.

`header` : | the header to affect.
`connection_type` : | the new Connection type.

### gsk_http_header_get_connection_type()

    #define             gsk_http_header_get_connection_type(header)

Get the Connection type reflected in this header.

`header` : | the header to query.

### gsk_http_header_set_transfer_encoding()

    #define             gsk_http_header_set_transfer_encoding(header, enc)

[From RFC 2616, Section 14.41] The Transfer-Encoding general-header field indicates what (if any) type of transformation has been applied to the message body in order to safely transfer it between the sender and the recipient. This differs from the content-coding in that the transfer-coding is a property of the message, not of the entity.

If multiple encodings have been applied to an entity, the transfer- codings MUST be listed in the order in which they were applied. Additional information about the encoding parameters MAY be provided by other entity-header fields not defined by this specification.

`header` : | the header to affect.
`enc` : | the new encoding.

### gsk_http_header_get_transfer_encoding()

    #define             gsk_http_header_get_transfer_encoding(header)

Get the transfer encoding of this message.

`header` : | the header to query.

### gsk_http_header_get_content_type()

    #define             gsk_http_header_get_content_type(header)

Get the major type of the content. Any header which has content SHOULD have a content-type. Typical examples are 'text' and 'image'.

XXX: need a reference to a list of content types!!!!

`header` : | the header to query.

### gsk_http_header_set_content_type()

    #define             gsk_http_header_set_content_type(header, content_type)

Set the major type of the content. Any header which has content SHOULD have a content-type. Typical examples are 'text' and 'image'.

XXX: need a reference to a list of content types!!!!

`header` : | the header to affect.
`content_type` : | the new major type of the header.

### gsk_http_header_get_content_subtype()

    #define             gsk_http_header_get_content_subtype(header)

Get the minor subtype of the content. Any header which has content SHOULD have a content-subtype.

XXX: need a reference to a list of content types!!!!

`header` : | the header to query.

### gsk_http_header_set_content_subtype()

    #define             gsk_http_header_set_content_subtype(header, content_type)

Set the minor type of the content. Any header which has content SHOULD have a content-subtype.

XXX: need a reference to a list of content types!!!!

`header` : | the header to affect.
`content_type` : | the new content subtype.

### gsk_http_header_set_content_length()

    #define             gsk_http_header_set_content_length(header, len)

Set the indicated length of the content. This may be used for POST and PUT requests as well as most responses.

`header` : | the header to affect.
`len` : | the exact length of the content, in bytes, or -1 if the length cannot be predetermined.

### gsk_http_header_get_content_length()

    #define             gsk_http_header_get_content_length(header)

Get the indicated length of the content. This may be used in POST and PUT requests as well as most responses. If the content has no specified length, or no length is allowed, then -1 is returned.

`header` : | the header to query.

### gsk_http_header_get_content_charset()

    #define             gsk_http_header_get_content_charset(header)

`header` : |

### gsk_http_header_add_accepted_range ()

    void                gsk_http_header_add_accepted_range  (GskHttpHeader *header,
                                                             GskHttpRange range);

`header` : |
`range` : |

### gsk_http_header_add_pragma ()

    void                gsk_http_header_add_pragma          (GskHttpHeader *header,
                                                             const char *pragma);

`header` : |
`pragma` : |

### gsk_http_header_set_content_charset()

    #define             gsk_http_header_set_content_charset(header, content_type)

`header` : |
`content_type` : |

### gsk_http_header_set_range()

    #define             gsk_http_header_set_range(header, start, end)

If retrieving partial content, set the range in bytes of that content.

`header` : | the header to affect.
`start` : | start of the range in bytes.
`end` : | end of the range in bytes.

### gsk_http_header_get_range_start()

    #define             gsk_http_header_get_range_start(header)

If retrieving partial content, get the offset of the first byte to receive.

`header` : | the header to query.

### gsk_http_header_get_range_end()

    #define             gsk_http_header_get_range_end(header)

If retrieving partial content, get the offset of the last byte to receive.

`header` : | the header to query.

### gsk_http_header_set_string ()

    void                gsk_http_header_set_string          (gpointer http_header,
                                                             char **p_str,
                                                             const char *str);

Private function to set a string in a HTTP header. (Currently this uses strdup, but we may eventually switch allocation strategies).

`http_header` : | HTTP header which owns the string.
`p_str` : | pointer to the string's location.
`str` : | string to copy and assign to *`p_str`. (May be NULL)

### gsk_http_header_set_string_val ()

    void                gsk_http_header_set_string_val      (gpointer http_header,
                                                             char **p_str,
                                                             const GValue *value);

Private function to set a string in a HTTP header from a value. This is used from the set_property methods in the various HTTP header class implementations.

`http_header` : | HTTP header which owns the string.
`p_str` : | pointer to the string's location.
`value` : | a value which holds a string.

### gsk_http_header_cut_string ()

    char *              gsk_http_header_cut_string          (gpointer http_header,
                                                             const char *start,
                                                             const char *end);

private. Copy a substring assuming that http_header is responsible for it.

`http_header` : | HTTP header which owns the string.
`start` : | the start of the string
`end` : | immediately past the input string.
Returns : | the NUL-terminated copy of the string between `start` and `end`.

### gsk_http_header_free_string ()

    void                gsk_http_header_free_string         (gpointer http_header,
                                                             char *str);

Deallocate a string allocated with `gsk_http_header_set_string()`, `gsk_http_header_set_string_val()`, `gsk_http_header_cut_string()`.

`http_header` : | HTTP header which owns the string.
`str` : | the string to free.

### gsk_http_header_set_connection_string ()

    void                gsk_http_header_set_connection_string
                                                            (GskHttpHeader *header,
                                                             const char *str);

Change the Connection type reflected in this header.

[From RFC 2616, Section 14.10] The Connection general-header field allows the sender to specify options that are desired for that particular connection and MUST NOT be communicated by proxies over further connections.

`header` : | the HTTP header to affect.
`str` : | connection type, as a string. (The string is exactly the same as that which is found literally in the header.)

### gsk_http_header_set_content_encoding_string ()

    void                gsk_http_header_set_content_encoding_string
                                                            (GskHttpHeader *header,
                                                             const char *str);

Change the Content-Encoding type reflected in this header.

The actual encoding is done transparently by GskHttpClient and GskHttpServer usually. Encoding is only used for POST and PUT requests and any response that has a body (most do). The default is the identity encoding.

`header` : | the HTTP header to affect.
`str` : | content-encoding type, as a string. (The string is exactly the same as that which is found literally in the header.)

### gsk_http_header_set_transfer_encoding_string ()

    void                gsk_http_header_set_transfer_encoding_string
                                                            (GskHttpHeader *header,
                                                             const char *str);

Set the Transfer-Encoding type, as a string.

[From RFC 2616, Section 14.41] The Transfer-Encoding general-header field indicates what (if any) type of transformation has been applied to the message body in order to safely transfer it between the sender and the recipient. This differs from the content-coding in that the transfer-coding is a property of the message, not of the entity.

`header` : | the HTTP header to affect.
`str` : | transfer-encoding type, as a string. (The string is exactly the same as that which is found literally in the header.)

### gsk_http_header_set_version ()

    void                gsk_http_header_set_version         (GskHttpHeader *header,
                                                             gint major,
                                                             gint minor);

Set the major and minor versions; for example, to use HTTP 1.0, one would set `major` to 1, and `minor` to 0.

In addition to setting the version numbers, this function suppresses features not available in the respective http implementations.

Only HTTP 1.0 and 1.1 are supported.

`header` : | the HTTP header to affect.
`major` : | the major HTTP version number.
`minor` : | the minor HTTP version number.

## Property Details

### The `"connection"` property

      "connection"               GskHttpConnection     : Read / Write

The type of connection. See `gsk_http_header_set_connection_type()` for more documentation.

Default value: GSK_HTTP_CONNECTION_NONE

### The `"connection-string"` property

      "connection-string"        gchar*                : Read / Write

The type of connection as a string.

Default value: "close"

### The `"content-charset"` property

      "content-charset"          gchar*                : Read / Write

The character set used for text content.

Default value: NULL

### The `"content-encoding"` property

      "content-encoding"         GskHttpContentEncoding  : Read / Write

The way the content is encoded, see GskHttpConnection for more documentation.

Default value: GSK_HTTP_CONTENT_ENCODING_IDENTITY

### The `"content-encoding-string"` property

      "content-encoding-string"  gchar*                : Read / Write

The way the content is encoded, as a string. Typical values are "identity", "gzip" and "compress".

Default value: "identity"

### The `"content-length"` property

      "content-length"           gint                  : Read / Write

Length of content associated with this header.

Allowed values: >= -1

Default value: -1

### The `"content-subtype"` property

      "content-subtype"          gchar*                : Read / Write

The minor type of content.

Default value: NULL

### The `"content-type"` property

      "content-type"             gchar*                : Read / Write

The major type of content.

Default value: NULL

### The `"date"` property

      "date"                     gint                  : Read / Write

the date of the content of this response.

Allowed values: >= -1

Default value: -1

### The `"major-version"` property

      "major-version"            guint                 : Read / Write

major version number of the HTTP protocol. Always 1.

Allowed values: <= 2

Default value: 1

### The `"minor-version"` property

      "minor-version"            guint                 : Read / Write

minor version number of the HTTP protocol. Always 0 or 1, usually 1, indicating HTTP/1.1.

Allowed values: <= 10

Default value: 1

### The `"range-end"` property

      "range-end"                gint                  : Read / Write

end of the data.

Allowed values: >= -1

Default value: -1

### The `"range-start"` property

      "range-start"              gint                  : Read / Write

beginning of the data.

Allowed values: >= -1

Default value: -1

### The `"transfer-encoding"` property

      "transfer-encoding"        GskHttpTransferEncoding  : Read / Write

type of transfer encoding.

Default value: GSK_HTTP_TRANSFER_ENCODING_NONE

### The `"transfer-encoding-string"` property

      "transfer-encoding-string" gchar*                : Read / Write

type of transfer encoding as string.

Default value: "none"

## See Also

GskHttpRequest, GskHttpResponse