View | Details | Raw Unified | Return to bug 116762
Collapse All | Expand All

(-)libsoup/soup-connection-ntlm.c (-2 / +17 lines)
Lines 28-34 Link Here
28
} SoupConnectionNTLMState;
28
} SoupConnectionNTLMState;
29
29
30
typedef struct {
30
typedef struct {
31
	char *user;
32
	guchar nt_hash[21], lm_hash[21];
31
	guchar nt_hash[21], lm_hash[21];
33
	SoupConnectionNTLMState state;
32
	SoupConnectionNTLMState state;
34
} SoupConnectionNTLMPrivate;
33
} SoupConnectionNTLMPrivate;
Lines 56-62 Link Here
56
{
55
{
57
	SoupConnectionNTLMPrivate *priv = SOUP_CONNECTION_NTLM_GET_PRIVATE (object);
56
	SoupConnectionNTLMPrivate *priv = SOUP_CONNECTION_NTLM_GET_PRIVATE (object);
58
57
59
	g_free (priv->user);
60
	memset (priv->nt_hash, 0, sizeof (priv->nt_hash));
58
	memset (priv->nt_hash, 0, sizeof (priv->nt_hash));
61
	memset (priv->lm_hash, 0, sizeof (priv->lm_hash));
59
	memset (priv->lm_hash, 0, sizeof (priv->lm_hash));
62
60
Lines 87-92 Link Here
87
	char *username, *domain_username = NULL, *password = NULL;
85
	char *username, *domain_username = NULL, *password = NULL;
88
	char *slash, *domain;
86
	char *slash, *domain;
89
87
88
	printf ("@@@ ntlm_authorize_pre on %p for %p, state %d\n",
89
		ntlm, msg, priv->state);
90
90
	if (priv->state > SOUP_CONNECTION_NTLM_SENT_REQUEST) {
91
	if (priv->state > SOUP_CONNECTION_NTLM_SENT_REQUEST) {
91
		/* We already authenticated, but then got another 401.
92
		/* We already authenticated, but then got another 401.
92
		 * That means "permission denied", so don't try to
93
		 * That means "permission denied", so don't try to
Lines 150-155 Link Here
150
	 * to do Basic auth too.
151
	 * to do Basic auth too.
151
	 */
152
	 */
152
	soup_message_remove_header (msg->response_headers, "WWW-Authenticate");
153
	soup_message_remove_header (msg->response_headers, "WWW-Authenticate");
154
	printf ("@@@ ntlm_authorize_pre on %p: new state is %d\n",
155
		ntlm, priv->state);
153
}
156
}
154
157
155
static void
158
static void
Lines 161-168 Link Here
161
	    soup_message_get_header (msg->request_headers, "Authorization")) {
164
	    soup_message_get_header (msg->request_headers, "Authorization")) {
162
		/* We just added the last Auth header, so restart it. */
165
		/* We just added the last Auth header, so restart it. */
163
		priv->state = SOUP_CONNECTION_NTLM_SENT_RESPONSE;
166
		priv->state = SOUP_CONNECTION_NTLM_SENT_RESPONSE;
167
168
		/* soup_message_restarted() will call soup_message_io_stop(),
169
		 * which will release the connection, and may cause another
170
		 * message to be queued on the connection before it returns.
171
		 * That's no good, so we stop the message first and then
172
		 * reclaim the connection so that soup_message_restarted()
173
		 * won't be able to steal it.
174
		 */
175
		printf ("@@@ ntlm_authorize_post on %p...\n", conn);
176
		soup_message_io_stop (msg);
177
		soup_connection_reserve (conn);
164
		soup_message_restarted (msg);
178
		soup_message_restarted (msg);
165
		soup_connection_send_request (conn, msg);
179
		soup_connection_send_request (conn, msg);
180
		printf ("@@@ ntlm_authorize_post on %p complete\n", conn);
166
	}
181
	}
167
}
182
}
168
183
(-)libsoup/soup-connection.c (-4 / +20 lines)
Lines 89-94 Link Here
89
{
89
{
90
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (object);
90
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (object);
91
91
92
	printf ("@@@ finalizing connection %p\n", object);
93
92
	if (priv->proxy_uri)
94
	if (priv->proxy_uri)
93
		soup_uri_free (priv->proxy_uri);
95
		soup_uri_free (priv->proxy_uri);
94
	if (priv->origin_uri)
96
	if (priv->origin_uri)
Lines 105-110 Link Here
105
{
107
{
106
	SoupConnection *conn = SOUP_CONNECTION (object);
108
	SoupConnection *conn = SOUP_CONNECTION (object);
107
109
110
	printf ("@@@ disposing connection %p\n", object);
111
108
	clear_current_request (conn);
112
	clear_current_request (conn);
109
	soup_connection_disconnect (conn);
113
	soup_connection_disconnect (conn);
110
114
Lines 354-368 Link Here
354
{
358
{
355
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);
359
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);
356
360
361
	printf ("@@@ clear_current_request(%p) [was %p]\n", conn, priv->cur_req);
362
357
	if (priv->cur_req) {
363
	if (priv->cur_req) {
358
		if (!soup_message_is_keepalive (priv->cur_req))
364
		SoupMessage *cur_req = priv->cur_req;
359
			soup_connection_disconnect (conn);
360
		else
361
			priv->last_used = time (NULL);
362
365
363
		g_object_remove_weak_pointer (G_OBJECT (priv->cur_req),
366
		g_object_remove_weak_pointer (G_OBJECT (priv->cur_req),
364
					      (gpointer *)&priv->cur_req);
367
					      (gpointer *)&priv->cur_req);
365
		priv->cur_req = NULL;
368
		priv->cur_req = NULL;
369
370
		if (!soup_message_is_keepalive (cur_req))
371
			soup_connection_disconnect (conn);
372
		else {
373
			priv->last_used = time (NULL);
374
			soup_message_io_stop (cur_req);
375
		}
366
	}
376
	}
367
	priv->in_use = FALSE;
377
	priv->in_use = FALSE;
368
}
378
}
Lines 606-611 Link Here
606
{
616
{
607
	SoupConnectionPrivate *priv;
617
	SoupConnectionPrivate *priv;
608
618
619
	printf ("@@@ soup_connection_disconnect(%p)\n", conn);
620
609
	g_return_if_fail (SOUP_IS_CONNECTION (conn));
621
	g_return_if_fail (SOUP_IS_CONNECTION (conn));
610
	priv = SOUP_CONNECTION_GET_PRIVATE (conn);
622
	priv = SOUP_CONNECTION_GET_PRIVATE (conn);
611
623
Lines 706-711 Link Here
706
{
718
{
707
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);
719
	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);
708
720
721
	printf ("@@@ send_request(conn %p, msg %p). cur_req was %p\n",
722
		conn, req, priv->cur_req);
709
	if (req != priv->cur_req) {
723
	if (req != priv->cur_req) {
710
		set_current_request (priv, req);
724
		set_current_request (priv, req);
711
		if (priv->filter)
725
		if (priv->filter)
Lines 748-753 Link Here
748
{
762
{
749
	g_return_if_fail (SOUP_IS_CONNECTION (conn));
763
	g_return_if_fail (SOUP_IS_CONNECTION (conn));
750
764
765
	printf ("@@@ soup_connection_reserve (%p)\n", conn);
751
	SOUP_CONNECTION_GET_PRIVATE (conn)->in_use = TRUE;
766
	SOUP_CONNECTION_GET_PRIVATE (conn)->in_use = TRUE;
752
}
767
}
753
768
Lines 764-769 Link Here
764
{
779
{
765
	g_return_if_fail (SOUP_IS_CONNECTION (conn));
780
	g_return_if_fail (SOUP_IS_CONNECTION (conn));
766
781
782
	printf ("@@@ soup_connection_release (%p)\n", conn);
767
	clear_current_request (conn);
783
	clear_current_request (conn);
768
}
784
}
769
785
(-)libsoup/soup-message-io.c (-2 / +6 lines)
Lines 128-135 Link Here
128
128
129
	if (io->read_state != SOUP_MESSAGE_IO_STATE_DONE)
129
	if (io->read_state != SOUP_MESSAGE_IO_STATE_DONE)
130
		soup_socket_disconnect (io->sock);
130
		soup_socket_disconnect (io->sock);
131
	else if (io->conn)
131
	else if (io->conn) {
132
		soup_connection_release (io->conn);
132
		SoupConnection *conn = io->conn;
133
		io->conn = NULL;
134
		soup_connection_release (conn);
135
		g_object_unref (conn);
136
	}
133
}
137
}
134
138
135
#define SOUP_MESSAGE_IO_EOL            "\r\n"
139
#define SOUP_MESSAGE_IO_EOL            "\r\n"
(-)libsoup/soup-session.c (-1 / +17 lines)
Lines 961-970 Link Here
961
		g_object_ref (oldest);
961
		g_object_ref (oldest);
962
		g_mutex_unlock (priv->host_lock);
962
		g_mutex_unlock (priv->host_lock);
963
		soup_connection_disconnect (oldest);
963
		soup_connection_disconnect (oldest);
964
		printf ("@@@ soup_session_try_prune_connection(%p) pruned %p\n", session, oldest);
964
		g_object_unref (oldest);
965
		g_object_unref (oldest);
965
		return TRUE;
966
		return TRUE;
966
	} else {
967
	} else {
967
		g_mutex_unlock (priv->host_lock);
968
		g_mutex_unlock (priv->host_lock);
969
		printf ("@@@ soup_session_try_prune_connection(%p) failed\n", session);
968
		return FALSE;
970
		return FALSE;
969
	}
971
	}
970
}
972
}
Lines 1101-1116 Link Here
1101
	g_mutex_lock (priv->host_lock);
1103
	g_mutex_lock (priv->host_lock);
1102
1104
1103
	host = get_host_for_message (session, msg);
1105
	host = get_host_for_message (session, msg);
1106
	printf ("@@@ soup_session_get_connection(%p, %p [%s:%d])\n",
1107
		session, msg, host->root_uri->host, host->root_uri->port);
1108
1104
	for (conns = host->connections; conns; conns = conns->next) {
1109
	for (conns = host->connections; conns; conns = conns->next) {
1105
		if (!soup_connection_is_in_use (conns->data)) {
1110
		if (!soup_connection_is_in_use (conns->data)) {
1111
			printf ("@@@   reserving connection %p\n", conns->data);
1106
			soup_connection_reserve (conns->data);
1112
			soup_connection_reserve (conns->data);
1107
			g_mutex_unlock (priv->host_lock);
1113
			g_mutex_unlock (priv->host_lock);
1108
			*is_new = FALSE;
1114
			*is_new = FALSE;
1109
			return conns->data;
1115
			return conns->data;
1110
		}
1116
		} else
1117
			printf ("@@@   connection %p is busy\n", conns->data);
1111
	}
1118
	}
1112
1119
1113
	if (msg->status == SOUP_MESSAGE_STATUS_CONNECTING) {
1120
	if (msg->status == SOUP_MESSAGE_STATUS_CONNECTING) {
1121
		printf ("@@@   No connection available, but msg status is CONNECTING\n");
1114
		/* We already started a connection for this
1122
		/* We already started a connection for this
1115
		 * message, so don't start another one.
1123
		 * message, so don't start another one.
1116
		 */
1124
		 */
Lines 1119-1129 Link Here
1119
	}
1127
	}
1120
1128
1121
	if (host->num_conns >= priv->max_conns_per_host) {
1129
	if (host->num_conns >= priv->max_conns_per_host) {
1130
		printf ("@@@   No connection available and can't open new connection to host\n");
1122
		g_mutex_unlock (priv->host_lock);
1131
		g_mutex_unlock (priv->host_lock);
1123
		return NULL;
1132
		return NULL;
1124
	}
1133
	}
1125
1134
1126
	if (priv->num_conns >= priv->max_conns) {
1135
	if (priv->num_conns >= priv->max_conns) {
1136
		printf ("@@@   No connection available and can't open new connection\n");
1127
		*try_pruning = TRUE;
1137
		*try_pruning = TRUE;
1128
		g_mutex_unlock (priv->host_lock);
1138
		g_mutex_unlock (priv->host_lock);
1129
		return NULL;
1139
		return NULL;
Lines 1157-1162 Link Here
1157
			  session);
1167
			  session);
1158
1168
1159
	g_hash_table_insert (priv->conns, conn, host);
1169
	g_hash_table_insert (priv->conns, conn, host);
1170
	printf ("@@@   Created new connection %p\n", conn);
1160
1171
1161
	/* We increment the connection counts so it counts against the
1172
	/* We increment the connection counts so it counts against the
1162
	 * totals, but we don't add it to the host's connection list
1173
	 * totals, but we don't add it to the host's connection list
Lines 1183-1188 Link Here
1183
	if (!SOUP_MESSAGE_IS_STARTING (msg)) {
1194
	if (!SOUP_MESSAGE_IS_STARTING (msg)) {
1184
		soup_message_queue_remove_message (session->queue, msg);
1195
		soup_message_queue_remove_message (session->queue, msg);
1185
		g_signal_handlers_disconnect_by_func (msg, message_finished, session);
1196
		g_signal_handlers_disconnect_by_func (msg, message_finished, session);
1197
		printf ("@@@ message_finished(%p)\n", msg);
1186
	}
1198
	}
1187
}
1199
}
1188
1200
Lines 1227-1232 Link Here
1227
	g_return_if_fail (SOUP_IS_SESSION (session));
1239
	g_return_if_fail (SOUP_IS_SESSION (session));
1228
	g_return_if_fail (SOUP_IS_MESSAGE (msg));
1240
	g_return_if_fail (SOUP_IS_MESSAGE (msg));
1229
1241
1242
	printf ("@@@ soup_session_queue_message(%p, %p)\n", session, msg);
1230
	SOUP_SESSION_GET_CLASS (session)->queue_message (session, msg,
1243
	SOUP_SESSION_GET_CLASS (session)->queue_message (session, msg,
1231
							 callback, user_data);
1244
							 callback, user_data);
1232
}
1245
}
Lines 1251-1256 Link Here
1251
	g_return_if_fail (SOUP_IS_SESSION (session));
1264
	g_return_if_fail (SOUP_IS_SESSION (session));
1252
	g_return_if_fail (SOUP_IS_MESSAGE (msg));
1265
	g_return_if_fail (SOUP_IS_MESSAGE (msg));
1253
1266
1267
	printf ("@@@ soup_session_REqueue_message(%p, %p)\n", session, msg);
1254
	SOUP_SESSION_GET_CLASS (session)->requeue_message (session, msg);
1268
	SOUP_SESSION_GET_CLASS (session)->requeue_message (session, msg);
1255
}
1269
}
1256
1270
Lines 1274-1279 Link Here
1274
	g_return_val_if_fail (SOUP_IS_SESSION (session), SOUP_STATUS_MALFORMED);
1288
	g_return_val_if_fail (SOUP_IS_SESSION (session), SOUP_STATUS_MALFORMED);
1275
	g_return_val_if_fail (SOUP_IS_MESSAGE (msg), SOUP_STATUS_MALFORMED);
1289
	g_return_val_if_fail (SOUP_IS_MESSAGE (msg), SOUP_STATUS_MALFORMED);
1276
1290
1291
	printf ("@@@ soup_session_send_message(%p, %p)\n", session, msg);
1277
	return SOUP_SESSION_GET_CLASS (session)->send_message (session, msg);
1292
	return SOUP_SESSION_GET_CLASS (session)->send_message (session, msg);
1278
}
1293
}
1279
1294
Lines 1300-1305 Link Here
1300
	g_return_if_fail (SOUP_IS_SESSION (session));
1315
	g_return_if_fail (SOUP_IS_SESSION (session));
1301
	g_return_if_fail (SOUP_IS_MESSAGE (msg));
1316
	g_return_if_fail (SOUP_IS_MESSAGE (msg));
1302
1317
1318
	printf ("@@@ soup_session_cancel_message(%p, %p)\n", session, msg);
1303
	SOUP_SESSION_GET_CLASS (session)->cancel_message (session, msg);
1319
	SOUP_SESSION_GET_CLASS (session)->cancel_message (session, msg);
1304
}
1320
}
1305
1321

Return to bug 116762