Changeset 4346c3f4 for lib


Ignore:
Timestamp:
2010-07-16T23:31:55Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e437366
Parents:
3709301 (diff), ef14a83 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merging mainline.

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/http_client.c

    r3709301 r4346c3f4  
    3535static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond );
    3636static gboolean http_incoming_data( gpointer data, int source, b_input_condition cond );
    37 
    38 
    39 void *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data )
     37static void http_free( struct http_request *req );
     38
     39
     40struct http_request *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data )
    4041{
    4142        struct http_request *req;
     
    6768        req->request = g_strdup( request );
    6869        req->request_length = strlen( request );
     70        req->redir_ttl = 3;
    6971       
    7072        return( req );
    7173}
    7274
    73 void *http_dorequest_url( char *url_string, http_input_function func, gpointer data )
     75struct http_request *http_dorequest_url( char *url_string, http_input_function func, gpointer data )
    7476{
    7577        url_t *url = g_new0( url_t, 1 );
     
    311313        }
    312314       
    313         if( req->status_code == 301 || req->status_code == 302 )
     315        if( ( req->status_code == 301 || req->status_code == 302 ) && req->redir_ttl-- > 0 )
    314316        {
    315317                char *loc, *new_request, *new_host;
     
    445447}
    446448
    447 void http_free( struct http_request *req )
     449static void http_free( struct http_request *req )
    448450{
    449451        g_free( req->request );
  • lib/http_client.h

    r3709301 r4346c3f4  
    6161        int finished;           /* Set to non-0 if the request was completed
    6262                                   successfully. */
     63        int redir_ttl;          /* You can set it to 0 if you don't want
     64                                   http_client to follow them. */
    6365       
    6466        http_input_function func;
     
    7981   you want to add some extra headers. As you can see, HTTPS connections
    8082   are also supported (using ssl_client). */
    81 void *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data );
    82 void *http_dorequest_url( char *url_string, http_input_function func, gpointer data );
    83 
    84 void http_free( struct http_request *req );
     83struct http_request *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data );
     84struct http_request *http_dorequest_url( char *url_string, http_input_function func, gpointer data );
Note: See TracChangeset for help on using the changeset viewer.