soc.2008.yahoo: c6eb815e: When acting as a p2p server, send HTTP O...
sulabh at soc.pidgin.im
sulabh at soc.pidgin.im
Sun Mar 1 04:55:33 EST 2009
-----------------------------------------------------------------
Revision: c6eb815e9facc358b7724957f4a8351bc589b43e
Ancestor: d27a0adfd8ba41482c30ce87c25f434d4d7eb3de
Author: sulabh at soc.pidgin.im
Date: 2009-03-01T09:50:59
Branch: im.pidgin.soc.2008.yahoo
URL: http://d.pidgin.im/viewmtn/revision/info/c6eb815e9facc358b7724957f4a8351bc589b43e
Modified files:
libpurple/protocols/yahoo/yahoo_filexfer.c
ChangeLog:
When acting as a p2p server, send HTTP OK after receiving file.
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c 59507b589fd92d79e7e6bb50666f6c3c44ee5962
+++ libpurple/protocols/yahoo/yahoo_filexfer.c 2316c80a95609e01b83e6e6db0e61c9514f89835
@@ -609,6 +609,26 @@ static void yahoo_xfer_cancel_recv(Purpl
xfer->data = NULL;
}
+/* Send HTTP OK after receiving file */
+static void yahoo_p2p_ft_server_send_OK(PurpleXfer *xfer)
+{
+ char *tx = NULL;
+ int written;
+
+ tx = g_strdup_printf("HTTP/1.1 200 OK\r\nContent-Length: 0\r\nContent-Type: application/octet-stream\r\nConnection: close\r\n\r\n");
+ written = write(xfer->fd, tx, strlen(tx));
+
+ if (written < 0 && errno == EAGAIN)
+ written = 0;
+ else if (written <= 0)
+ purple_debug_info("yahoo", "p2p filetransfer: Unable to write HTTP OK");
+
+ /* close connection */
+ close(xfer->fd);
+ xfer->fd = -1;
+ g_free(tx);
+}
+
static void yahoo_xfer_end(PurpleXfer *xfer_old)
{
struct yahoo_xfer_data *xfer_data;
@@ -620,6 +640,10 @@ static void yahoo_xfer_end(PurpleXfer *x
if(xfer_data && xfer_data->version == 15
&& purple_xfer_get_type(xfer_old) == PURPLE_XFER_RECEIVE
&& xfer_data->filename_list) {
+
+ /* Send HTTP OK in case of p2p transfer, when we act as server */
+ if((xfer_data->xfer_url != NULL) && (xfer_old->fd >=0) && (purple_xfer_get_status(xfer_old) == PURPLE_XFER_STATUS_DONE))
+ yahoo_p2p_ft_server_send_OK(xfer_old);
/* removing top of filename & size list completely */
g_free( xfer_data->filename_list->data );
More information about the Commits
mailing list