+2001-08-28 Alex Graveley <alex@ximian.com>
+
+ * src/soup-core/soup-transfer.c (soup_transfer_read_chunk):
+ Rewrite HEX decoding to hopefully be easier to understand and maintain.
+
+ * src/soup-core/soup-message.c (redirect_handler): Don't unref the
+ old context until after we requeue the message using the new
+ context, as we may still have a connection from the old one.
+
2001-08-27 Alex Graveley <alex@ximian.com>
* src/soup-core/soup-auth.c (soup_auth_new_digest): Set the
new_url = soup_message_get_response_header (msg, "Location");
if (new_url) {
- SoupContext *new_ctx = soup_context_get (new_url);
+ SoupContext *new_ctx, *old_ctx;
+
+ new_ctx = soup_context_get (new_url);
if (!new_ctx) return SOUP_ERROR_MALFORMED_HEADER;
- soup_context_unref (msg->context);
+ old_ctx = msg->context;
msg->context = new_ctx;
soup_message_queue (msg,
msg->priv->callback,
msg->priv->user_data);
+
+ soup_context_unref (old_ctx);
}
return SOUP_ERROR_NONE;
/*
* Convert the size of the next chunk from hex
*/
- while ((tolower (*i) >= 'a' && tolower (*i) <= 'f') ||
- (*i >= '0' && *i <= '9'))
- len++, i++;
-
- for (i -= len, j = len - 1; j + 1; i++, j--)
- new_len += (*i > '9') ?
- (tolower (*i) - 0x57) << (4*j) :
- (tolower (*i) - 0x30) << (4*j);
+ while (isxdigit (*i)) {
+ len++;
+ i++;
+ }
+
+ i -= len;
+
+ for (j = len - 1; j + 1; j--) {
+ if (isdigit (*i))
+ new_len += (*i - 0x30) << (4*j);
+ else
+ new_len += (tolower (*i) - 0x57) << (4*j);
+ i++;
+ }
+
+ g_assert (new_len >= 0);
chunk_idx = chunk_idx + chunk_len;
chunk_len = new_len;