obfuscate all email addresses
This commit is contained in:
parent
97e8a179e7
commit
5edccf775d
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file thttp_event.h
|
||||
* @brief HTTP/HTTPS event.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file thttp_event.h
|
||||
* @brief HTTP/HTTPS event.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#ifndef TINYHTTP_EVENT_H
|
||||
#define TINYHTTP_EVENT_H
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -34,50 +34,50 @@
|
|||
|
||||
#include "tnet_types.h"
|
||||
|
||||
#include "tsk_object.h"
|
||||
#include "tsk_list.h"
|
||||
#include "tsk_object.h"
|
||||
#include "tsk_list.h"
|
||||
#include "tsk_params.h"
|
||||
#include "tsk_fsm.h"
|
||||
|
||||
THTTP_BEGIN_DECLS
|
||||
|
||||
//FD
|
||||
struct thttp_message_s;
|
||||
|
||||
#define THTTP_OPERATION_CREATE(stack, ...) tsk_object_new(thttp_operation_def_t, (thttp_stack_handle_t*)stack, __VA_ARGS__)
|
||||
|
||||
typedef uint64_t thttp_operation_id_t;
|
||||
#define THTTP_OPERATION_INVALID_ID 0
|
||||
#define THTTP_OPERATION_INVALID_HANDLE tsk_null
|
||||
|
||||
typedef enum thttp_operation_param_type_e
|
||||
{
|
||||
optype_param,
|
||||
optype_header,
|
||||
optype_null
|
||||
}
|
||||
thttp_operation_param_type_t;
|
||||
|
||||
#define THTTP_OPERATION_SET_PARAM(NAME_STR, VALUE_STR) optype_param, (const char*)NAME_STR, (const char*)VALUE_STR
|
||||
#define THTTP_OPERATION_SET_HEADER(NAME_STR, VALUE_STR) optype_header, (const char*)NAME_STR, (const char*)VALUE_STR
|
||||
#define THTTP_OPERATION_SET_NULL() optype_null
|
||||
|
||||
typedef void thttp_operation_handle_t;
|
||||
typedef tsk_list_t thttp_operation_handles_L_t;
|
||||
|
||||
TINYHTTP_API int thttp_operation_set(thttp_operation_handle_t *self, ...);
|
||||
TINYHTTP_API thttp_operation_id_t thttp_operation_get_id(const thttp_operation_handle_t *self);
|
||||
const tsk_param_t* thttp_operation_get_param(const thttp_operation_handle_t *self, const char* pname);
|
||||
const tsk_param_t* thttp_operation_get_header(const thttp_operation_handle_t *self, const char* pname);
|
||||
const tsk_params_L_t* thttp_operation_get_headers(const thttp_operation_handle_t *self);
|
||||
const tsk_params_L_t* thttp_operation_get_params(const thttp_operation_handle_t *self);
|
||||
tnet_fd_t thttp_operation_get_fd(const thttp_operation_handle_t *self);
|
||||
tsk_buffer_t* thttp_operation_get_buf(const thttp_operation_handle_t *self);
|
||||
int thttp_operation_set_fd(thttp_operation_handle_t *self, tnet_fd_t fd);
|
||||
TINYHTTP_API int thttp_operation_perform(thttp_operation_handle_t* self);
|
||||
TINYHTTP_API int thttp_operation_cancel(thttp_operation_handle_t* self); // TODO
|
||||
|
||||
typedef tsk_list_t thttp_operations_L_t; /**< List of @ref thttp_operation_handle_t elements. */
|
||||
//FD
|
||||
struct thttp_message_s;
|
||||
|
||||
#define THTTP_OPERATION_CREATE(stack, ...) tsk_object_new(thttp_operation_def_t, (thttp_stack_handle_t*)stack, __VA_ARGS__)
|
||||
|
||||
typedef uint64_t thttp_operation_id_t;
|
||||
#define THTTP_OPERATION_INVALID_ID 0
|
||||
#define THTTP_OPERATION_INVALID_HANDLE tsk_null
|
||||
|
||||
typedef enum thttp_operation_param_type_e
|
||||
{
|
||||
optype_param,
|
||||
optype_header,
|
||||
optype_null
|
||||
}
|
||||
thttp_operation_param_type_t;
|
||||
|
||||
#define THTTP_OPERATION_SET_PARAM(NAME_STR, VALUE_STR) optype_param, (const char*)NAME_STR, (const char*)VALUE_STR
|
||||
#define THTTP_OPERATION_SET_HEADER(NAME_STR, VALUE_STR) optype_header, (const char*)NAME_STR, (const char*)VALUE_STR
|
||||
#define THTTP_OPERATION_SET_NULL() optype_null
|
||||
|
||||
typedef void thttp_operation_handle_t;
|
||||
typedef tsk_list_t thttp_operation_handles_L_t;
|
||||
|
||||
TINYHTTP_API int thttp_operation_set(thttp_operation_handle_t *self, ...);
|
||||
TINYHTTP_API thttp_operation_id_t thttp_operation_get_id(const thttp_operation_handle_t *self);
|
||||
const tsk_param_t* thttp_operation_get_param(const thttp_operation_handle_t *self, const char* pname);
|
||||
const tsk_param_t* thttp_operation_get_header(const thttp_operation_handle_t *self, const char* pname);
|
||||
const tsk_params_L_t* thttp_operation_get_headers(const thttp_operation_handle_t *self);
|
||||
const tsk_params_L_t* thttp_operation_get_params(const thttp_operation_handle_t *self);
|
||||
tnet_fd_t thttp_operation_get_fd(const thttp_operation_handle_t *self);
|
||||
tsk_buffer_t* thttp_operation_get_buf(const thttp_operation_handle_t *self);
|
||||
int thttp_operation_set_fd(thttp_operation_handle_t *self, tnet_fd_t fd);
|
||||
TINYHTTP_API int thttp_operation_perform(thttp_operation_handle_t* self);
|
||||
TINYHTTP_API int thttp_operation_cancel(thttp_operation_handle_t* self); // TODO
|
||||
|
||||
typedef tsk_list_t thttp_operations_L_t; /**< List of @ref thttp_operation_handle_t elements. */
|
||||
TINYHTTP_GEXTERN const void *thttp_operation_def_t;
|
||||
|
||||
THTTP_END_DECLS
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -128,11 +128,11 @@ thttp_url_t *thttp_url_parse(const char *data, size_t size)
|
|||
TSK_OBJECT_SAFE_FREE(url);
|
||||
}
|
||||
else if(!have_port){
|
||||
if(url->type == url_https){
|
||||
url->port = 443;
|
||||
}
|
||||
else{
|
||||
url->port = 80;
|
||||
if(url->type == url_https){
|
||||
url->port = 443;
|
||||
}
|
||||
else{
|
||||
url->port = 80;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file thttp_header.c
|
||||
* @brief Defines a HTTP header (field-name: field-value).
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinyHTTP/headers/thttp_header.h"
|
||||
|
||||
#include "tinyHTTP/headers/thttp_header_Dummy.h"
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file thttp_header.c
|
||||
* @brief Defines a HTTP header (field-name: field-value).
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinyHTTP/headers/thttp_header.h"
|
||||
|
||||
#include "tinyHTTP/headers/thttp_header_Dummy.h"
|
||||
|
||||
const char *thttp_header_get_name(thttp_header_type_t type)
|
||||
{
|
||||
switch(type)
|
||||
|
@ -113,4 +113,4 @@ int thttp_header_tostring(const thttp_header_t *self, tsk_buffer_t *output)
|
|||
tsk_buffer_append(output, "\r\n", 2);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -98,15 +98,15 @@ static int thttp_transport_layer_stream_cb(const tnet_transport_event_t* e)
|
|||
const thttp_operation_handle_t* operation = 0;
|
||||
tsk_buffer_t* buf = 0;
|
||||
|
||||
switch(e->type){
|
||||
switch(e->type){
|
||||
case event_data: {
|
||||
break;
|
||||
}
|
||||
case event_closed:
|
||||
case event_connected:
|
||||
default:{
|
||||
return 0;
|
||||
}
|
||||
case event_connected:
|
||||
default:{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Gets the associated operation */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -43,7 +43,7 @@
|
|||
#include "tsk_debug.h"
|
||||
|
||||
#define DEBUG_STATE_MACHINE 1
|
||||
#define THTTP_MESSAGE_DESCRIPTION(message) \
|
||||
#define THTTP_MESSAGE_DESCRIPTION(message) \
|
||||
THTTP_MESSAGE_IS_RESPONSE(message) ? THTTP_RESPONSE_PHRASE(message) : THTTP_REQUEST_METHOD(message)
|
||||
|
||||
typedef struct thttp_operation_s
|
||||
|
@ -79,36 +79,36 @@ int thttp_operation_message_new(thttp_operation_handle_t* self, thttp_message_t*
|
|||
/* ======================== external functions ======================== */
|
||||
extern int thttp_stack_alert(const thttp_stack_handle_t *self, const thttp_event_t* e);
|
||||
|
||||
/* ======================== transitions ======================== */
|
||||
int thttp_operation_Started_2_Transfering_X_perform(va_list *app);
|
||||
int thttp_operation_Transfering_2_Transfering_X_401_407(va_list *app);
|
||||
int thttp_operation_Transfering_2_Transfering_X_message(va_list *app); /* Any other HTTP message except 401/407 */
|
||||
int thttp_operation_Transfering_2_Transfering_X_perform(va_list *app);
|
||||
int thttp_operation_Any_2_Terminated_X_closed(va_list *app);
|
||||
int thttp_operation_Any_2_Terminated_X_Error(va_list *app);
|
||||
|
||||
/* ======================== conds ======================== */
|
||||
|
||||
|
||||
/* ======================== actions ======================== */
|
||||
typedef enum _fsm_action_e
|
||||
{
|
||||
_fsm_action_perform,
|
||||
_fsm_action_401_407,
|
||||
_fsm_action_message,
|
||||
_fsm_action_closed,
|
||||
_fsm_action_transporterror,
|
||||
_fsm_action_error,
|
||||
}
|
||||
_fsm_action_t;
|
||||
|
||||
/* ======================== states ======================== */
|
||||
typedef enum _fsm_state_e
|
||||
{
|
||||
_fsm_state_Started,
|
||||
_fsm_state_Transfering,
|
||||
_fsm_state_Terminated
|
||||
}
|
||||
/* ======================== transitions ======================== */
|
||||
int thttp_operation_Started_2_Transfering_X_perform(va_list *app);
|
||||
int thttp_operation_Transfering_2_Transfering_X_401_407(va_list *app);
|
||||
int thttp_operation_Transfering_2_Transfering_X_message(va_list *app); /* Any other HTTP message except 401/407 */
|
||||
int thttp_operation_Transfering_2_Transfering_X_perform(va_list *app);
|
||||
int thttp_operation_Any_2_Terminated_X_closed(va_list *app);
|
||||
int thttp_operation_Any_2_Terminated_X_Error(va_list *app);
|
||||
|
||||
/* ======================== conds ======================== */
|
||||
|
||||
|
||||
/* ======================== actions ======================== */
|
||||
typedef enum _fsm_action_e
|
||||
{
|
||||
_fsm_action_perform,
|
||||
_fsm_action_401_407,
|
||||
_fsm_action_message,
|
||||
_fsm_action_closed,
|
||||
_fsm_action_transporterror,
|
||||
_fsm_action_error,
|
||||
}
|
||||
_fsm_action_t;
|
||||
|
||||
/* ======================== states ======================== */
|
||||
typedef enum _fsm_state_e
|
||||
{
|
||||
_fsm_state_Started,
|
||||
_fsm_state_Transfering,
|
||||
_fsm_state_Terminated
|
||||
}
|
||||
_fsm_state_t;
|
||||
|
||||
|
||||
|
@ -198,38 +198,38 @@ const tsk_param_t* thttp_operation_get_header(const thttp_operation_handle_t *se
|
|||
return tsk_null;
|
||||
}
|
||||
|
||||
const tsk_params_L_t* thttp_operation_get_headers(const thttp_operation_handle_t *self)
|
||||
{
|
||||
const tsk_params_L_t* thttp_operation_get_headers(const thttp_operation_handle_t *self)
|
||||
{
|
||||
if(self){
|
||||
return ((const thttp_operation_t *)self)->headers;
|
||||
}
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
const tsk_params_L_t* thttp_operation_get_params(const thttp_operation_handle_t *self)
|
||||
{
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
const tsk_params_L_t* thttp_operation_get_params(const thttp_operation_handle_t *self)
|
||||
{
|
||||
if(self){
|
||||
return ((const thttp_operation_t *)self)->params;
|
||||
}
|
||||
return tsk_null;
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
tnet_fd_t thttp_operation_get_fd(const thttp_operation_handle_t *self)
|
||||
{
|
||||
tnet_fd_t thttp_operation_get_fd(const thttp_operation_handle_t *self)
|
||||
{
|
||||
if(self){
|
||||
return ((const thttp_operation_t *)self)->fd;
|
||||
}
|
||||
return TNET_INVALID_FD;
|
||||
}
|
||||
|
||||
tsk_buffer_t* thttp_operation_get_buf(const thttp_operation_handle_t *self)
|
||||
{
|
||||
return TNET_INVALID_FD;
|
||||
}
|
||||
|
||||
tsk_buffer_t* thttp_operation_get_buf(const thttp_operation_handle_t *self)
|
||||
{
|
||||
if(self){
|
||||
return ((const thttp_operation_t *)self)->buf;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int thttp_operation_set_fd(thttp_operation_handle_t *self, tnet_fd_t fd)
|
||||
{
|
||||
thttp_operation_t* op;
|
||||
|
@ -270,90 +270,90 @@ bail:
|
|||
|
||||
|
||||
|
||||
//--------------------------------------------------------
|
||||
// == STATE MACHINE BEGIN ==
|
||||
//--------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
int thttp_operation_Started_2_Transfering_X_perform(va_list *app)
|
||||
{
|
||||
thttp_operation_t *self = va_arg(*app, thttp_operation_t*);
|
||||
const thttp_message_t *message = va_arg(*app, const thttp_message_t *);
|
||||
|
||||
return thttp_stack_send((thttp_stack_handle_t*)self->stack, self, message);
|
||||
}
|
||||
|
||||
int thttp_operation_Transfering_2_Transfering_X_401_407(va_list *app)
|
||||
{
|
||||
int ret;
|
||||
thttp_operation_t *self = va_arg(*app, thttp_operation_t*);
|
||||
const thttp_response_t *response = va_arg(*app, const thttp_response_t *);
|
||||
thttp_message_t *message = 0;
|
||||
|
||||
if((ret = thttp_operation_update_challenges(self, response))){
|
||||
// Alert the user.
|
||||
TSK_DEBUG_ERROR("HTTP authentication failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Retry with creadentials. */
|
||||
//--------------------------------------------------------
|
||||
// == STATE MACHINE BEGIN ==
|
||||
//--------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
int thttp_operation_Started_2_Transfering_X_perform(va_list *app)
|
||||
{
|
||||
thttp_operation_t *self = va_arg(*app, thttp_operation_t*);
|
||||
const thttp_message_t *message = va_arg(*app, const thttp_message_t *);
|
||||
|
||||
return thttp_stack_send((thttp_stack_handle_t*)self->stack, self, message);
|
||||
}
|
||||
|
||||
int thttp_operation_Transfering_2_Transfering_X_401_407(va_list *app)
|
||||
{
|
||||
int ret;
|
||||
thttp_operation_t *self = va_arg(*app, thttp_operation_t*);
|
||||
const thttp_response_t *response = va_arg(*app, const thttp_response_t *);
|
||||
thttp_message_t *message = 0;
|
||||
|
||||
if((ret = thttp_operation_update_challenges(self, response))){
|
||||
// Alert the user.
|
||||
TSK_DEBUG_ERROR("HTTP authentication failed.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Retry with creadentials. */
|
||||
if(!(ret = thttp_operation_message_new(self, &message))){
|
||||
/* Sends the message. */
|
||||
ret = thttp_stack_send((thttp_stack_handle_t*)self->stack, self, message);
|
||||
}
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(message);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int thttp_operation_Transfering_2_Transfering_X_message(va_list *app)
|
||||
{
|
||||
thttp_operation_t *self = va_arg(*app, thttp_operation_t*);
|
||||
const thttp_message_t *message = va_arg(*app, const thttp_message_t *);
|
||||
thttp_event_t* e = 0;
|
||||
|
||||
/* Alert the user. */
|
||||
e = THTTP_EVENT_CREATE(thttp_event_message, self->id, THTTP_MESSAGE_DESCRIPTION(message), message);
|
||||
thttp_stack_alert(self->stack, e);
|
||||
TSK_OBJECT_SAFE_FREE(e);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int thttp_operation_Transfering_2_Transfering_X_perform(va_list *app)
|
||||
{
|
||||
thttp_operation_t *self = va_arg(*app, thttp_operation_t*);
|
||||
const thttp_message_t *message = va_arg(*app, const thttp_message_t *);
|
||||
|
||||
return thttp_stack_send((thttp_stack_handle_t*)self->stack, self, message);
|
||||
}
|
||||
|
||||
int thttp_operation_Any_2_Terminated_X_closed(va_list *app)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int thttp_operation_Any_2_Terminated_X_Error(va_list *app)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// == STATE MACHINE END ==
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
|
||||
|
||||
|
||||
int thttp_operation_OnTerminated(thttp_operation_t *self)
|
||||
{
|
||||
TSK_DEBUG_INFO("=== OPERATION terminated ===");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(message);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int thttp_operation_Transfering_2_Transfering_X_message(va_list *app)
|
||||
{
|
||||
thttp_operation_t *self = va_arg(*app, thttp_operation_t*);
|
||||
const thttp_message_t *message = va_arg(*app, const thttp_message_t *);
|
||||
thttp_event_t* e = 0;
|
||||
|
||||
/* Alert the user. */
|
||||
e = THTTP_EVENT_CREATE(thttp_event_message, self->id, THTTP_MESSAGE_DESCRIPTION(message), message);
|
||||
thttp_stack_alert(self->stack, e);
|
||||
TSK_OBJECT_SAFE_FREE(e);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int thttp_operation_Transfering_2_Transfering_X_perform(va_list *app)
|
||||
{
|
||||
thttp_operation_t *self = va_arg(*app, thttp_operation_t*);
|
||||
const thttp_message_t *message = va_arg(*app, const thttp_message_t *);
|
||||
|
||||
return thttp_stack_send((thttp_stack_handle_t*)self->stack, self, message);
|
||||
}
|
||||
|
||||
int thttp_operation_Any_2_Terminated_X_closed(va_list *app)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int thttp_operation_Any_2_Terminated_X_Error(va_list *app)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// == STATE MACHINE END ==
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
|
||||
|
||||
|
||||
int thttp_operation_OnTerminated(thttp_operation_t *self)
|
||||
{
|
||||
TSK_DEBUG_INFO("=== OPERATION terminated ===");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int thttp_operation_SignalMessage(const thttp_operation_handle_t *self, const thttp_message_t* message)
|
||||
|
@ -365,8 +365,8 @@ int thttp_operation_SignalMessage(const thttp_operation_handle_t *self, const th
|
|||
goto bail;
|
||||
}
|
||||
|
||||
if(THTTP_RESPONSE_IS(message, 401) || THTTP_RESPONSE_IS(message, 407)){
|
||||
ret = tsk_fsm_act(operation->fsm, _fsm_action_401_407, operation, message, operation, message);
|
||||
if(THTTP_RESPONSE_IS(message, 401) || THTTP_RESPONSE_IS(message, 407)){
|
||||
ret = tsk_fsm_act(operation->fsm, _fsm_action_401_407, operation, message, operation, message);
|
||||
}
|
||||
else{
|
||||
ret = tsk_fsm_act(operation->fsm, _fsm_action_message, operation, message, operation, message);
|
||||
|
@ -376,129 +376,129 @@ bail:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int thttp_operation_update_challenges(thttp_operation_t *self, const thttp_response_t* response)
|
||||
{
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
|
||||
tsk_list_item_t *item;
|
||||
|
||||
thttp_challenge_t *challenge;
|
||||
|
||||
const thttp_header_WWW_Authenticate_t *WWW_Authenticate;
|
||||
const thttp_header_Proxy_Authenticate_t *Proxy_Authenticate;
|
||||
|
||||
/* RFC 2617 - Digest Operation
|
||||
|
||||
* (A) The client response to a WWW-Authenticate challenge for a protection
|
||||
space starts an authentication session with that protection space.
|
||||
The authentication session lasts until the client receives another
|
||||
WWW-Authenticate challenge from any server in the protection space.
|
||||
|
||||
(B) The server may return a 401 response with a new nonce value, causing the client
|
||||
to retry the request; by specifying stale=TRUE with this response,
|
||||
the server tells the client to retry with the new nonce, but without
|
||||
prompting for a new username and password.
|
||||
*/
|
||||
|
||||
/* FIXME: As we perform the same task ==> Use only one loop.
|
||||
*/
|
||||
|
||||
for(i =0; (WWW_Authenticate = (const thttp_header_WWW_Authenticate_t*)thttp_message_get_headerAt(response, thttp_htype_WWW_Authenticate, i)); i++)
|
||||
{
|
||||
int isnew = 1;
|
||||
|
||||
tsk_list_foreach(item, self->cred.challenges)
|
||||
{
|
||||
challenge = item->data;
|
||||
if(challenge->isproxy) continue;
|
||||
|
||||
if(tsk_strequals(challenge->realm, WWW_Authenticate->realm) && (WWW_Authenticate->stale /*|| acceptNewVector*/))
|
||||
{
|
||||
/*== (B) ==*/
|
||||
if((ret = thttp_challenge_update(challenge,
|
||||
WWW_Authenticate->scheme,
|
||||
WWW_Authenticate->realm,
|
||||
WWW_Authenticate->nonce,
|
||||
WWW_Authenticate->opaque,
|
||||
WWW_Authenticate->algorithm,
|
||||
WWW_Authenticate->qop)))
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
isnew = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
if(isnew)
|
||||
{
|
||||
if((challenge = THTTP_CHALLENGE_CREATE(0, /* Not proxy */
|
||||
WWW_Authenticate->scheme,
|
||||
WWW_Authenticate->realm,
|
||||
WWW_Authenticate->nonce,
|
||||
WWW_Authenticate->opaque,
|
||||
WWW_Authenticate->algorithm,
|
||||
WWW_Authenticate->qop)))
|
||||
{
|
||||
tsk_list_push_back_data(self->cred.challenges, (void**)&challenge);
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; (Proxy_Authenticate = (const thttp_header_Proxy_Authenticate_t*)thttp_message_get_headerAt(response, thttp_htype_Proxy_Authenticate, i)); i++)
|
||||
{
|
||||
int isnew = 1;
|
||||
|
||||
tsk_list_foreach(item, self->cred.challenges)
|
||||
{
|
||||
challenge = item->data;
|
||||
if(!challenge->isproxy) continue;
|
||||
|
||||
if(tsk_strequals(challenge->realm, Proxy_Authenticate->realm) && (Proxy_Authenticate->stale /*|| acceptNewVector*/))
|
||||
{
|
||||
/*== (B) ==*/
|
||||
if((ret = thttp_challenge_update(challenge,
|
||||
Proxy_Authenticate->scheme,
|
||||
Proxy_Authenticate->realm,
|
||||
Proxy_Authenticate->nonce,
|
||||
Proxy_Authenticate->opaque,
|
||||
Proxy_Authenticate->algorithm,
|
||||
Proxy_Authenticate->qop)))
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
isnew = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
if(isnew)
|
||||
{
|
||||
if((challenge = THTTP_CHALLENGE_CREATE(1, /* Proxy */
|
||||
Proxy_Authenticate->scheme,
|
||||
Proxy_Authenticate->realm,
|
||||
Proxy_Authenticate->nonce,
|
||||
Proxy_Authenticate->opaque,
|
||||
Proxy_Authenticate->algorithm,
|
||||
Proxy_Authenticate->qop)))
|
||||
{
|
||||
tsk_list_push_back_data(self->cred.challenges, (void**)&challenge);
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
int thttp_operation_update_challenges(thttp_operation_t *self, const thttp_response_t* response)
|
||||
{
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
|
||||
tsk_list_item_t *item;
|
||||
|
||||
thttp_challenge_t *challenge;
|
||||
|
||||
const thttp_header_WWW_Authenticate_t *WWW_Authenticate;
|
||||
const thttp_header_Proxy_Authenticate_t *Proxy_Authenticate;
|
||||
|
||||
/* RFC 2617 - Digest Operation
|
||||
|
||||
* (A) The client response to a WWW-Authenticate challenge for a protection
|
||||
space starts an authentication session with that protection space.
|
||||
The authentication session lasts until the client receives another
|
||||
WWW-Authenticate challenge from any server in the protection space.
|
||||
|
||||
(B) The server may return a 401 response with a new nonce value, causing the client
|
||||
to retry the request; by specifying stale=TRUE with this response,
|
||||
the server tells the client to retry with the new nonce, but without
|
||||
prompting for a new username and password.
|
||||
*/
|
||||
|
||||
/* FIXME: As we perform the same task ==> Use only one loop.
|
||||
*/
|
||||
|
||||
for(i =0; (WWW_Authenticate = (const thttp_header_WWW_Authenticate_t*)thttp_message_get_headerAt(response, thttp_htype_WWW_Authenticate, i)); i++)
|
||||
{
|
||||
int isnew = 1;
|
||||
|
||||
tsk_list_foreach(item, self->cred.challenges)
|
||||
{
|
||||
challenge = item->data;
|
||||
if(challenge->isproxy) continue;
|
||||
|
||||
if(tsk_strequals(challenge->realm, WWW_Authenticate->realm) && (WWW_Authenticate->stale /*|| acceptNewVector*/))
|
||||
{
|
||||
/*== (B) ==*/
|
||||
if((ret = thttp_challenge_update(challenge,
|
||||
WWW_Authenticate->scheme,
|
||||
WWW_Authenticate->realm,
|
||||
WWW_Authenticate->nonce,
|
||||
WWW_Authenticate->opaque,
|
||||
WWW_Authenticate->algorithm,
|
||||
WWW_Authenticate->qop)))
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
isnew = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
if(isnew)
|
||||
{
|
||||
if((challenge = THTTP_CHALLENGE_CREATE(0, /* Not proxy */
|
||||
WWW_Authenticate->scheme,
|
||||
WWW_Authenticate->realm,
|
||||
WWW_Authenticate->nonce,
|
||||
WWW_Authenticate->opaque,
|
||||
WWW_Authenticate->algorithm,
|
||||
WWW_Authenticate->qop)))
|
||||
{
|
||||
tsk_list_push_back_data(self->cred.challenges, (void**)&challenge);
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; (Proxy_Authenticate = (const thttp_header_Proxy_Authenticate_t*)thttp_message_get_headerAt(response, thttp_htype_Proxy_Authenticate, i)); i++)
|
||||
{
|
||||
int isnew = 1;
|
||||
|
||||
tsk_list_foreach(item, self->cred.challenges)
|
||||
{
|
||||
challenge = item->data;
|
||||
if(!challenge->isproxy) continue;
|
||||
|
||||
if(tsk_strequals(challenge->realm, Proxy_Authenticate->realm) && (Proxy_Authenticate->stale /*|| acceptNewVector*/))
|
||||
{
|
||||
/*== (B) ==*/
|
||||
if((ret = thttp_challenge_update(challenge,
|
||||
Proxy_Authenticate->scheme,
|
||||
Proxy_Authenticate->realm,
|
||||
Proxy_Authenticate->nonce,
|
||||
Proxy_Authenticate->opaque,
|
||||
Proxy_Authenticate->algorithm,
|
||||
Proxy_Authenticate->qop)))
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
isnew = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
if(isnew)
|
||||
{
|
||||
if((challenge = THTTP_CHALLENGE_CREATE(1, /* Proxy */
|
||||
Proxy_Authenticate->scheme,
|
||||
Proxy_Authenticate->realm,
|
||||
Proxy_Authenticate->nonce,
|
||||
Proxy_Authenticate->opaque,
|
||||
Proxy_Authenticate->algorithm,
|
||||
Proxy_Authenticate->qop)))
|
||||
{
|
||||
tsk_list_push_back_data(self->cred.challenges, (void**)&challenge);
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int thttp_operation_message_new(thttp_operation_handle_t* self, thttp_message_t** message)
|
||||
|
@ -534,29 +534,29 @@ int thttp_operation_message_new(thttp_operation_handle_t* self, thttp_message_t*
|
|||
goto bail;
|
||||
}
|
||||
|
||||
/* Add headers associated to the operation. */
|
||||
tsk_list_foreach(item, op->headers)
|
||||
{
|
||||
param = (const tsk_param_t*)item->data;
|
||||
if(!param->tag){
|
||||
THTTP_MESSAGE_ADD_HEADER(*message, THTTP_HEADER_DUMMY_VA_ARGS(param->name, param->value));
|
||||
}
|
||||
/* Add headers associated to the operation. */
|
||||
tsk_list_foreach(item, op->headers)
|
||||
{
|
||||
param = (const tsk_param_t*)item->data;
|
||||
if(!param->tag){
|
||||
THTTP_MESSAGE_ADD_HEADER(*message, THTTP_HEADER_DUMMY_VA_ARGS(param->name, param->value));
|
||||
}
|
||||
}
|
||||
|
||||
/* Add creadentials */
|
||||
if(THTTP_MESSAGE_IS_REQUEST(*message) && !TSK_LIST_IS_EMPTY(op->cred.challenges))
|
||||
{
|
||||
thttp_challenge_t *challenge;
|
||||
thttp_header_t* auth_hdr;
|
||||
tsk_list_foreach(item, op->cred.challenges)
|
||||
{
|
||||
challenge = item->data;
|
||||
auth_hdr = thttp_challenge_create_header_authorization(challenge, "sip:mercuro1@colibria.com", "mercuro1", *message);
|
||||
if(auth_hdr){
|
||||
thttp_message_add_header(*message, auth_hdr);
|
||||
tsk_object_unref(auth_hdr), auth_hdr = 0;
|
||||
}
|
||||
}
|
||||
if(THTTP_MESSAGE_IS_REQUEST(*message) && !TSK_LIST_IS_EMPTY(op->cred.challenges))
|
||||
{
|
||||
thttp_challenge_t *challenge;
|
||||
thttp_header_t* auth_hdr;
|
||||
tsk_list_foreach(item, op->cred.challenges)
|
||||
{
|
||||
challenge = item->data;
|
||||
auth_hdr = thttp_challenge_create_header_authorization(challenge, "sip:mercuro1@colibria.com", "mercuro1", *message);
|
||||
if(auth_hdr){
|
||||
thttp_message_add_header(*message, auth_hdr);
|
||||
tsk_object_unref(auth_hdr), auth_hdr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// all is ok
|
||||
|
@ -597,47 +597,47 @@ static void* thttp_operation_create(void * self, va_list * app)
|
|||
operation->id = ++unique_id;
|
||||
}
|
||||
|
||||
/* init FSM */
|
||||
operation->fsm->debug = DEBUG_STATE_MACHINE;
|
||||
/* init FSM */
|
||||
operation->fsm->debug = DEBUG_STATE_MACHINE;
|
||||
tsk_fsm_set_callback_terminated(operation->fsm, TSK_FSM_ONTERMINATED(thttp_operation_OnTerminated), operation);
|
||||
tsk_fsm_set(operation->fsm,
|
||||
|
||||
/*=======================
|
||||
* === Started ===
|
||||
*/
|
||||
// Started -> (perform) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Started, _fsm_action_perform, _fsm_state_Transfering, thttp_operation_Started_2_Transfering_X_perform, "thttp_operation_Started_2_Transfering_X_perform"),
|
||||
// Started -> (Any) -> Started
|
||||
TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Started, "thttp_operation_Started_2_Started_X_any"),
|
||||
|
||||
|
||||
/*=======================
|
||||
* === Transfering ===
|
||||
*/
|
||||
// Transfering -> (401/407) -> Transfering
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Transfering, _fsm_action_401_407, _fsm_state_Transfering, thttp_operation_Transfering_2_Transfering_X_401_407, "thttp_operation_Transfering_2_Transfering_X_401_407"),
|
||||
// Transfering -> (message) -> Transfering
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Transfering, _fsm_action_message, _fsm_state_Transfering, thttp_operation_Transfering_2_Transfering_X_message, "thttp_operation_Transfering_2_Transfering_X_message"),
|
||||
// Transfering -> (perform) -> Transfering
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Transfering, _fsm_action_perform, _fsm_state_Transfering, thttp_operation_Transfering_2_Transfering_X_perform, "thttp_operation_Transfering_2_Transfering_X_perform"),
|
||||
//// Trying -> (300_to_699) -> Terminated
|
||||
//TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_300_to_699, _fsm_state_Terminated, thttp_operation_Trying_2_Terminated_X_300_to_699, "thttp_operation_Trying_2_Terminated_X_300_to_699"),
|
||||
//// Trying -> (cancel) -> Terminated
|
||||
//TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_cancel, _fsm_state_Terminated, thttp_operation_Trying_2_Terminated_X_cancel, "thttp_operation_Trying_2_Terminated_X_cancel"),
|
||||
//// Trying -> (closed) -> Terminated
|
||||
//TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_closed, _fsm_state_Terminated, thttp_operation_Trying_2_Terminated_X_closed, "thttp_operation_Trying_2_Terminated_X_closed"),
|
||||
// Trying -> (Any) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Transfering, "thttp_operation_Transfering_2_Transfering_X_any"),
|
||||
|
||||
|
||||
/*=======================
|
||||
* === Any ===
|
||||
*/
|
||||
// Any -> (closed) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_closed, _fsm_state_Terminated, thttp_operation_Any_2_Terminated_X_closed, "thttp_operation_Any_2_Terminated_X_closed"),
|
||||
// Any -> (error) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_error, _fsm_state_Terminated, thttp_operation_Any_2_Terminated_X_Error, "thttp_operation_Any_2_Terminated_X_Error"),
|
||||
|
||||
tsk_fsm_set(operation->fsm,
|
||||
|
||||
/*=======================
|
||||
* === Started ===
|
||||
*/
|
||||
// Started -> (perform) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Started, _fsm_action_perform, _fsm_state_Transfering, thttp_operation_Started_2_Transfering_X_perform, "thttp_operation_Started_2_Transfering_X_perform"),
|
||||
// Started -> (Any) -> Started
|
||||
TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Started, "thttp_operation_Started_2_Started_X_any"),
|
||||
|
||||
|
||||
/*=======================
|
||||
* === Transfering ===
|
||||
*/
|
||||
// Transfering -> (401/407) -> Transfering
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Transfering, _fsm_action_401_407, _fsm_state_Transfering, thttp_operation_Transfering_2_Transfering_X_401_407, "thttp_operation_Transfering_2_Transfering_X_401_407"),
|
||||
// Transfering -> (message) -> Transfering
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Transfering, _fsm_action_message, _fsm_state_Transfering, thttp_operation_Transfering_2_Transfering_X_message, "thttp_operation_Transfering_2_Transfering_X_message"),
|
||||
// Transfering -> (perform) -> Transfering
|
||||
TSK_FSM_ADD_ALWAYS(_fsm_state_Transfering, _fsm_action_perform, _fsm_state_Transfering, thttp_operation_Transfering_2_Transfering_X_perform, "thttp_operation_Transfering_2_Transfering_X_perform"),
|
||||
//// Trying -> (300_to_699) -> Terminated
|
||||
//TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_300_to_699, _fsm_state_Terminated, thttp_operation_Trying_2_Terminated_X_300_to_699, "thttp_operation_Trying_2_Terminated_X_300_to_699"),
|
||||
//// Trying -> (cancel) -> Terminated
|
||||
//TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_cancel, _fsm_state_Terminated, thttp_operation_Trying_2_Terminated_X_cancel, "thttp_operation_Trying_2_Terminated_X_cancel"),
|
||||
//// Trying -> (closed) -> Terminated
|
||||
//TSK_FSM_ADD_ALWAYS(_fsm_state_Trying, _fsm_action_closed, _fsm_state_Terminated, thttp_operation_Trying_2_Terminated_X_closed, "thttp_operation_Trying_2_Terminated_X_closed"),
|
||||
// Trying -> (Any) -> Trying
|
||||
TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Transfering, "thttp_operation_Transfering_2_Transfering_X_any"),
|
||||
|
||||
|
||||
/*=======================
|
||||
* === Any ===
|
||||
*/
|
||||
// Any -> (closed) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_closed, _fsm_state_Terminated, thttp_operation_Any_2_Terminated_X_closed, "thttp_operation_Any_2_Terminated_X_closed"),
|
||||
// Any -> (error) -> Terminated
|
||||
TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_error, _fsm_state_Terminated, thttp_operation_Any_2_Terminated_X_Error, "thttp_operation_Any_2_Terminated_X_Error"),
|
||||
|
||||
TSK_FSM_ADD_NULL());
|
||||
|
||||
/* add to the stack */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -48,6 +48,9 @@ TMEDIA_BEGIN_DECLS
|
|||
|
||||
typedef enum tmedia_action_e
|
||||
{
|
||||
// Dummy
|
||||
tma_dummy_say_hello,
|
||||
|
||||
// MSRP
|
||||
tma_msrp_send_data,
|
||||
tma_msrp_send_file,
|
||||
|
|
|
@ -76,15 +76,14 @@ int dummy_set_remote_offer(tmedia_t* self, const tsdp_message_t* offer)
|
|||
int dummy_perform(tmedia_t* self, tmedia_action_t action, const tsk_params_L_t* params)
|
||||
{
|
||||
dummy_t *dummy = DUMMY(self);
|
||||
const tsk_list_item_t* item;
|
||||
const tsk_param_t* param;
|
||||
|
||||
TSK_DEBUG_INFO("dummy_perform");
|
||||
|
||||
tsk_list_foreach(item, params){
|
||||
param = item->data;
|
||||
TSK_DEBUG_INFO("name=%s/value=%s", param->name, param->value);
|
||||
}
|
||||
switch(action){
|
||||
case tma_dummy_say_hello:
|
||||
{
|
||||
TSK_DEBUG_INFO("dummy_perform (hello to \"%s\")", tsk_params_get_param_value(params, "to"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -50,9 +50,8 @@ int main()
|
|||
tmedia_start(dummy);
|
||||
tmedia_pause(dummy);
|
||||
|
||||
tmedia_perform(dummy, tma_msrp_send_data,
|
||||
TSK_PARAM_VA_ARGS("content", "hello world!"),
|
||||
TSK_PARAM_VA_ARGS("content-type", "text/plain"),
|
||||
tmedia_perform(dummy, tma_dummy_say_hello,
|
||||
TSK_PARAM_VA_ARGS("to", "doubango"),
|
||||
|
||||
tsk_null);
|
||||
|
||||
|
|
Loading…
Reference in New Issue