Replace cfile.c with connection.c

- cfile.h needed too many function calls and was too complex
 - connection.h does
     - only download in binary mode (json can handle that)
     - have no excess of getters and setters
     - allow to execute the whole request in a single function call
     - allow to be re-used for multiple requests
 - as a result, the code has 600 lines of code less
 - originally, connection.h was developed to use a global curl
   handle for all requests such that the same connection could be
   re-used. Unfortunately the MediaFire servers will close the
   connection after each request from their end:

      Bryan: "Unfortunately, we won't ever do keep-alive.  Closing the
      connection is a small part of a larger set of heuristics we have in
      place to prevent DOS/DDOS attacks."

   This causes massive performance impacts and those grow even larger when
   using SSL because the handshake has to be executed for every single
   request again.
This commit is contained in:
josch
2014-09-17 11:20:23 +02:00
parent fe42b6e668
commit ebedf596db
20 changed files with 346 additions and 974 deletions

View File

@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8)
project(mediafire-tools)
set(mf-sources account.c cfile.c cmd_auth.c cmd_chdir.c cmd_debug.c cmd_file.c cmd_get.c cmd_help.c cmd_host.c cmd_lcd.c cmd_links.c cmd_list.c cmd_lpwd.c cmd_mkdir.c cmd_pwd.c cmd_whoami.c console.c download.c file.c file_info.c file_links.c folder.c folder_create.c folder_info.c json.c keys.c list.c mfshell.c signals.c signature.c strings.c stringv.c user_session.c)
set(mf-headers account.h cfile.h chdir.h command.h console.h download.h file_info.h file_links.h folder_create.h folder_info.h json.h list.h macros.h mfshell.h private.h signals.h strings.h stringv.h user_session.h)
set(mf-sources account.c cmd_auth.c cmd_chdir.c cmd_debug.c cmd_file.c cmd_get.c cmd_help.c cmd_host.c cmd_lcd.c cmd_links.c cmd_list.c cmd_lpwd.c cmd_mkdir.c cmd_pwd.c cmd_whoami.c connection.c console.c download.c file.c file_info.c file_links.c folder.c folder_create.c folder_info.c json.c keys.c list.c mfshell.c signals.c signature.c strings.c stringv.c user_session.c)
set(mf-headers account.h chdir.h command.h connection.h console.h download.h file_info.h file_links.h folder_create.h folder_info.h json.h list.h macros.h mfshell.h private.h signals.h strings.h stringv.h user_session.h)
add_library(mf-obj OBJECT ${mf-sources} ${mf-headers})