axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stadelmann Josef" <josef.stadelm...@axa-winterthur.ch>
Subject AW: extended "User-Agent" http headers
Date Mon, 06 Dec 2010 07:48:42 GMT
Hi

This is defined at axis2_http_transport.h

    /**
     * HEADER_USER_AGENT_AXIS2C
     */
    #define AXIS2_HTTP_HEADER_USER_AGENT_AXIS2C "User-Agent: Axis2C/" AXIS2_VERSION_STRING


Then at axis2_libcurl.c chech for a definition

#ifdef AXIS2_LIBCURL_ENABLED


And if that AXIS2_LIBCURL_ENABLED  is defined then a bit further down you will find


    headers = curl_slist_append(headers, AXIS2_HTTP_HEADER_USER_AGENT_AXIS2C);


So exchanging AXIS2_HTTP_HEADER_USER_AGENT_AXIS2C with your own string should do the trick.


But I don’t know under which circumstances one has to define for #ifdef AXIS2_LIBCURL_ENABLED


Otherwhise you can find in http_sender.c the opposite of the stuff above

#ifndef AXIS2_LIBCURL_ENABLED
static void
axis2_http_sender_add_header_list(
    axis2_http_simple_request_t * request,
    const axutil_env_t * env,
    axutil_array_list_t * array_list);


And you can find in code how elements of type axis2_http_header are added to a list
And this elements are just made of name value pairs, so there should be apmple space
To exmapd your http headers. But guess, the receiver of a http_header must know what
It shall do with such a header element.



struct axis2_http_header
{
    axis2_char_t *name;
    axis2_char_t *value;
};

AXIS2_EXTERN axis2_http_header_t *AXIS2_CALL
axis2_http_header_create(
    const axutil_env_t * env,
    const axis2_char_t * name,
    const axis2_char_t * value)
{
    axis2_http_header_t *http_header = NULL;
    http_header = (axis2_http_header_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_http_header_t));
    if(!http_header)
    {
        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        return NULL;
    }
    memset((void *)http_header, 0, sizeof(axis2_http_header_t));
    http_header->name = (axis2_char_t *)axutil_strdup(env, name);
    http_header->value = (axis2_char_t *)axutil_strdup(env, value);

    return http_header;
}


Hope it fits your demand.

Josef.Stadelmann
@axa-winterthur.ch





-----Ursprüngliche Nachricht-----
Von: Mahmut Uludag [mailto:uludag@ebi.ac.uk] 
Gesendet: Freitag, 3. Dezember 2010 16:14
An: c-user@axis.apache.org
Betreff: extended "User-Agent" http headers

Hi,

Is it possible to extend the standard Axis2C http header "User-Agent"
when using Axis2C client libraries?

For example, instead of the standard header,

  "User-Agent: Axis2C/1.6.0"

how I can set something similar to the following?

  "User-Agent: ABCD/1.2.3 (Linux) Axis2C/1.6.0"


Thanks

Mahmut Uludag



---------------------------------------------------------------------
To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
For additional commands, e-mail: c-user-help@axis.apache.org

Mime
View raw message