using WebDav with BLIP

4 views
Skip to first unread message

Jimmy Reza

unread,
Dec 11, 2008, 7:06:28 PM12/11/08
to BLIP Protocol
hiya
so many new iPhone apps (Net Sharing..etc) have a webdav http in their
applications
but haven't figured out how they accomplish this.. ie: a webserver to
host the webdav protocol..
I want to try to use BLIP with a webdav server for the iPhone..
any thoughts on how to do the webdav part?

thanks
turin

Jens Alfke

unread,
Dec 11, 2008, 7:23:49 PM12/11/08
to Jimmy Reza, BLIP Protocol

On Dec 11, 2008, at 4:06 PM, Jimmy Reza wrote:

> so many new iPhone apps (Net Sharing..etc) have a webdav http in their
> applications
> but haven't figured out how they accomplish this.. ie: a webserver to
> host the webdav protocol..

So, WebDAV is an extension of HTTP that adds a few new methods and
behaviors. What are those apps using it for? The most common use of
WebDAV on Macs is for file sharing (that's how .mac iDisks work) even
though it's not strictly intended as a file-server protocol.

There isn't any support in the system frameworks for running an HTTP
server. You can use MYNetwork's TCPListener and TCPConnection to
handle the sockets, and CFHTTPMessage can help with parsing of HTTP
headers, but the rest of the work has to be done yourself.

Have you checked whether there's any 3rd party Cocoa library for
running an HTTP or WebDAV server?

> I want to try to use BLIP with a webdav server for the iPhone..
> any thoughts on how to do the webdav part?

BLIP isn't HTTP or WebDAV, so those classes won't help.

WebDAV would be useful for interoperability with other clients that
use it, like the file-sharing client in Mac OS. If you want to
communicate between two apps that you're developing, why not just use
BLIP instead?

—Jens

Jimmy Reza

unread,
Dec 11, 2008, 7:37:05 PM12/11/08
to blip-p...@googlegroups.com
it's mainly for filesharing.. like Air Sharing..
not sure how they do it then... like Air share. you can map the iPhone as
a network drive on the mac using http://myphone.iphone:8080/ or
something like that
they must be using a built in webserver .. if not i was thinking of
doing something
with MyNetwork to open up a port ..

the reason i haven't tried to use BLIp for filesharing is i have yet
to figure out
how to piece a file together when i transmit it over BLIP.. i know
there is a counter.etc..
was just tyring to send a JPEG or something but couldnt get it work over BLIP.
probably my lack of understanding ..

turin

Jonathan Wight

unread,
Dec 11, 2008, 7:45:32 PM12/11/08
to Jimmy Reza, blip-p...@googlegroups.com
AirSharing hosts a WebDAV server. I'm working on an open source WebDAV
server as part of TouchHTTP should be able to release it soon(ish).

Jon.

Jens Alfke

unread,
Dec 11, 2008, 7:51:41 PM12/11/08
to Jimmy Reza, blip-p...@googlegroups.com

On Dec 11, 2008, at 4:36 PM, Jimmy Reza wrote:

it's mainly for filesharing.. like Air Sharing..
not sure how they do it then... like Air share. you can map the iPhone as
a network drive on the mac using http://myphone.iphone:8080/ or
something like that

I looked at their website and it says they use WebDAV. Makes sense.


the reason i haven't tried to use BLIp for filesharing is i have yet
to figure out
how to piece a file together when i transmit it over BLIP.. i know
there is a counter.etc..

Well, in the protocol a large message is broken into pieces, but if you're using the API you don't have to deal with that. You just send and receive messages of arbitrary size and let the library do the work.


was just tyring to send a JPEG or something but couldnt get it work over BLIP.
probably my lack of understanding ..

It's pretty easy. On the server side, when you get a request for a file, figure out what local file it is (maybe there's a path in a property of the request), then read the file into an NSData and set that as the body of the reply. Store any metadata you need to send (like the mod date) in properties of the reply message.

On the client side, send a request for the file, then when the response arrives get the body and save it to disk. Get the metadata from the properties of the reply and set them on the file using NSFileManager.

Two caveats:
* This isn't going to be very efficient for huge files, because both the server and client end up putting the entire file into RAM. (On the server you can improve this by using the NSMappedRead option when you create the NSData.) This could be dangerous on the iPhone because its RAM is so limited.
* If you need to transfer entire directories, you'll need to come up with some mechanism of sending all the files one after the other in multiple requests. You might implement a "list directory" command on the server, so the client can send a request and get back the names of all the files, and then it can fetch them one after the other.

—Jens

Jonathan Wight

unread,
Dec 11, 2008, 7:50:51 PM12/11/08
to Jimmy Reza, blip-p...@googlegroups.com
AirSharing hosts a WebDAV server. I'm working on an open source WebDAV
server as part of TouchHTTP should be able to release it soon(ish).

Jon.

On Dec 11, 2008, at 7:37 PM, Jimmy Reza wrote:

>

Jimmy Reza

unread,
Dec 11, 2008, 8:40:46 PM12/11/08
to Jens Alfke, blip-p...@googlegroups.com
Kewl. i 'll try that!

what is the url for the open source TouchHTTP?
that is great news!!

now. if only the Keychain.framework world compile into the iPhone
the IPhone would be unstoppable!

turin

Reply all
Reply to author
Forward
0 new messages