1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 /**************************************************************************
22 **************************************************************************
24 *************************************************************************/
25 #include "ftploaderthread.hxx"
31 /********************************************************************************/
33 /* cleanup function for thread specific data */
35 /********************************************************************************/
42 int memory_write_dummy(void *,size_t,size_t,void *)
47 void delete_CURL(void *pData
)
49 // Otherwise response for QUIT will be sent to already destroyed
50 // MemoryContainer via non-dummy memory_write function.
51 curl_easy_setopt(static_cast<CURL
*>(pData
),
52 CURLOPT_HEADERFUNCTION
,
54 curl_easy_cleanup(static_cast<CURL
*>(pData
));
62 /********************************************************************************/
64 /* Member part of FTPLoaderThread */
66 /********************************************************************************/
69 FTPLoaderThread::FTPLoaderThread()
70 : m_threadKey(osl_createThreadKey(delete_CURL
)) {
75 FTPLoaderThread::~FTPLoaderThread() {
76 osl_destroyThreadKey(m_threadKey
);
81 CURL
* FTPLoaderThread::handle() {
82 CURL
* ret
= osl_getThreadKeyData(m_threadKey
);
84 ret
= curl_easy_init();
86 // Make sure curl is not internally using environment variables like
88 if (curl_easy_setopt(ret
, CURLOPT_PROXY
, "") != CURLE_OK
) {
89 curl_easy_cleanup(ret
);
93 osl_setThreadKeyData(m_threadKey
,static_cast<void*>(ret
));
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */