aboutsummaryrefslogtreecommitdiffstats
path: root/lib/http_client.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2011-11-12 23:49:52 +0800
committerWilmer van der Gaast <wilmer@gaast.net>2011-11-12 23:49:52 +0800
commitdff732d93799db858a5728abbf31d2e6274b8425 (patch)
treec7f61eccdb8584b4d2784656883725dc08768ecd /lib/http_client.c
parentdac74bdcfcc358cd59a318e34a54a3b17ebf3459 (diff)
Undoing old workaround for MSN troubles and added more proper fix. The
http_client module needs some refactoring though. Will do that later.. This should hopefully fix bug #850.
Diffstat (limited to 'lib/http_client.c')
-rw-r--r--lib/http_client.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/http_client.c b/lib/http_client.c
index 8b045414..f535f13f 100644
--- a/lib/http_client.c
+++ b/lib/http_client.c
@@ -313,7 +313,7 @@ got_reply:
req->status_code = -1;
}
- if( ( req->status_code == 301 || req->status_code == 302 ) && req->redir_ttl-- > 0 )
+ if( ( req->status_code >= 301 && req->status_code <= 303 ) && req->redir_ttl-- > 0 )
{
char *loc, *new_request, *new_host;
int error = 0, new_port, new_proto;
@@ -374,10 +374,13 @@ got_reply:
/* So, now I just allocated enough memory, so I'm
going to use strcat(), whether you like it or not. :-) */
- sprintf( new_request, "GET %s HTTP/1.0", url->file );
+ *s = 0;
+ sprintf( new_request, "%s %s HTTP/1.0\r\nHost: %s",
+ req->status_code == 303 || req->request[0] == 'G' ? "GET" : "POST", url->file, url->host );
+ *s = ' ';
- s = strstr( req->request, "\r\n" );
- if( s == NULL )
+ if( !( ( s = strstr( req->request, "\r\nHost: " ) ) &&
+ ( s = strstr( s + strlen( "\r\nHost: " ), "\r\n" ) ) ) )
{
req->status_string = g_strdup( "Error while rebuilding request string" );
g_free( new_request );