ftpurl.cxx (2f86921c) ftpurl.cxx (72cd26dd)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 398 unchanged lines hidden (view full) ---

407 combi.getLength(), \
408 RTL_TEXTENCODING_UTF8); \
409 curl_easy_setopt(curl, \
410 CURLOPT_USERPWD, \
411 aUserPsswd.getStr())
412
413
414
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 398 unchanged lines hidden (view full) ---

407 combi.getLength(), \
408 RTL_TEXTENCODING_UTF8); \
409 curl_easy_setopt(curl, \
410 CURLOPT_USERPWD, \
411 aUserPsswd.getStr())
412
413
414
415FILE* FTPURL::open()
415oslFileHandle FTPURL::open()
416 throw(curl_exception)
417{
418 if(!m_aPathSegmentVec.size())
419 throw curl_exception(CURLE_FTP_COULDNT_RETR_FILE);
420
421 CURL *curl = m_pFCP->handle();
422
423 SET_CONTROL_CONTAINER;
424 rtl::OUString url(ident(false,true));
425 SET_URL(url);
416 throw(curl_exception)
417{
418 if(!m_aPathSegmentVec.size())
419 throw curl_exception(CURLE_FTP_COULDNT_RETR_FILE);
420
421 CURL *curl = m_pFCP->handle();
422
423 SET_CONTROL_CONTAINER;
424 rtl::OUString url(ident(false,true));
425 SET_URL(url);
426 FILE *res = tmpfile();
427 curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,file_write);
428 curl_easy_setopt(curl,CURLOPT_WRITEDATA,res);
429
426
430 curl_easy_setopt(curl,CURLOPT_POSTQUOTE,0);
431 CURLcode err = curl_easy_perform(curl);
427 oslFileHandle res( NULL );
428 if ( osl_createTempFile( NULL, &res, NULL ) == osl_File_E_None )
429 {
430 curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,file_write);
431 curl_easy_setopt(curl,CURLOPT_WRITEDATA,res);
432
432
433 if(err == CURLE_OK)
434 rewind(res);
435 else {
436 fclose(res),res = 0;
437 throw curl_exception(err);
433 curl_easy_setopt(curl,CURLOPT_POSTQUOTE,0);
434 CURLcode err = curl_easy_perform(curl);
435
436 if(err == CURLE_OK)
437 osl_setFilePos( res, osl_Pos_Absolut, 0 );
438 else {
439 osl_closeFile(res),res = 0;
440 throw curl_exception(err);
441 }
438 }
439
440 return res;
441}
442
443
444std::vector<FTPDirentry> FTPURL::list(
445 sal_Int16 nMode

--- 389 unchanged lines hidden ---
442 }
443
444 return res;
445}
446
447
448std::vector<FTPDirentry> FTPURL::list(
449 sal_Int16 nMode

--- 389 unchanged lines hidden ---