- Timestamp:
- 2010-07-16T23:31:55Z (14 years ago)
- 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. - Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/http_client.c
r3709301 r4346c3f4 35 35 static gboolean http_ssl_connected( gpointer data, void *source, b_input_condition cond ); 36 36 static 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 ) 37 static void http_free( struct http_request *req ); 38 39 40 struct http_request *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data ) 40 41 { 41 42 struct http_request *req; … … 67 68 req->request = g_strdup( request ); 68 69 req->request_length = strlen( request ); 70 req->redir_ttl = 3; 69 71 70 72 return( req ); 71 73 } 72 74 73 void*http_dorequest_url( char *url_string, http_input_function func, gpointer data )75 struct http_request *http_dorequest_url( char *url_string, http_input_function func, gpointer data ) 74 76 { 75 77 url_t *url = g_new0( url_t, 1 ); … … 311 313 } 312 314 313 if( req->status_code == 301 || req->status_code == 302)315 if( ( req->status_code == 301 || req->status_code == 302 ) && req->redir_ttl-- > 0 ) 314 316 { 315 317 char *loc, *new_request, *new_host; … … 445 447 } 446 448 447 void http_free( struct http_request *req )449 static void http_free( struct http_request *req ) 448 450 { 449 451 g_free( req->request ); -
lib/http_client.h
r3709301 r4346c3f4 61 61 int finished; /* Set to non-0 if the request was completed 62 62 successfully. */ 63 int redir_ttl; /* You can set it to 0 if you don't want 64 http_client to follow them. */ 63 65 64 66 http_input_function func; … … 79 81 you want to add some extra headers. As you can see, HTTPS connections 80 82 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 ); 83 struct http_request *http_dorequest( char *host, int port, int ssl, char *request, http_input_function func, gpointer data ); 84 struct http_request *http_dorequest_url( char *url_string, http_input_function func, gpointer data );
Note: See TracChangeset
for help on using the changeset viewer.