You might want to take a look at the xmlsec/libxml2 sources. All the http/ftp/file protocol handlers included in the libraries are done exactly in the same way. Aleksey