On Thu, Jan 19, 2006 at 01:19:41PM +0000, Caolan McNamara wrote: > On Thu, 2006-01-19 at 13:06 +0000, Joe Orton wrote: > > On Wed, Jan 18, 2006 at 05:14:52PM +0100, Christian Fredrik Kalager Schaller wrote: > > > Any chance to have FC5 use the 0.25.x releases of neon instead of > > > 0.24.x? The reason is that there are a relatively critical fix for > > > GStreamer usage of libneon coming in the upcoming 0.25.5 release. > > > While the 0.25.5 release might not make it out before FC5 freezes, > > > at least using 0.25.4 would make the migration painless, while upgrading > > > from 0.24.x to 0.25.x is very pain full (mainly due to OpenOffice using > > > it). > > > > Yeah, really the question is "can someone upgrade OpenOffice to support > > the neon 0.25.x API". I had a brief look at it, but my C++ knowledge > > is... lacking. There are only a couple of places which need to be > > changed, though. > > I took a look a while ago when this first came up, but I'm totally > unfamiliar with neon, and the old api didn't appear to have a trivial > mapping to the new api. > > If there was either an upgrade route from the old neon api to the new > neon api documented somewhere, or a sample substantive program that > successfully moved from old to new api to use as a reference change then > I could probably whack out the needed changes. The NEWS file documents the API changes; the only thing that will affect OO is probably the response header handling changes and one XML function name change. You could use this as an example of what needs to be done from the neon side: I haven't tried to compile this or anything, please excuse the C++: --- ./NeonSession.hxx.neon025 2005-10-18 09:47:16.000000000 +0100 +++ ./NeonSession.hxx 2006-01-19 15:44:39.000000000 +0000 @@ -49,6 +49,12 @@ #include "NeonTypes.hxx" #endif +/* Neon 0.24 compatibility: */ + +typedef void (*ne_header_handler)(void *userdata, const char *value); + +#define ne_xml_valid(p) (!ne_xml_failed(p)) + namespace ucbhelper { class ProxyDecider; } namespace webdav_ucp --- ./NeonHeadRequest.cxx.neon025 2005-09-09 17:11:23.000000000 +0100 +++ ./NeonHeadRequest.cxx 2006-01-19 15:56:19.000000000 +0000 @@ -51,31 +51,20 @@ using namespace webdav_ucp; using namespace com::sun::star; -struct NeonHeadRequestContext +static void process_headers(ne_request *req, + DAVResource * pResource, + const std::vector< ::rtl::OUString > * pHeaderNames) { - DAVResource * pResource; - const std::vector< ::rtl::OUString > * pHeaderNames; + void *cursor = NULL; + const char *name, *value; - NeonHeadRequestContext( DAVResource * p, - const std::vector< ::rtl::OUString > * pHeaders ) - : pResource( p ), pHeaderNames( pHeaders ) {} -}; - -extern "C" void NHR_ResponseHeaderCatcher( void * userdata, - const char * value ) -{ - rtl::OUString aHeader( rtl::OUString::createFromAscii( value ) ); - sal_Int32 nPos = aHeader.indexOf( ':' ); - - if ( nPos != -1 ) - { - rtl::OUString aHeaderName( aHeader.copy( 0, nPos ) ); - - NeonHeadRequestContext * pCtx - = static_cast< NeonHeadRequestContext * >( userdata ); + while ((cursor = ne_response_header_iterate(req, cursor, + &name, &value)) != NULL) { + rtl::OUString aHeaderName( rtl::OUString::createFromAscii( name ) ); + rtl::OUString aHeaderName( rtl::OUString::createFromAscii( value ) ); // Note: Empty vector means that all headers are requested. - bool bIncludeIt = ( pCtx->pHeaderNames->size() == 0 ); + bool bIncludeIt = ( pHeaderNames->size() == 0 ); if ( !bIncludeIt ) { @@ -105,8 +94,7 @@ thePropertyValue.Name = aHeaderName; thePropertyValue.State = beans::PropertyState_DIRECT_VALUE; - if ( nPos < aHeader.getLength() ) - thePropertyValue.Value <<= aHeader.copy( nPos + 1 ).trim(); + thePropertyValue.Value = aHeaderValue; // Add the newly created PropertyValue pCtx->pResource->properties.push_back( thePropertyValue ); @@ -137,11 +125,10 @@ inPath, RTL_TEXTENCODING_UTF8 ) ); - NeonHeadRequestContext aCtx( &ioResource, &inHeaderNames ); - ne_add_response_header_catcher( req, NHR_ResponseHeaderCatcher, &aCtx ); - nError = ne_request_dispatch( req ); + process_headers(req, ioResource, inHeaderNames); + if ( nError == NE_OK && ne_get_status( req )->klass != 2 ) nError = NE_ERROR; --- ./NeonSession.cxx.neon025 2005-10-18 09:47:02.000000000 +0100 +++ ./NeonSession.cxx 2006-01-19 15:42:41.000000000 +0000 @@ -217,7 +217,7 @@ // ResponseBlockReader // A simple Neon response_block_reader for use with an XInputStream // ------------------------------------------------------------------- -extern "C" void NeonSession_ResponseBlockReader( void * inUserData, +extern "C" int NeonSession_ResponseBlockReader( void * inUserData, const char * inBuf, size_t inLen ) { @@ -237,6 +237,8 @@ xInputStream->AddToStream( inBuf, inLen ); } } + + return 0; } // ------------------------------------------------------------------- @@ -1522,6 +1524,21 @@ } */ +static run_header_handler(ne_request *req, ne_header_handler handler, void *userdata) +{ + void *cursor = NULL; + const char *name, *value; + + while ((cursor = ne_response_header_iterate(req, cursor, + &name, &value)) != NULL) { + const char buffer[8192]; + + ne_snprintf(buffer, sizeof buffer, "%s: %s", name, value); + + handler(userdata, buffer); + } +} + // ------------------------------------------------------------------- // static int NeonSession::GET( ne_session * sess, @@ -1534,12 +1551,12 @@ ne_request * req = ne_request_create( sess, "GET", uri ); int ret; - ne_add_response_header_catcher( req, handler, userdata ); - ne_add_response_body_reader( req, ne_accept_2xx, reader, userdata ); ret = ne_request_dispatch( req ); + run_header_handler(req, handler); + if ( ret == NE_OK && ne_get_status( req )->klass != 2 ) ret = NE_ERROR; -- fedora-devel-list mailing list fedora-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-devel-list