summaryrefslogtreecommitdiff
path: root/extra/bitlbee/msn.patch
blob: 55e2f9b9227013b85f19842fa59d7e452ed12762 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Index: devel/lib/http_client.c
===================================================================
--- devel/lib/http_client.c	(revision devel,783)
+++ devel/lib/http_client.c	(revision devel,824)
@@ -314,5 +314,5 @@
 	}
 	
-	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;
@@ -375,8 +375,11 @@
 			   going to use strcat(), whether you like it or not. :-) */
 			
-			sprintf( new_request, "GET %s HTTP/1.0", url->file );
-			
-			s = strstr( req->request, "\r\n" );
-			if( s == NULL )
+			*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 = ' ';
+			
+			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" );