Changeset 0790644


Ignore:
Timestamp:
2006-05-17T13:15:20Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
266fe2f
Parents:
5a348c3
Message:

Added http_dorequest_url().

Location:
protocols
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/http_client.c

    r5a348c3 r0790644  
    6969       
    7070        return( req );
     71}
     72
     73void *http_dorequest_url( char *url_string, http_input_function func, gpointer data )
     74{
     75        url_t *url = g_new0( url_t, 1 );
     76        char *request;
     77        void *ret;
     78       
     79        if( !url_set( url, url_string ) )
     80        {
     81                g_free( url );
     82                return NULL;
     83        }
     84       
     85        if( url->proto != PROTO_HTTP && url->proto != PROTO_HTTPS )
     86        {
     87                g_free( url );
     88                return NULL;
     89        }
     90       
     91        request = g_strdup_printf( "GET %s HTTP/1.0\r\n"
     92                                   "Host: %s\r\n"
     93                                   "User-Agent: BitlBee " BITLBEE_VERSION "\r\n"
     94                                   "\r\n", url->file, url->host );
     95       
     96        ret = http_dorequest( url->host, url->port,
     97                              url->proto == PROTO_HTTPS, request, func, data );
     98       
     99        g_free( url );
     100        g_free( request );
     101        return NULL;
    71102}
    72103
  • protocols/http_client.h

    r5a348c3 r0790644  
    5353
    5454void *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data );
     55void *http_dorequest_url( char *url_string, http_input_function func, gpointer data );
Note: See TracChangeset for help on using the changeset viewer.