mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Owncloud: Add support for sending a cookie
This commit is contained in:
parent
ea14dc1a75
commit
d74c81feee
1 changed files with 13 additions and 3 deletions
|
@ -507,7 +507,7 @@ static void request_created_hook(ne_request *req, void *userdata,
|
|||
if( !req ) return;
|
||||
|
||||
if(dav_session.session_key) {
|
||||
/* DEBUG_WEBDAV("Setting PHPSESSID to %s", dav_session.session_key); */
|
||||
DEBUG_WEBDAV("Setting PHPSESSID to %s", dav_session.session_key);
|
||||
ne_add_request_header(req, "Cookie", dav_session.session_key);
|
||||
}
|
||||
|
||||
|
@ -603,8 +603,6 @@ static int dav_connect(const char *base_url) {
|
|||
/* Hook called when a request is built. It sets the PHPSESSID header */
|
||||
ne_hook_create_request( dav_session.ctx, request_created_hook, NULL );
|
||||
|
||||
dav_session.session_key = NULL;
|
||||
|
||||
/* Proxy support */
|
||||
proxystate = configureProxy( dav_session.ctx );
|
||||
if( proxystate < 0 ) {
|
||||
|
@ -2071,8 +2069,20 @@ csync_vio_method_t *vio_module_init(const char *method_name, const char *args,
|
|||
_authcb = cb;
|
||||
_connected = 0; /* triggers dav_connect to go through the whole neon setup */
|
||||
|
||||
dav_session.session_key = NULL;
|
||||
|
||||
if( userdata ) {
|
||||
userdata_ptr = userdata;
|
||||
if( *userdata_ptr && strlen( *userdata_ptr) && 0 == strcmp(*userdata_ptr, "Cookie=")) {
|
||||
userdata_ptr++;
|
||||
char *cookie = *userdata_ptr;
|
||||
DEBUG_WEBDAV("Will use cookie given to us: %s", cookie);
|
||||
userdata_ptr++;
|
||||
dav_session.session_key = c_strdup( cookie );
|
||||
} else {
|
||||
DEBUG_WEBDAV("No cookie given to us %s", *userdata_ptr);
|
||||
}
|
||||
|
||||
if( *userdata_ptr && strlen( *userdata_ptr) )
|
||||
dav_session.proxy_type = c_strdup( *userdata_ptr );
|
||||
userdata_ptr++;
|
||||
|
|
Loading…
Reference in a new issue