Changeset dd7b931


Ignore:
Timestamp:
2013-06-16T00:14:11Z (11 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
ab19567
Parents:
777461b
Message:

Use HTTP/1.1 by default in the Twitter module, and stick to the initially
used protocol version when internally handling redirects.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/http_client.c

    r777461b rdd7b931  
    536536                        /* A whole URL */
    537537                        url_t *url;
    538                         char *s;
     538                        char *s, *version, *headers;
    539539                        const char *new_method;
    540540                       
     
    564564                                return TRUE;
    565565                        }
     566                        headers = s;
    566567                       
    567568                        /* More or less HTTP/1.0 compliant, from my reading of RFC 2616.
     
    583584                                new_method = "POST";
    584585                       
     586                        if( ( version = strstr( req->request, " HTTP/" ) ) &&
     587                            ( s = strstr( version, "\r\n" ) ) )
     588                        {
     589                                version ++;
     590                                version = g_strndup( version, s - version );
     591                        }
     592                        else
     593                                version = g_strdup( "HTTP/1.0" );
     594                       
    585595                        /* Okay, this isn't fun! We have to rebuild the request... :-( */
    586                         new_request = g_strdup_printf( "%s %s HTTP/1.1\r\nHost: %s%s",
    587                                                        new_method, url->file, url->host, s );
     596                        new_request = g_strdup_printf( "%s %s %s\r\nHost: %s%s",
     597                                                       new_method, url->file, version,
     598                                                       url->host, headers );
    588599                       
    589600                        new_host = g_strdup( url->host );
     
    597608                       
    598609                        g_free( url );
     610                        g_free( version );
    599611                }
    600612               
  • protocols/twitter/twitter_http.c

    r777461b rdd7b931  
    7878       
    7979        // Make the request.
    80         g_string_printf(request, "%s %s%s%s%s HTTP/1.0\r\n"
     80        g_string_printf(request, "%s %s%s%s%s HTTP/1.1\r\n"
    8181                        "Host: %s\r\n"
    8282                        "User-Agent: BitlBee " BITLBEE_VERSION " " ARCH "/" CPU "\r\n",
Note: See TracChangeset for help on using the changeset viewer.