<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.45">
<TITLE>RE: [JDEV] Re: OOB filetransfer negotiation</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>The jabber:iq:oob packets can be used along with the mini-HTTP server</FONT>
<BR><FONT SIZE=2>to ensure that only the intended person downloads the file, even if </FONT>
<BR><FONT SIZE=2>someone is sniffing the Jabber messages.</FONT>
</P>
<P><FONT SIZE=2>Here is the sequence of events that we use when client A wants to </FONT>
<BR><FONT SIZE=2>send client B a file. </FONT>
</P>
<P><FONT SIZE=2>1. Client A starts up its mini-web server, generates a unique URI </FONT>
<BR><FONT SIZE=2>for that file and sends a jabber:iq:oob packet through the Jabber </FONT>
<BR><FONT SIZE=2>server, with the URL for that file.</FONT>
</P>
<P><FONT SIZE=2>2. Client B reads the jabber:iq:oob packet and tries to connect to</FONT>
<BR><FONT SIZE=2>that URL.</FONT>
</P>
<P><FONT SIZE=2>3. Client A's HTTP server gets the new connection and request for that</FONT>
<BR><FONT SIZE=2>URI and sends its HTTP headers back to client B. After sending the </FONT>
<BR><FONT SIZE=2>headers, the HTTP server waits for a response to the original iq </FONT>
<BR><FONT SIZE=2>before sending the file. It waits to make sure that it is client B </FONT>
<BR><FONT SIZE=2>that is trying to download that file.</FONT>
</P>
<P><FONT SIZE=2>4. Client B reads the HTTP headers and sends a jabber:iq:oob with</FONT>
<BR><FONT SIZE=2>a type='result' attribute packet back through the jabber server.</FONT>
<BR><FONT SIZE=2>This tells client A that it has successfully connected and </FONT>
<BR><FONT SIZE=2>successfully requested the file from the web server.</FONT>
</P>
<P><FONT SIZE=2>5. Client A reads the iq result packet from the jabber server and </FONT>
<BR><FONT SIZE=2>proceeds with sending the file through the HTTP server.</FONT>
</P>
<P><FONT SIZE=2>6. Client A shuts down its mini-web server if no more file transfers</FONT>
<BR><FONT SIZE=2>are pending.</FONT>
</P>
<P><FONT SIZE=2>If for some reason client B cannot connect to client A's HTTP server,</FONT>
<BR><FONT SIZE=2>or if client B decides it doesn't want to download the file, then client </FONT>
<BR><FONT SIZE=2>B sends an error as the response to the iq and A rejects any downloading</FONT>
<BR><FONT SIZE=2>from that URI.</FONT>
</P>
<P><FONT SIZE=2>As far as I know, this is the correct way to send files in Jabber and</FONT>
<BR><FONT SIZE=2>ensure that the files go to the right person.</FONT>
</P>
<P><FONT SIZE=2>There was a good discussion jabber:iq:oob about it in November, look </FONT>
<BR><FONT SIZE=2>for the jabber:iq:oob thread.</FONT>
<BR><FONT SIZE=2><A HREF="http://mailman.jabber.org/pipermail/jdev/2000-November/thread.html" TARGET="_blank">http://mailman.jabber.org/pipermail/jdev/2000-November/thread.html</A></FONT>
</P>
<P><FONT SIZE=2>-Robert</FONT>
</P>
<P><FONT SIZE=2>> -----Original Message-----</FONT>
<BR><FONT SIZE=2>> From: Jens Alfke [<A HREF="mailto:jens@mac.com">mailto:jens@mac.com</A>]</FONT>
<BR><FONT SIZE=2>> Sent: Tuesday, August 14, 2001 9:24 AM</FONT>
<BR><FONT SIZE=2>> To: jdev@jabber.org</FONT>
<BR><FONT SIZE=2>> Subject: [JDEV] Re: OOB filetransfer negotiation</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> On Monday, August 13, 2001, at 05:05 PM, Julie wrote:</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> > From my understanding of the descriptions of the two iq </FONT>
<BR><FONT SIZE=2>> tags, they </FONT>
<BR><FONT SIZE=2>> > are used only</FONT>
<BR><FONT SIZE=2>> > to send the URL to the client. The client then goes to the URL to </FONT>
<BR><FONT SIZE=2>> > retrieve the</FONT>
<BR><FONT SIZE=2>> > file. Am I right? Is there anyway to do a direct client-to-client </FONT>
<BR><FONT SIZE=2>> > file transfer?</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Yes — run a tiny HTTP server on the sending client that can </FONT>
<BR><FONT SIZE=2>> deliver the </FONT>
<BR><FONT SIZE=2>> file to the recipient. Then the sender just creates a URL </FONT>
<BR><FONT SIZE=2>> with its own </FONT>
<BR><FONT SIZE=2>> IP address as the host. In my client I use a random port </FONT>
<BR><FONT SIZE=2>> number and also </FONT>
<BR><FONT SIZE=2>> make up a random 64-bit number to put in the URL before the </FONT>
<BR><FONT SIZE=2>> name of the </FONT>
<BR><FONT SIZE=2>> file, just to make it harder for a 3rd party to find the file (unless </FONT>
<BR><FONT SIZE=2>> they intercept the Jabber message, in which case all bets are </FONT>
<BR><FONT SIZE=2>> off.) So </FONT>
<BR><FONT SIZE=2>> the URL I send would look like:</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> <A HREF="http://my.ip.address:randomportnumber/sixteenrandomhexdigits/n" TARGET="_blank">http://my.ip.address:randomportnumber/sixteenrandomhexdigits/n</A></FONT>
<BR><FONT SIZE=2>> ameoffile</FONT>
<BR><FONT SIZE=2>> However, this only works if the receiver can make an HTTP </FONT>
<BR><FONT SIZE=2>> connection to </FONT>
<BR><FONT SIZE=2>> the sender, i.e. the sender is not behind a firewall or NAT.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> --Jens</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> _______________________________________________</FONT>
<BR><FONT SIZE=2>> jdev mailing list</FONT>
<BR><FONT SIZE=2>> jdev@jabber.org</FONT>
<BR><FONT SIZE=2>> <A HREF="http://mailman.jabber.org/listinfo/jdev" TARGET="_blank">http://mailman.jabber.org/listinfo/jdev</A></FONT>
<BR><FONT SIZE=2>> </FONT>
</P>
</BODY>
</HTML>