Merge branch 'master' into handler
pull from upstream
This commit is contained in:
@@ -59,10 +59,6 @@ An alternative to the last 2 instructions is to use the script from tools folder
|
||||
### text
|
||||
* __encoder__: Various simpler encoders: base64, url-encoder, xml entities, html entities [read more](library/text/encoder)
|
||||
|
||||
### crypto
|
||||
* eel
|
||||
* eapml
|
||||
|
||||
### Others
|
||||
* error: very simple/basic library to handle error
|
||||
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" cat_call_detection="false" is_attached_by_default="true" void_safety="all" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ECF_CONFIG_PATH)\cURL\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ECF_CONFIG_PATH)/cURL/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<cluster name="curl" location=".\cURL" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ECF_CONFIG_PATH)\cURL\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ECF_CONFIG_PATH)/cURL/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ECF_CONFIG_PATH)\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<cluster name="curl" location=".\cURL" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,58 +0,0 @@
|
||||
TOP = ..
|
||||
DIR = $dir_sep
|
||||
OUTDIR= .
|
||||
INDIR= .
|
||||
CC = $cc
|
||||
OUTPUT_CMD = $output_cmd
|
||||
CFLAGS = -I"$rt_include" -I..$(DIR)spec$(DIR)include -I. \
|
||||
-I..$(DIR)..$(DIR)..$(DIR)C_library$(DIR)libpng -I..$(DIR)..$(DIR)..$(DIR)C_library$(DIR)zlib
|
||||
JCFLAGS = $(CFLAGS) $ccflags $optimize
|
||||
JMTCFLAGS = $(CFLAGS) $mtccflags $optimize
|
||||
JILCFLAGS = $(CFLAGS) $mtccflags $optimize -DEIF_IL_DLL
|
||||
LN = copy
|
||||
MV = $mv
|
||||
RM = $del
|
||||
MAKE = $make
|
||||
MKDIR = $mkdir
|
||||
LINK = $link32
|
||||
DLL_FLAGS = $dll_flags
|
||||
DLL_LIBS = $dll_libs
|
||||
OBJECTS = eiffel_curl.$obj
|
||||
MT_OBJECTS = MTeiffel_curl.$obj
|
||||
IL_OBJECTS = ILeiffel_curl.$obj
|
||||
|
||||
.c.$obj:
|
||||
$(CC) -c $(JCFLAGS) $<
|
||||
|
||||
all:: $output_libraries
|
||||
$(MAKE) clean
|
||||
|
||||
standard:: eiffel_curl.lib ileiffel_curl.lib
|
||||
mtstandard:: mteiffel_curl.lib
|
||||
|
||||
clean:
|
||||
$(RM) *.$obj
|
||||
$(RM) *.lib
|
||||
|
||||
eiffel_curl.lib: $(OBJECTS)
|
||||
$alib_line
|
||||
$(MKDIR) ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib
|
||||
$(MV) $@ ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib$(DIR)$@
|
||||
|
||||
mteiffel_curl.lib: $(MT_OBJECTS)
|
||||
$alib_line
|
||||
$(MKDIR) ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib
|
||||
$(MV) $@ ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib$(DIR)$@
|
||||
|
||||
ileiffel_curl.lib: $(IL_OBJECTS)
|
||||
$alib_line
|
||||
$(MKDIR) ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib
|
||||
$(MV) $@ ..$(DIR)spec$(DIR)$(ISE_C_COMPILER)$(DIR)$(ISE_PLATFORM)$(DIR)lib$(DIR)$@
|
||||
|
||||
#Multithreaded targets.
|
||||
MTeiffel_curl.$obj: eiffel_curl.c
|
||||
$(CC) $(JMTCFLAGS) $(OUTPUT_CMD)$@ -c $?
|
||||
|
||||
#.NET targets.
|
||||
ILeiffel_curl.$obj: eiffel_curl.c
|
||||
$(CC) $(JILCFLAGS) $(OUTPUT_CMD)$@ -c $?
|
||||
@@ -1,92 +0,0 @@
|
||||
case $CONFIG in
|
||||
'')
|
||||
if test ! -f config.sh; then
|
||||
(echo "Can't find config.sh."; exit 1)
|
||||
fi 2>/dev/null
|
||||
. ./config.sh
|
||||
;;
|
||||
esac
|
||||
case "$0" in
|
||||
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
|
||||
esac
|
||||
echo "Extracting "."/Makefile (with variable substitutions)"
|
||||
$spitshell >Makefile <<!GROK!THIS!
|
||||
########################################################################
|
||||
# Makefile generated from Makefile.SH on $DATE
|
||||
|
||||
SHELL = /bin/sh
|
||||
AR = ar rc
|
||||
CC = $cc
|
||||
CTAGS = ctags
|
||||
INCLUDE = -I$rt_include -I../spec/include -I../../../C_library/libpng -I../../../C_library/zlib
|
||||
CFLAGS = $optimize $ccflags $large -g \$(INCLUDE)
|
||||
MTCFLAGS = $optimize $mtccflags $large -g \$(INCLUDE)
|
||||
SHAREDLINK = $sharedlink
|
||||
LDSHAREDFLAGS = $ldsharedflags
|
||||
LN = $ln
|
||||
MAKE = $make
|
||||
MKDEP = $mkdep \$(DPFLAGS) --
|
||||
RANLIB = $ranlib
|
||||
RM = $rm -f
|
||||
MV = $mv
|
||||
MKDIR = $mkdir -p
|
||||
PLATFORM = $ISE_PLATFORM
|
||||
|
||||
########################################################################
|
||||
# New suffixes and associated building rules -- edit with care
|
||||
|
||||
|
||||
!GROK!THIS!
|
||||
$spitshell >>Makefile <<'!NO!SUBS!'
|
||||
|
||||
MT_OBJECTS = MTeiffel_curl.o
|
||||
OBJECTS = eiffel_curl.o
|
||||
|
||||
ALL_OBJECTS = $(OBJECTS) $(MT_OBJECTS)
|
||||
|
||||
all: $(ALL_OBJECTS)
|
||||
$(MKDIR) ../spec/$(PLATFORM)/lib
|
||||
$(MV) $? ../spec/$(PLATFORM)/lib
|
||||
$(MAKE) clobber
|
||||
|
||||
MTeiffel_curl.o: eiffel_curl.c
|
||||
$(CC) -c $(MTCFLAGS) $? -o $@
|
||||
|
||||
########################################################################
|
||||
# Common rules for all Makefiles -- do not edit
|
||||
|
||||
emptyrule::
|
||||
|
||||
clean: local_clean
|
||||
realclean: local_realclean
|
||||
clobber: local_clobber
|
||||
|
||||
local_clean::
|
||||
$(RM) core *~ *.o *.so *.a
|
||||
|
||||
local_realclean:: local_clean
|
||||
|
||||
local_clobber:: local_realclean
|
||||
$(RM) Makefile config.sh
|
||||
|
||||
Makefile: Makefile.SH
|
||||
/bin/sh Makefile.SH
|
||||
|
||||
tags::
|
||||
$(CTAGS) -w *.[ch]
|
||||
$(CTAGS) -xw *.[ch] > tags
|
||||
|
||||
local_clobber::
|
||||
$(RM) tags
|
||||
|
||||
########################################################################
|
||||
# Dependencies generated by make depend
|
||||
# DO NOT DELETE THIS LINE -- make depend relies on it
|
||||
|
||||
# Put nothing here or make depend will gobble it up
|
||||
.FORCE_DEPEND::
|
||||
@echo "You must run 'make depend' in $(TOP) first."; exit 1
|
||||
!NO!SUBS!
|
||||
chmod 644 Makefile
|
||||
$eunicefix Makefile
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="build_curl_clib" default="help">
|
||||
|
||||
<description>
|
||||
description: "cURL Clib library compilation"
|
||||
</description>
|
||||
|
||||
<target name="help">
|
||||
<echo message="usage:"/>
|
||||
<echo message=" geant compile"/>
|
||||
<echo message=" geant clean"/>
|
||||
<echo message=" geant clobber"/>
|
||||
</target>
|
||||
|
||||
<target name="compile" >
|
||||
<exec executable="finish_freezing -library" />
|
||||
</target>
|
||||
|
||||
<target name="clean" >
|
||||
</target>
|
||||
|
||||
<target name="clobber" depend="clean" />
|
||||
|
||||
</project>
|
||||
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
indexing
|
||||
description: "Functions used by the class CURL_FUNCTION."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
*/
|
||||
|
||||
#include "eiffel_curl.h"
|
||||
|
||||
typedef EIF_INTEGER (* EIF_CURL_PROGRESS_PROC) (
|
||||
#ifndef EIF_IL_DLL
|
||||
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
|
||||
#endif
|
||||
EIF_POINTER, /* a_user_pointer */
|
||||
EIF_REAL_64, /* a_dltotal */
|
||||
EIF_REAL_64, /* a_dlnow */
|
||||
EIF_REAL_64, /* a_ultotal */
|
||||
EIF_REAL_64 /* a_ulnow */
|
||||
);
|
||||
|
||||
typedef EIF_INTEGER (* EIF_CURL_WRITE_PROC) (
|
||||
#ifndef EIF_IL_DLL
|
||||
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
|
||||
#endif
|
||||
EIF_POINTER, /* a_data_pointer */
|
||||
EIF_INTEGER, /* a_size */
|
||||
EIF_INTEGER, /* a_nmemb */
|
||||
EIF_POINTER /* a_write_pointer */
|
||||
);
|
||||
|
||||
typedef EIF_INTEGER (* EIF_CURL_READ_PROC) (
|
||||
#ifndef EIF_IL_DLL
|
||||
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
|
||||
#endif
|
||||
EIF_POINTER, /* a_data_pointer */
|
||||
EIF_INTEGER, /* a_size */
|
||||
EIF_INTEGER, /* a_nmemb */
|
||||
EIF_POINTER /* a_write_pointer */
|
||||
);
|
||||
|
||||
|
||||
typedef EIF_INTEGER (* EIF_CURL_DEBUG_PROC) (
|
||||
#ifndef EIF_IL_DLL
|
||||
EIF_REFERENCE, /* CURL_FUNCTION Eiffel object */
|
||||
#endif
|
||||
EIF_POINTER, /* a_curl_handle */
|
||||
EIF_INTEGER, /* a_curl_infotype */
|
||||
EIF_POINTER, /* a_char_pointer */
|
||||
EIF_INTEGER, /* a_size */
|
||||
EIF_POINTER /* a_user_pointer */
|
||||
);
|
||||
|
||||
static EIF_OBJECT eiffel_function_object = NULL;
|
||||
/* Address of Eiffel object CURL_FUNCTION */
|
||||
|
||||
static EIF_CURL_PROGRESS_PROC eiffel_progress_function = NULL;
|
||||
/* Address of Eiffel CURL_FUNCTION.progress_function */
|
||||
|
||||
static EIF_CURL_WRITE_PROC eiffel_write_function = NULL;
|
||||
/* Address of Eiffel CURL_FUNCTION.write_function */
|
||||
|
||||
static EIF_CURL_READ_PROC eiffel_read_function = NULL;
|
||||
/* Address of Eiffel CURL_FUNCTION.read_function */
|
||||
|
||||
static EIF_CURL_DEBUG_PROC eiffel_debug_function = NULL;
|
||||
/* Address of Eiffel CURL_FUNCTION.debug_function */
|
||||
|
||||
/* Set Eiffel CURL_FUNCTION object address */
|
||||
void c_set_object(EIF_REFERENCE a_address)
|
||||
{
|
||||
if (a_address) {
|
||||
eiffel_function_object = eif_protect (a_address);
|
||||
} else {
|
||||
eiffel_function_object = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Release Eiffel CURL_FUNCTION object address */
|
||||
void c_release_object()
|
||||
{
|
||||
eif_wean (eiffel_function_object);
|
||||
}
|
||||
|
||||
/* Set CURL_FUNCTOIN.progress_function address */
|
||||
void c_set_progress_function_address( EIF_POINTER a_address)
|
||||
{
|
||||
eiffel_progress_function = (EIF_CURL_PROGRESS_PROC) a_address;
|
||||
}
|
||||
|
||||
/* Set CURL_FUNCTOIN.write_function address */
|
||||
void c_set_write_function_address( EIF_POINTER a_address)
|
||||
{
|
||||
eiffel_write_function = (EIF_CURL_WRITE_PROC) a_address;
|
||||
}
|
||||
|
||||
/* Set CURL_FUNCTOIN.read_function address */
|
||||
void c_set_read_function_address( EIF_POINTER a_address)
|
||||
{
|
||||
eiffel_read_function = (EIF_CURL_READ_PROC) a_address;
|
||||
}
|
||||
|
||||
/* Set CURL_FUNCTOIN.debug_function address */
|
||||
void c_set_debug_function_address (EIF_POINTER a_address)
|
||||
{
|
||||
eiffel_debug_function = (EIF_CURL_DEBUG_PROC) a_address;
|
||||
}
|
||||
|
||||
/* Eiffel adapter function for CURLOPT_WRITEFUNCTION
|
||||
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
|
||||
size_t curl_write_function (void *ptr, size_t size, size_t nmemb, void *data)
|
||||
{
|
||||
if (eiffel_function_object) {
|
||||
return (size_t) ((eiffel_write_function) (
|
||||
#ifndef EIF_IL_DLL
|
||||
(EIF_REFERENCE) eif_access (eiffel_function_object),
|
||||
#endif
|
||||
(EIF_POINTER) ptr,
|
||||
(EIF_INTEGER) size,
|
||||
(EIF_INTEGER) nmemb,
|
||||
(EIF_POINTER) data));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Eiffel adapter function for CURLOPT_READFUNCTION
|
||||
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
|
||||
size_t curl_read_function (void *ptr, size_t size, size_t nmemb, void *data)
|
||||
{
|
||||
if (eiffel_function_object) {
|
||||
return (size_t) ((eiffel_read_function) (
|
||||
#ifndef EIF_IL_DLL
|
||||
(EIF_REFERENCE) eif_access (eiffel_function_object),
|
||||
#endif
|
||||
(EIF_POINTER) ptr,
|
||||
(EIF_INTEGER) size,
|
||||
(EIF_INTEGER) nmemb,
|
||||
(EIF_POINTER) data));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Eiffel adapter function for CURLOPT_PROGRESSFUNCTION
|
||||
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
|
||||
size_t curl_progress_function (void * a_object_id, double a_dltotal, double a_dlnow, double a_ultotal, double a_ulnow)
|
||||
{
|
||||
if (eiffel_function_object) {
|
||||
return (size_t) ((eiffel_progress_function) (
|
||||
#ifndef EIF_IL_DLL
|
||||
(EIF_REFERENCE) eif_access (eiffel_function_object),
|
||||
#endif
|
||||
(EIF_POINTER) a_object_id,
|
||||
(EIF_REAL_64) a_dltotal,
|
||||
(EIF_REAL_64) a_dlnow,
|
||||
(EIF_REAL_64) a_ultotal,
|
||||
(EIF_REAL_64) a_ulnow));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Eiffel adapter function for CURLOPT_DEBUGFUNCTION
|
||||
We need this function since Eiffel function call need first parameter is EIF_REFERENCE. */
|
||||
size_t curl_debug_function (CURL * a_curl_handle, curl_infotype a_curl_infotype, unsigned char * a_char_pointer, size_t a_size, void * a_object_id)
|
||||
{
|
||||
if (eiffel_function_object) {
|
||||
return (size_t) ((eiffel_debug_function) (
|
||||
#ifndef EIF_IL_DLL
|
||||
(EIF_REFERENCE) eif_access (eiffel_function_object),
|
||||
#endif
|
||||
(EIF_POINTER) a_curl_handle,
|
||||
(EIF_INTEGER) a_curl_infotype,
|
||||
(EIF_POINTER) a_char_pointer,
|
||||
(EIF_INTEGER) a_size,
|
||||
(EIF_POINTER) a_object_id));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="build_curl" default="help">
|
||||
|
||||
<description>
|
||||
description: "cURL library compilation"
|
||||
</description>
|
||||
|
||||
<target name="help">
|
||||
<echo message="usage:"/>
|
||||
<echo message=" geant compile"/>
|
||||
<echo message=" geant clean"/>
|
||||
<echo message=" geant clobber"/>
|
||||
</target>
|
||||
|
||||
<target name="compile">
|
||||
<echo message="- Compile [cURL]" />
|
||||
<geant target="compile" file="build.eant" dir="Clib"
|
||||
reuse_variables="true" />
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<echo message="- Clean [cURL]" />
|
||||
<delete directory="spec\${ISE_C_COMPILER}\${ISE_PLATFORM}" />
|
||||
</target>
|
||||
|
||||
<target name="clobber" depend="clean" />
|
||||
|
||||
</project>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" cat_call_detection="false" is_attached_by_default="true" void_safety="all" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ISE_LIBRARY)\library\cURL\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ISE_LIBRARY)/library/cURL/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<cluster name="curl" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="curl" uuid="D51EF190-6157-4B47-8E73-FA93DCBB7A71" library_target="curl">
|
||||
<target name="curl">
|
||||
<description>cURL: libcURL wrapper library for Eiffel.
|
||||
Copyright (c) 1984-2006, Eiffel Software and others.
|
||||
Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt).</description>
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/\.svn$</exclude>
|
||||
<exclude>/EIFGEN.{0,1}$</exclude>
|
||||
<exclude>/temp$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" namespace="EiffelSoftware.Library">
|
||||
</option>
|
||||
<setting name="dotnet_naming_convention" value="true"/>
|
||||
<external_include location="$(ISE_LIBRARY)\library\cURL\spec\include">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_include location="$(ISE_LIBRARY)/library/cURL/spec/include">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
</condition>
|
||||
</external_include>
|
||||
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/eiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)/library/cURL/spec/$(ISE_PLATFORM)/lib/MTeiffel_curl.o">
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\eiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="false"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\mteiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<multithreaded value="true"/>
|
||||
<dotnet value="false"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<external_object location="$(ISE_LIBRARY)\library\cURL\spec\$(ISE_C_COMPILER)\$(ISE_PLATFORM)\lib\ileiffel_curl.lib">
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
<dotnet value="true"/>
|
||||
</condition>
|
||||
</external_object>
|
||||
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<cluster name="curl" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/spec$</exclude>
|
||||
<exclude>/Clib$</exclude>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/gtk$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform value="windows"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/gtk$</exclude>
|
||||
<condition>
|
||||
<platform value="macintosh"/>
|
||||
<custom name="vision_implementation" value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
<file_rule>
|
||||
<exclude>/mswin$</exclude>
|
||||
<exclude>/mac$</exclude>
|
||||
<condition>
|
||||
<platform excluded_value="windows"/>
|
||||
<custom name="vision_implementation" excluded_value="cocoa"/>
|
||||
</condition>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="curl_dotnet" extends="curl">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,336 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
All possible error codes from all sorts of curl functions.
|
||||
Future versions may return other values, stay prepared.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_CODES
|
||||
|
||||
feature -- Eiffel cURL: Constants
|
||||
|
||||
eiffelcurle_error_occurred: INTEGER = -1
|
||||
-- Error occurred in Eiffel cURL internals
|
||||
|
||||
feature -- Constants
|
||||
|
||||
curle_ok: INTEGER = 0
|
||||
-- Declared as CURLE_OK
|
||||
|
||||
curle_unsupported_protocol: INTEGER = 1
|
||||
-- Declared as CURLE_UNSUPPORTED_PROTOCOL
|
||||
|
||||
curle_failed_init: INTEGER = 2
|
||||
-- Declared as CURLE_FAILED_INIT
|
||||
|
||||
curle_url_malformat: INTEGER = 3
|
||||
-- Declared as CURLE_URL_MALFORMAT
|
||||
|
||||
curle_obsolete4: INTEGER = 4
|
||||
-- Declared as CURLE_OBSOLETE4
|
||||
-- NOT USED
|
||||
|
||||
curle_couldnt_resolve_proxy: INTEGER = 5
|
||||
-- Declared as CURLE_COULDNT_RESOLVE_PROXY
|
||||
|
||||
curle_couldnt_resolve_host: INTEGER = 6
|
||||
-- Declared as CURLE_COULDNT_RESOLVE_HOST
|
||||
|
||||
curle_couldnt_connect: INTEGER = 7
|
||||
-- Declared as CURLE_COULDNT_CONNECT
|
||||
|
||||
curle_ftp_weird_server_reply: INTEGER = 8
|
||||
-- Declared as CURLE_FTP_WEIRD_SERVER_REPLY
|
||||
|
||||
curle_remote_access_denied: INTEGER = 9
|
||||
-- Declared as CURLE_REMOTE_ACCESS_DENIED
|
||||
-- A service was denied by the server due to lack of access
|
||||
-- when login fails this is not returned.
|
||||
|
||||
curle_obsolete10: INTEGER = 10
|
||||
-- Declared as CURLE_OBSOLETE10 NOT USED
|
||||
|
||||
curle_ftp_weird_pass_reply: INTEGER = 11
|
||||
-- Declared as CURLE_FTP_WEIRD_PASS_REPLY
|
||||
|
||||
curle_obsolete12: INTEGER = 12
|
||||
-- Declared as CURLE_OBSOLETE12 NOT USED
|
||||
|
||||
curle_ftp_weird_pasv_reply: INTEGER = 13
|
||||
-- Declared as CURLE_FTP_WEIRD_PASV_REPLY
|
||||
|
||||
curle_ftp_weird_227_format: INTEGER = 14
|
||||
-- Declared as CURLE_FTP_WEIRD_227_FORMAT
|
||||
|
||||
curle_ftp_cant_get_host: INTEGER = 15
|
||||
-- Declared as CURLE_FTP_CANT_GET_HOST
|
||||
|
||||
curle_obsolete16: INTEGER = 16
|
||||
-- Declared as CURLE_OBSOLETE16
|
||||
-- NOT USED
|
||||
|
||||
curle_ftp_couldnt_set_type: INTEGER = 17
|
||||
-- Declared as CURLE_FTP_COULDNT_SET_TYPE
|
||||
|
||||
curle_partial_file: INTEGER = 18
|
||||
-- Declared as CURLE_PARTIAL_FILE
|
||||
|
||||
curle_ftp_couldnt_retr_file: INTEGER = 19
|
||||
-- Declared as CURLE_FTP_COULDNT_RETR_FILE
|
||||
|
||||
curle_obsolete20: INTEGER = 20
|
||||
-- Declared as CURLE_OBSOLETE20
|
||||
-- NOT USED
|
||||
|
||||
curle_quote_error: INTEGER = 21
|
||||
-- Declared as CURLE_QUOTE_ERROR
|
||||
-- quote command failure
|
||||
|
||||
curle_http_returned_error: INTEGER = 22
|
||||
-- Declared as CURLE_HTTP_RETURNED_ERROR
|
||||
|
||||
curle_write_error: INTEGER = 23
|
||||
-- Declared as CURLE_WRITE_ERROR
|
||||
|
||||
curle_obsolete24: INTEGER = 24
|
||||
-- Declared as CURLE_OBSOLETE24 NOT USED
|
||||
|
||||
curle_upload_failed: INTEGER = 25
|
||||
-- Declared as CURLE_UPLOAD_FAILED
|
||||
-- failed upload "command"
|
||||
|
||||
curle_read_error: INTEGER = 26
|
||||
-- Declared as CURLE_READ_ERROR
|
||||
-- couldn't open/read from file
|
||||
|
||||
curle_out_of_memory: INTEGER = 27
|
||||
-- Declared as CURLE_OUT_OF_MEMORY
|
||||
-- Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
|
||||
-- instead of a memory allocation error if CURL_DOES_CONVERSIONS
|
||||
-- is defined
|
||||
|
||||
curle_operation_timedout: INTEGER = 28
|
||||
-- Declared as CURLE_OPERATION_TIMEDOUT
|
||||
-- the timeout time was reached
|
||||
|
||||
curle_obsolete29: INTEGER = 29
|
||||
-- Declared as CURLE_OBSOLETE29
|
||||
-- NOT USED
|
||||
|
||||
curle_ftp_port_failed: INTEGER = 30
|
||||
-- Declared as CURLE_FTP_PORT_FAILED
|
||||
-- FTP PORT operation failed
|
||||
|
||||
curle_ftp_couldnt_use_rest: INTEGER = 31
|
||||
-- Declared as CURLE_FTP_COULDNT_USE_REST
|
||||
-- the REST command failed
|
||||
|
||||
curle_obsolete32: INTEGER = 32
|
||||
-- Declared as CURLE_OBSOLETE32
|
||||
-- NOT USED
|
||||
|
||||
curle_range_error: INTEGER = 33
|
||||
-- Declared as CURLE_RANGE_ERROR
|
||||
-- RANGE "command" didn't work
|
||||
|
||||
curle_http_post_error: INTEGER = 34
|
||||
-- Declared as CURLE_HTTP_POST_ERROR
|
||||
|
||||
curle_ssl_connect_error: INTEGER = 35
|
||||
-- Declared CURLE_SSL_CONNECT_ERROR
|
||||
-- wrong when connecting with SSL
|
||||
|
||||
curle_bad_download_resume: INTEGER = 36
|
||||
-- Declared as CURLE_BAD_DOWNLOAD_RESUME
|
||||
-- couldn't resume download
|
||||
|
||||
curle_file_couldnt_read_file: INTEGER = 37
|
||||
-- Declared as CURLE_FILE_COULDNT_READ_FILE
|
||||
|
||||
curle_ldap_cannot_bind: INTEGER = 38
|
||||
-- Declared as CURLE_LDAP_CANNOT_BIND
|
||||
|
||||
curle_ldap_search_failed: INTEGER = 39
|
||||
-- Declared as CURLE_LDAP_SEARCH_FAILED
|
||||
|
||||
curle_obsolete40: INTEGER = 40
|
||||
-- Declared as CURLE_OBSOLETE40
|
||||
-- NOT USED
|
||||
|
||||
curle_function_not_found: INTEGER = 41
|
||||
-- Declared as CURLE_FUNCTION_NOT_FOUND
|
||||
|
||||
curle_aborted_by_callback: INTEGER = 42
|
||||
-- Declared as CURLE_ABORTED_BY_CALLBACK
|
||||
|
||||
curle_bad_function_argument: INTEGER = 43
|
||||
-- Declared as CURLE_BAD_FUNCTION_ARGUMENT
|
||||
|
||||
curle_obsolete44: INTEGER = 44
|
||||
-- Declared as CURLE_OBSOLETE44
|
||||
-- NOT USED
|
||||
|
||||
curle_interface_failed: INTEGER = 45
|
||||
-- Declared as CURLE_INTERFACE_FAILED
|
||||
-- CURLOPT_INTERFACE failed
|
||||
|
||||
curle_obsolete46: INTEGER = 46
|
||||
-- Declared as CURLE_OBSOLETE46
|
||||
-- NOT USED
|
||||
|
||||
curle_too_many_redirects: INTEGER = 47
|
||||
-- Declared as CURLE_TOO_MANY_REDIRECTS
|
||||
-- catch endless re-direct loops
|
||||
|
||||
curle_unknown_telnet_option: INTEGER = 48
|
||||
-- Declared as CURLE_UNKNOWN_TELNET_OPTION
|
||||
-- User specified an unknown option
|
||||
|
||||
curle_telnet_option_syntax: INTEGER = 49
|
||||
-- Declared as CURLE_TELNET_OPTION_SYNTAX
|
||||
-- Malformed telnet option
|
||||
|
||||
curle_obsolete50: INTEGER = 50
|
||||
-- Declared as CURLE_OBSOLETE50
|
||||
-- NOT USED
|
||||
|
||||
curle_ssl_peer_certificate: INTEGER = 51
|
||||
-- Declared as CURLE_SSL_PEER_CERTIFICATE
|
||||
-- peer's certificate wasn't ok
|
||||
|
||||
curle_got_nothing: INTEGER = 52
|
||||
-- Declared as CURLE_GOT_NOTHING
|
||||
-- when this is a specific error
|
||||
|
||||
curle_ssl_engine_notfound: INTEGER = 53
|
||||
-- Declared as CURLE_SSL_ENGINE_NOTFOUND
|
||||
-- SSL crypto engine not found */
|
||||
|
||||
curle_ssl_engine_setfailed: INTEGER = 54
|
||||
-- Declared as CURLE_SSL_ENGINE_SETFAILED
|
||||
-- can not set SSL crypto engine as default
|
||||
|
||||
curle_send_error: INTEGER = 55
|
||||
-- Declared as CURLE_SEND_ERROR
|
||||
-- failed sending network data
|
||||
|
||||
curle_recv_error: INTEGER = 56
|
||||
-- Declared as CURLE_RECV_ERROR
|
||||
-- failure in receiving network data
|
||||
|
||||
curle_obsolete57: INTEGER = 57
|
||||
-- Declared as CURLE_OBSOLETE57
|
||||
-- NOT IN USE
|
||||
|
||||
curle_ssl_certproblem: INTEGER = 58
|
||||
-- Declared as CURLE_SSL_CERTPROBLEM
|
||||
-- problem with the local certificate
|
||||
|
||||
curle_ssl_cipher: INTEGER = 59
|
||||
-- Declared as CURLE_SSL_CIPHER
|
||||
-- couldn't use specified cipher
|
||||
|
||||
curle_ssl_cacert: INTEGER = 60
|
||||
-- Declared as CURLE_SSL_CACERT
|
||||
-- problem with the CA cert (path?)
|
||||
|
||||
curle_bad_content_encoding: INTEGER = 61
|
||||
-- Declared as CURLE_BAD_CONTENT_ENCODING
|
||||
-- Unrecognized transfer encoding
|
||||
|
||||
curle_ldap_invalid_url: INTEGER = 62
|
||||
-- Declared as CURLE_LDAP_INVALID_URL
|
||||
-- Invalid LDAP URL
|
||||
|
||||
curle_filesize_exceeded: INTEGER = 63
|
||||
-- Declared as CURLE_FILESIZE_EXCEEDED
|
||||
-- Maximum file size exceeded
|
||||
|
||||
curle_use_ssl_failed: INTEGER = 64
|
||||
-- Declared as CURLE_USE_SSL_FAILED
|
||||
-- Requested FTP SSL level failed
|
||||
|
||||
curle_send_fail_rewind: INTEGER = 65
|
||||
-- Declared as CURLE_SEND_FAIL_REWIND
|
||||
-- Sending the data requires a rewind that failed
|
||||
|
||||
curle_ssl_engine_initfailed: INTEGER = 66
|
||||
-- Declared as CURLE_SSL_ENGINE_INITFAILED
|
||||
-- failed to initialise ENGINE
|
||||
|
||||
curle_login_denied: INTEGER = 67
|
||||
-- Declared as CURLE_LOGIN_DENIED
|
||||
-- user, password or similar was not accepted and we failed to login
|
||||
|
||||
curle_tftp_notfound: INTEGER = 68
|
||||
-- Declared as CURLE_TFTP_NOTFOUND
|
||||
-- file not found on server
|
||||
|
||||
curle_tftp_perm: INTEGER = 69
|
||||
-- Declared as CURLE_TFTP_PERM
|
||||
-- permission problem on server
|
||||
|
||||
curle_remote_disk_full: INTEGER = 70
|
||||
-- Declared as CURLE_REMOTE_DISK_FULL
|
||||
-- out of disk space on server
|
||||
|
||||
curle_tftp_illegal: INTEGER = 71
|
||||
-- Declared as CURLE_TFTP_ILLEGAL
|
||||
-- Illegal TFTP operation
|
||||
|
||||
curle_tftp_unknownid: INTEGER = 72
|
||||
-- Declared as CURLE_TFTP_UNKNOWNID
|
||||
-- Unknown transfer ID
|
||||
|
||||
curle_remote_file_exists: INTEGER = 73
|
||||
-- Declared as CURLE_REMOTE_FILE_EXISTS
|
||||
-- File already exists
|
||||
|
||||
curle_tftp_nosuchuser: INTEGER = 74
|
||||
-- Declared as CURLE_TFTP_NOSUCHUSER
|
||||
-- No such user
|
||||
|
||||
curle_conv_failed: INTEGER = 75
|
||||
-- Declared as CURLE_CONV_FAILED
|
||||
-- conversion failed
|
||||
|
||||
curle_conv_reqd: INTEGER = 76
|
||||
-- Declared as CURLE_CONV_REQD
|
||||
-- caller must register conversion callbacks using curl_easy_setopt options
|
||||
-- CURLOPT_CONV_FROM_NETWORK_FUNCTION, CURLOPT_CONV_TO_NETWORK_FUNCTION, and
|
||||
-- CURLOPT_CONV_FROM_UTF8_FUNCTION
|
||||
|
||||
curle_ssl_cacert_badfile: INTEGER = 77
|
||||
-- Declared as CURLE_SSL_CACERT_BADFILE
|
||||
-- could not load CACERT file, missing or wrong format
|
||||
|
||||
curle_remote_file_not_found: INTEGER = 78
|
||||
-- Declared as CURLE_REMOTE_FILE_NOT_FOUND
|
||||
-- remote file not found
|
||||
|
||||
curle_ssh: INTEGER = 79
|
||||
-- Declared as CURLE_SSH
|
||||
-- error from the SSH layer, somewhat generic so the error message will be of
|
||||
-- interest when this has happened
|
||||
|
||||
curle_ssl_shutdown_failed: INTEGER = 80;
|
||||
-- Declared as CURLE_SSL_SHUTDOWN_FAILED
|
||||
-- Failed to shut down the SSL connection
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,104 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Default implementation of CURL_FUNCTION.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_DEFAULT_FUNCTION
|
||||
|
||||
inherit
|
||||
CURL_FUNCTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Creation method
|
||||
do
|
||||
set_object_and_function_address
|
||||
end
|
||||
|
||||
feature -- Command
|
||||
|
||||
progress_function (a_object_id: POINTER; a_download_total, a_download_now, a_upload_total, a_upload_now: REAL_64): INTEGER
|
||||
do
|
||||
end
|
||||
|
||||
write_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
|
||||
local
|
||||
l_c_string: C_STRING
|
||||
do
|
||||
-- Returns the number of bytes actually saved into object identified by `a_object_id'
|
||||
Result := a_size * a_nmemb
|
||||
create l_c_string.make_shared_from_pointer_and_count (a_data_pointer, Result)
|
||||
|
||||
check attached {CURL_STRING} (create {IDENTIFIED}).id_object (a_object_id.to_integer_32) as l_string then
|
||||
l_string.append (l_c_string.substring (1, Result))
|
||||
end
|
||||
end
|
||||
|
||||
read_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
|
||||
-- A callback readfunction
|
||||
do
|
||||
end
|
||||
|
||||
debug_function (a_curl_handle: POINTER; a_curl_infotype: INTEGER; a_char_pointer: POINTER; a_size: INTEGER; a_object_id: POINTER): INTEGER
|
||||
local
|
||||
l_c_string: C_STRING
|
||||
do
|
||||
inspect
|
||||
a_curl_infotype
|
||||
when {CURL_INFO_TYPE}.curlinfo_data_in then
|
||||
dump ("<= Recv data", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_data_out then
|
||||
dump ("=> Send data", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_header_in then
|
||||
dump ("<= Recv header", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_header_out then
|
||||
dump ("=> Send header", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_ssl_data_in then
|
||||
dump ("<= Recv SSL data", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_ssl_data_out then
|
||||
dump ("=> Send SSL data", a_char_pointer, a_size)
|
||||
when {CURL_INFO_TYPE}.curlinfo_text then
|
||||
create l_c_string.make_by_pointer_and_count (a_char_pointer, a_size)
|
||||
print ("%N== Info: " + l_c_string.string)
|
||||
else
|
||||
check type_unknow: False end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
dump (a_text: STRING; a_char_pointer: POINTER; a_size: INTEGER)
|
||||
-- Dump debug information
|
||||
require
|
||||
not_void: a_text /= Void
|
||||
exists: a_char_pointer /= default_pointer
|
||||
non_negative: a_size >= 0
|
||||
local
|
||||
l_c_string: C_STRING
|
||||
do
|
||||
create l_c_string.make_shared_from_pointer_and_count (a_char_pointer, a_size)
|
||||
print ("%N" + a_text + "%N" + l_c_string.string)
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,409 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL easy externals.
|
||||
For more informaton see:
|
||||
http://curl.haxx.se/libcurl/c/
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_EASY_EXTERNALS
|
||||
|
||||
feature -- Command
|
||||
|
||||
init: POINTER
|
||||
-- Declared as curl_easy_init().
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_init")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_init (l_api)
|
||||
end
|
||||
ensure
|
||||
exists: Result /= default_pointer
|
||||
end
|
||||
|
||||
setopt_string (a_curl_handle: POINTER; a_opt: INTEGER; a_string: READABLE_STRING_GENERAL)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
not_void: a_string /= Void
|
||||
local
|
||||
l_api: POINTER
|
||||
l_c_str: C_STRING
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
create l_c_str.make (a_string)
|
||||
c_setopt (l_api, a_curl_handle, a_opt, l_c_str.item)
|
||||
end
|
||||
end
|
||||
|
||||
setopt_form (a_curl_handle: POINTER; a_opt: INTEGER; a_form: CURL_FORM)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
not_void: a_form /= Void and then a_form.is_exists
|
||||
do
|
||||
setopt_void_star (a_curl_handle, a_opt, a_form.item)
|
||||
end
|
||||
|
||||
setopt_slist (a_curl_handle: POINTER; a_opt: INTEGER; a_curl_slist: POINTER)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: a_opt = {CURL_OPT_CONSTANTS}.curlopt_httpheader
|
||||
exists: a_curl_slist /= default_pointer
|
||||
do
|
||||
setopt_void_star (a_curl_handle, a_opt, a_curl_slist)
|
||||
end
|
||||
|
||||
setopt_curl_string (a_curl_handle: POINTER; a_opt: INTEGER; a_curl_string: CURL_STRING)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
not_void: a_curl_string /= Void
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
c_setopt_int (l_api, a_curl_handle, a_opt, a_curl_string.object_id)
|
||||
end
|
||||
end
|
||||
|
||||
setopt_integer (a_curl_handle: POINTER; a_opt: INTEGER; a_integer: INTEGER)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
c_setopt_int (l_api, a_curl_handle, a_opt, a_integer)
|
||||
end
|
||||
end
|
||||
|
||||
setopt_file (a_curl_handle: POINTER; a_opt: INTEGER; a_file: FILE)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: a_opt = {CURL_OPT_CONSTANTS}.curlopt_readdata
|
||||
readable: a_file /= Void and then a_file.file_readable
|
||||
do
|
||||
setopt_void_star (a_curl_handle, a_opt, a_file.file_pointer)
|
||||
end
|
||||
|
||||
perform (a_curl_handle: POINTER): INTEGER
|
||||
-- Declared as curl_easy_perform().
|
||||
-- Result is one value from {CURL_CODES}
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_perform")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_perform (l_api, a_curl_handle)
|
||||
else
|
||||
Result := {CURL_CODES}.eiffelcurle_error_occurred
|
||||
end
|
||||
end
|
||||
|
||||
cleanup (a_curl_handle: POINTER)
|
||||
-- Declared as curl_easy_cleanup().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_cleanup")
|
||||
if l_api /= default_pointer then
|
||||
c_cleanup (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
getinfo (a_curl_handle: POINTER; a_info: INTEGER; a_data: CELL [detachable ANY]): INTEGER
|
||||
-- `curl_getinfo
|
||||
--|* Request internal information from the curl session with this function. The
|
||||
--|* third argument MUST be a pointer to a long, a pointer to a char * or a
|
||||
--|* pointer to a double (as the documentation describes elsewhere). The data
|
||||
--|* pointed to will be filled in accordingly and can be relied upon only if the
|
||||
--|* function returns CURLE_OK. This function is intended to get used *AFTER* a
|
||||
--|* performed transfer, all results from this function are undefined until the
|
||||
--|* transfer is completed.
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_INFO_CONSTANTS}).is_valid (a_info)
|
||||
local
|
||||
l_api: POINTER
|
||||
mp: detachable MANAGED_POINTER
|
||||
l: INTEGER
|
||||
cs: C_STRING
|
||||
d: REAL_64
|
||||
do
|
||||
a_data.replace (Void)
|
||||
l_api := api_loader.api_pointer ("curl_easy_getinfo")
|
||||
if l_api /= default_pointer then
|
||||
if a_info & {CURL_INFO_CONSTANTS}.curlinfo_long /= 0 then
|
||||
create mp.make ({PLATFORM}.integer_32_bytes)
|
||||
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_string /= 0 then
|
||||
create mp.make ({PLATFORM}.pointer_bytes)
|
||||
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_double /= 0 then
|
||||
create mp.make ({PLATFORM}.real_64_bytes)
|
||||
end
|
||||
if mp /= Void then
|
||||
Result := c_getinfo (l_api, a_curl_handle, a_info, mp.item)
|
||||
if Result = {CURL_CODES}.curle_ok then
|
||||
if a_info & {CURL_INFO_CONSTANTS}.curlinfo_long /= 0 then
|
||||
l := mp.read_integer_32 (0)
|
||||
a_data.put (l)
|
||||
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_string /= 0 then
|
||||
create cs.make_shared_from_pointer (mp.read_pointer (0))
|
||||
a_data.put (cs.string)
|
||||
elseif a_info & {CURL_INFO_CONSTANTS}.curlinfo_double /= 0 then
|
||||
d := mp.read_real_64 (0)
|
||||
a_data.put (d)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_dynamic_library_exists: BOOLEAN
|
||||
-- If dll/so files exist?
|
||||
do
|
||||
Result := api_loader.is_interface_usable
|
||||
end
|
||||
|
||||
feature -- Special setting
|
||||
|
||||
set_curl_function (a_curl_function: CURL_FUNCTION)
|
||||
-- Set `curl_function' with `a_curl_function'
|
||||
do
|
||||
internal_curl_function := a_curl_function
|
||||
ensure
|
||||
set: a_curl_function /= Void implies curl_function = a_curl_function
|
||||
end
|
||||
|
||||
curl_function: CURL_FUNCTION
|
||||
-- cURL functions in curl_easy_setopt.
|
||||
do
|
||||
if attached internal_curl_function as l_curl_function then
|
||||
Result := l_curl_function
|
||||
else
|
||||
create {CURL_DEFAULT_FUNCTION} Result.make
|
||||
internal_curl_function := Result
|
||||
end
|
||||
ensure
|
||||
not_void: Result /= Void
|
||||
end
|
||||
|
||||
set_write_function (a_curl_handle: POINTER)
|
||||
-- Set cURL write function
|
||||
-- Set cURL write function with Eiffel default write function.
|
||||
-- So we can use CURL_STRING as parameter in {CURL_EASY_EXTERNALS}.setopt_curl_string when the option is {CURL_OPT_CONSTANTS}.curlopt_writedata
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
curl_function.c_set_write_function (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
set_read_function (a_curl_handle: POINTER)
|
||||
-- Set cURL read function
|
||||
-- Set cURL read function with Eiffel default read function.
|
||||
-- So we can use a c file pointer as parameter in {CURL_EASY_EXTERNALS}.setopt_file_pointer when the option is {CURL_OPT_CONSTANTS}.curlopt_readdata
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
curl_function.c_set_read_function (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
set_progress_function (a_curl_handle: POINTER)
|
||||
-- Set cURL progress function for upload/download progress.
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
curl_function.c_set_progress_function (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
set_debug_function (a_curl_handle: POINTER)
|
||||
-- Set cURL debug function
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
curl_function.c_set_debug_function (l_api, a_curl_handle)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
internal_curl_function: detachable CURL_FUNCTION
|
||||
-- cURL functions.
|
||||
|
||||
api_loader: DYNAMIC_MODULE
|
||||
-- Module name.
|
||||
local
|
||||
l_utility: CURL_UTILITY
|
||||
once
|
||||
create l_utility
|
||||
Result := l_utility.api_loader
|
||||
end
|
||||
|
||||
setopt_void_star (a_curl_handle: POINTER; a_opt: INTEGER; a_data:POINTER)
|
||||
-- Declared as curl_easy_setopt().
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||
if l_api /= default_pointer then
|
||||
c_setopt (l_api, a_curl_handle, a_opt, a_data)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- C externals
|
||||
|
||||
c_init (a_api: POINTER): POINTER
|
||||
-- Declared curl_easy_init ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURL *, ()) $a_api)();
|
||||
]"
|
||||
end
|
||||
|
||||
c_cleanup (a_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Decalred as curl_easy_cleanup ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (CURL *)) $a_api)((CURL *)$a_curl_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_perform (a_api: POINTER; a_curl_handle: POINTER): INTEGER
|
||||
-- Declared as curl_easy_perform().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLcode, (CURL *)) $a_api)
|
||||
((CURL *) $a_curl_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_setopt_int (a_api: POINTER; a_curl_handle: POINTER; a_opt: INTEGER; a_data: INTEGER)
|
||||
-- Same as `c_setopt' except we can pass `a_data' as integer.
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)$a_opt,
|
||||
$a_data);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_setopt (a_api: POINTER; a_curl_handle: POINTER; a_opt: INTEGER; a_data: POINTER)
|
||||
-- C implementation of `setopt_void_star'.
|
||||
-- Declared as curl_easy_setopt ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)$a_opt,
|
||||
$a_data);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_getinfo (a_api: POINTER; a_curl_handle: POINTER; a_opt: INTEGER; a_data: POINTER): INTEGER
|
||||
-- C implementation of `curl_easy_getinfo'.
|
||||
-- Declared as curl_easy_setopt ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_handle /= default_pointer
|
||||
valid: (create {CURL_OPT_CONSTANTS}).is_valid (a_opt)
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLcode, (CURL *, CURLINFO info, ...)) $a_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLINFO)$a_opt,
|
||||
$a_data);
|
||||
]"
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2010, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,254 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL externals.
|
||||
For more information, see:
|
||||
http://curl.haxx.se/libcurl/c/
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_EXTERNALS
|
||||
|
||||
feature -- Command
|
||||
|
||||
global_init
|
||||
-- Declared as curl_global_init().
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
local
|
||||
l_ptr: POINTER
|
||||
do
|
||||
l_ptr := api_loader.api_pointer ("curl_global_init")
|
||||
if l_ptr /= default_pointer then
|
||||
c_curl_global_init (l_ptr, {CURL_GLOBAL_CONSTANTS}.curl_global_all);
|
||||
end
|
||||
end
|
||||
|
||||
global_cleanup
|
||||
-- Declared as curl_global_cleanup().
|
||||
local
|
||||
l_ptr: POINTER
|
||||
do
|
||||
l_ptr := api_loader.api_pointer ("curl_global_cleanup")
|
||||
if l_ptr /= default_pointer then
|
||||
c_curl_global_cleanup (l_ptr);
|
||||
end
|
||||
end
|
||||
|
||||
formadd_string_string (a_form: CURL_FORM; a_last_pointer: CURL_FORM; a_arg_1: INTEGER; a_arg_1_value: READABLE_STRING_GENERAL; a_arg_2: INTEGER; a_arg_2_value: READABLE_STRING_GENERAL; a_arg_3: INTEGER)
|
||||
-- Declared as curl_formadd ().
|
||||
require
|
||||
not_void: a_form /= Void
|
||||
not_void: a_last_pointer /= Void
|
||||
valid: (create {CURL_FORM_CONSTANTS}).is_valid (a_arg_1)
|
||||
not_void: a_arg_1_value /= Void
|
||||
valid: (create {CURL_FORM_CONSTANTS}).is_valid (a_arg_2)
|
||||
not_void: a_arg_2_value /= Void
|
||||
valid: (create {CURL_FORM_CONSTANTS}).is_valid (a_arg_3)
|
||||
local
|
||||
l_form_pointer, l_last_pointer: POINTER
|
||||
do
|
||||
l_form_pointer := a_form.item
|
||||
l_last_pointer := a_last_pointer.item
|
||||
|
||||
internal_formadd_string_string ($l_form_pointer, $l_last_pointer, a_arg_1, a_arg_1_value, a_arg_2, a_arg_2_value, a_arg_3)
|
||||
|
||||
if a_form.item /= l_form_pointer then
|
||||
check not_set: a_form.item = default_pointer end
|
||||
a_form.set_item (l_form_pointer)
|
||||
end
|
||||
if a_last_pointer.item /= l_last_pointer then
|
||||
a_last_pointer.set_item (l_last_pointer)
|
||||
end
|
||||
end
|
||||
|
||||
slist_append (a_list: POINTER; a_string: READABLE_STRING_GENERAL): POINTER
|
||||
-- Declared as curl_slist_append ().
|
||||
-- note: call with a null `a_list' to get initialized pointer as Result
|
||||
require
|
||||
not_void: a_string /= Void
|
||||
local
|
||||
l_c_string: C_STRING
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_slist_append")
|
||||
if l_api /= default_pointer then
|
||||
create l_c_string.make (a_string)
|
||||
Result := c_slist_append (l_api, a_list, l_c_string.item)
|
||||
end
|
||||
end
|
||||
|
||||
slist_free_all (a_curl_slist: POINTER)
|
||||
-- Declared as curl_slist_free_all ().
|
||||
-- See: http://curl.haxx.se/libcurl/c/curl_slist_free_all.html
|
||||
-- curl_slist_free_all - free an entire curl_slist list
|
||||
-- This must be called when the data has been used, which typically means after the curl_easy_perform(3) has been called.
|
||||
require
|
||||
exists: a_curl_slist /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_slist_free_all")
|
||||
if l_api /= default_pointer then
|
||||
c_slist_free_all (l_api, a_curl_slist)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
is_dynamic_library_exists: BOOLEAN
|
||||
-- If dll/so files exist?
|
||||
do
|
||||
Result := api_loader.is_interface_usable
|
||||
end
|
||||
|
||||
feature {CURL_FORM} -- Internal command
|
||||
|
||||
formfree (a_curl_form: POINTER)
|
||||
-- Declared as curl_formfree ().
|
||||
-- See: http://curl.askapache.com/libcurl/c/curl_formfree.html
|
||||
-- curl_formfree() is used to clean up data previously built/appended with curl_formadd(3).
|
||||
-- This must be called when the data has been used, which typically means after the curl_easy_perform(3) has been called.
|
||||
require
|
||||
exists: a_curl_form /= default_pointer
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_formfree")
|
||||
if l_api /= default_pointer then
|
||||
c_formfree (l_api, a_curl_form)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
api_loader: DYNAMIC_MODULE
|
||||
-- Module name.
|
||||
local
|
||||
l_utility: CURL_UTILITY
|
||||
once
|
||||
create l_utility
|
||||
Result := l_utility.api_loader
|
||||
end
|
||||
|
||||
internal_formadd_string_string (a_form: TYPED_POINTER [POINTER]; a_last_pointer: TYPED_POINTER [POINTER]; a_arg_1: INTEGER; a_arg_1_value: READABLE_STRING_GENERAL; a_arg_2: INTEGER; a_arg_2_value: READABLE_STRING_GENERAL; a_arg_3: INTEGER)
|
||||
-- Declared as curl_formadd ().
|
||||
local
|
||||
l_c_string_1, l_c_string_2: C_STRING
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_formadd");
|
||||
if l_api /= default_pointer then
|
||||
create l_c_string_1.make (a_arg_1_value)
|
||||
create l_c_string_2.make (a_arg_2_value)
|
||||
c_formadd_string_string (l_api, a_form, a_last_pointer, a_arg_1, l_c_string_1.item, a_arg_2, l_c_string_2.item, a_arg_3)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- C externals
|
||||
|
||||
c_formadd_string_string (a_api: POINTER; a_form: TYPED_POINTER [POINTER]; a_last_pointer: TYPED_POINTER [POINTER]; a_arg_1: INTEGER; a_arg_1_value: POINTER; a_arg_2: INTEGER; a_arg_2_value: POINTER; a_arg_3: INTEGER)
|
||||
-- C implementation of formadd_string_string ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (struct curl_httppost **, struct curl_httppost **, int, char *, int, char *, int)) $a_api)
|
||||
((struct curl_httppost **)$a_form,
|
||||
(struct curl_httppost **)$a_last_pointer,
|
||||
(int)$a_arg_1,
|
||||
(char *)$a_arg_1_value,
|
||||
(int)$a_arg_2,
|
||||
(char *)$a_arg_2_value,
|
||||
(int)$a_arg_3);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_formfree (a_api: POINTER; a_curl_form: POINTER)
|
||||
-- Declared as curl_formfree ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
exists: a_curl_form /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (struct curl_httppost *)) $a_api)
|
||||
((struct curl_httppost *) $a_curl_form);
|
||||
]"
|
||||
end
|
||||
|
||||
c_curl_global_init (a_api: POINTER; a_opt: NATURAL_64)
|
||||
-- `a_api' point to API curl_global_init ()
|
||||
-- `a_opt' is intialization option.
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (long)) $a_api)((long) $a_opt);
|
||||
]"
|
||||
end
|
||||
|
||||
c_curl_global_cleanup (a_api: POINTER)
|
||||
-- `a_api' point to API curl_global_cleanup()
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, ()) $a_api)();
|
||||
]"
|
||||
end
|
||||
|
||||
c_slist_append (a_api: POINTER; a_list_pointer: POINTER; a_string: POINTER): POINTER
|
||||
-- Declared as curl_slist_append ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
return (FUNCTION_CAST(void *, (struct curl_slist *, const char *)) $a_api)
|
||||
((struct curl_slist *)$a_list_pointer,
|
||||
(const char *)$a_string);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_slist_free_all (a_api: POINTER; a_list_pointer: POINTER)
|
||||
-- Declared as void curl_slist_free_all(struct curl_slist * list)
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void *, (struct curl_slist *)) $a_api)
|
||||
((struct curl_slist *)$a_list_pointer);
|
||||
]"
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2010, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,94 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL form.
|
||||
For more informaton see:
|
||||
http://curl.haxx.se/libcurl/c/curl_formadd.html
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_FORM
|
||||
|
||||
inherit
|
||||
DISPOSABLE
|
||||
|
||||
create
|
||||
make,
|
||||
share_with_pointer
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Creation method.
|
||||
do
|
||||
end
|
||||
|
||||
share_with_pointer (a_pointer: POINTER)
|
||||
-- Creation method.
|
||||
-- `item' share with `a_pointer'.
|
||||
require
|
||||
exists: a_pointer /= default_pointer
|
||||
do
|
||||
item := a_pointer
|
||||
ensure
|
||||
set: item = a_pointer
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
item: POINTER
|
||||
-- C pointer of Current.
|
||||
|
||||
is_exists: BOOLEAN
|
||||
-- If C pointer exists?
|
||||
do
|
||||
Result := item /= default_pointer
|
||||
end
|
||||
|
||||
feature -- Command
|
||||
|
||||
dispose
|
||||
-- Free memory if possible.
|
||||
local
|
||||
l_curl: CURL_EXTERNALS
|
||||
do
|
||||
if item /= default_pointer then
|
||||
create l_curl
|
||||
l_curl.formfree (item)
|
||||
item := default_pointer
|
||||
end
|
||||
end
|
||||
|
||||
release_item
|
||||
-- Release item
|
||||
-- NOT free memory! This is useful if Current generated by {CURL_EXTERNALS}.formadd_string_string.
|
||||
do
|
||||
item := default_pointer
|
||||
end
|
||||
|
||||
feature {CURL_EXTERNALS} -- Internal command
|
||||
|
||||
set_item (a_item: POINTER)
|
||||
-- Set `item' with `a_item'
|
||||
do
|
||||
item := a_item
|
||||
ensure
|
||||
set: item = a_item
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,78 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL form constants.
|
||||
For more informaton see:
|
||||
http://curl.haxx.se/libcurl/c/curl_formadd.html
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_FORM_CONSTANTS
|
||||
|
||||
feature -- Query
|
||||
|
||||
curlform_copyname: INTEGER
|
||||
-- Declared as CURLFORM_COPYNAME
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
CURLFORM_COPYNAME
|
||||
]"
|
||||
end
|
||||
|
||||
curlform_copycontents: INTEGER
|
||||
-- Declared as CURLFORM_COPYCONTENTS
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
CURLFORM_COPYCONTENTS
|
||||
]"
|
||||
end
|
||||
|
||||
curlform_end: INTEGER
|
||||
-- Declared as CURLFORM_END
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
CURLFORM_END
|
||||
]"
|
||||
end
|
||||
|
||||
curlform_file: INTEGER
|
||||
-- Declared as CURLFORM_FILE
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
CURLFORM_FILE
|
||||
]"
|
||||
end
|
||||
|
||||
is_valid (a_integer: INTEGER): BOOLEAN
|
||||
-- If `a_integer' valid?
|
||||
do
|
||||
Result := a_integer = curlform_copycontents or
|
||||
a_integer = curlform_copyname or
|
||||
a_integer = curlform_end or
|
||||
a_integer = curlform_file
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,257 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL curl_easy_setopt callback functions' Eiffel wrappers.
|
||||
We need this class since cURL need a c function pointer as value but
|
||||
Eiffel function need frist parameter of any funciton call is object address.
|
||||
Client programmers can inherit this class to fit their needs.
|
||||
|
||||
Note: descendants of this class have to call `set_object_and_function_address',
|
||||
otherwise cURL would not know how to call Eiffel features (such as `write_function').
|
||||
See example: $ISE_LIBRARY\examples\cURL\upload_and_read_function
|
||||
|
||||
See http://curl.haxx.se/libcurl/c/curl_easy_setopt.html for libcurl documentation
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CURL_FUNCTION
|
||||
|
||||
inherit
|
||||
DISPOSABLE
|
||||
|
||||
feature -- Interactive with C
|
||||
|
||||
set_object_and_function_address
|
||||
-- Set object and function addresses.
|
||||
-- Call this feature before call `c_set_progress_function', `c_set_debug_function' and `c_set_write_function, c_set_read_function'.
|
||||
do
|
||||
c_set_object ($Current)
|
||||
c_set_progress_function_address ($progress_function)
|
||||
c_set_write_function_address ($write_function)
|
||||
c_set_read_function_address ($read_function)
|
||||
c_set_debug_function_address ($debug_function)
|
||||
end
|
||||
|
||||
c_set_progress_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Setting CURLOPT_PROGRESSFUNCTION option of `a_curl_handle'.
|
||||
-- We need this function since cURL need a c function pointer as value.
|
||||
require
|
||||
exists: a_setopt_api /= default_pointer
|
||||
external
|
||||
"C inline use <eiffel_curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)CURLOPT_PROGRESSFUNCTION,
|
||||
curl_progress_function);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_set_debug_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Setting CURLOPT_DEBUGFUNCTION option of `a_curl_handle'.
|
||||
-- We need this function since cURL need a c function pointer as value.
|
||||
require
|
||||
exists: a_curl_handle /= default_pointer
|
||||
external
|
||||
"C inline use <eiffel_curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)CURLOPT_DEBUGFUNCTION,
|
||||
curl_debug_function);
|
||||
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_set_write_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Setting CURLOPT_WRITEFUNCTION option of `a_curl_handle'.
|
||||
-- We need this function since cURL need a c function pointer as value.
|
||||
require
|
||||
exists: a_setopt_api /= default_pointer
|
||||
external
|
||||
"C inline use <eiffel_curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)CURLOPT_WRITEFUNCTION,
|
||||
curl_write_function);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
c_set_read_function (a_setopt_api: POINTER; a_curl_handle: POINTER)
|
||||
-- Setting CURLOPT_READFUNCTION option of `a_curl_handle'.
|
||||
-- We need this function since cURL need a c function pointer as value.
|
||||
require
|
||||
exists: a_setopt_api /= default_pointer
|
||||
external
|
||||
"C inline use <eiffel_curl.h>"
|
||||
alias
|
||||
"[
|
||||
{
|
||||
(FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api)
|
||||
((CURL *) $a_curl_handle,
|
||||
(CURLoption)CURLOPT_READFUNCTION,
|
||||
curl_read_function);
|
||||
}
|
||||
]"
|
||||
end
|
||||
|
||||
feature -- cURL curl_easy_setopt functions
|
||||
|
||||
progress_function (a_object_id: POINTER; a_download_total, a_download_now, a_upload_total, a_upload_now: REAL_64): INTEGER
|
||||
-- Function correspond to {CURL_OPT_CONSTANTS}.curlopt_progressfunction
|
||||
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
|
||||
-- may changed during GC.
|
||||
deferred
|
||||
end
|
||||
|
||||
write_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
|
||||
-- Function called by libcurl as soon as there is data received that needs to be saved.
|
||||
-- The size of the data pointed to by `a_data_pointer' is `a_size' multiplied with `a_nmemb', it will not be null terminated.
|
||||
-- Returns the number of bytes actually taken care of
|
||||
--
|
||||
-- Function corresponds to {CURL_OPT_CONSTANTS}.curlopt_writefunction
|
||||
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
|
||||
-- may changed during GC.
|
||||
--| libcurl doc:
|
||||
--| Function pointer that should match the following prototype: size_t function( char *ptr, size_t size, size_t nmemb, void *userdata);
|
||||
--| This function gets called by libcurl as soon as there is data received that needs to be saved.
|
||||
--| The size of the data pointed to by ptr is size multiplied with nmemb, it will not be zero terminated.
|
||||
--| Return the number of bytes actually taken care of.
|
||||
--| If that amount differs from the amount passed to your function, it'll signal an error to the library.
|
||||
--| This will abort the transfer and return CURLE_WRITE_ERROR.
|
||||
--| From 7.18.0, the function can return CURL_WRITEFUNC_PAUSE which then will cause writing to this connection to become paused.
|
||||
--| See curl_easy_pause(3) for further details.
|
||||
--|
|
||||
--| This function may be called with zero bytes data if the transferred file is empty.
|
||||
--|
|
||||
--| Set this option to NULL to get the internal default function.
|
||||
--| The internal default function will write the data to the FILE * given with CURLOPT_WRITEDATA.
|
||||
--|
|
||||
--| Set the userdata argument with the CURLOPT_WRITEDATA option.
|
||||
--|
|
||||
--| The callback function will be passed as much data as possible in all invokes,
|
||||
--| but you cannot possibly make any assumptions. It may be one byte, it may be thousands.
|
||||
--| The maximum amount of body data that can be passed to the write callback is defined
|
||||
--| in the curl.h header file: CURL_MAX_WRITE_SIZE (the usual default is 16K).
|
||||
--| If you however have CURLOPT_HEADER set, which sends header data to the write callback,
|
||||
--| you can get up to CURL_MAX_HTTP_HEADER bytes of header data passed into it. This usually means 100K.
|
||||
deferred
|
||||
end
|
||||
|
||||
read_function (a_data_pointer: POINTER; a_size, a_nmemb: INTEGER; a_object_id: POINTER): INTEGER
|
||||
-- Function called by libcurl as soon as it needs to read data in order to send it to the peer.
|
||||
-- The data area pointed at by the pointer `a_data_pointer' may be filled with at most
|
||||
-- `a_size' multiplied with `a_nmemb' number of bytes.
|
||||
-- Returns the actual number of bytes stored in that memory area.
|
||||
-- Returning 0 will signal end-of-file to the library and cause it to stop the current transfer.
|
||||
--
|
||||
-- Function corresponds to {CURL_OPT_CONSTANTS}.curlopt_readfunction
|
||||
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
|
||||
-- may changed during GC.
|
||||
--| libcurl doc:
|
||||
--| Function pointer that should match the following prototype: size_t function( void *ptr, size_t size, size_t nmemb, void *userdata);
|
||||
--| This function gets called by libcurl as soon as it needs to read data in order to send it to the peer.
|
||||
--| The data area pointed at by the pointer ptr may be filled with at most size multiplied with nmemb number of bytes.
|
||||
--| Your function must return the actual number of bytes that you stored in that memory area.
|
||||
--| Returning 0 will signal end-of-file to the library and cause it to stop the current transfer.
|
||||
--|
|
||||
--| If you stop the current transfer by returning 0 "pre-maturely" (i.e before the server expected it,
|
||||
--| like when you've said you will upload N bytes and you upload less than N bytes),
|
||||
--| you may experience that the server "hangs" waiting for the rest of the data that won't come.
|
||||
--|
|
||||
--| The read callback may return CURL_READFUNC_ABORT to stop the current operation immediately,
|
||||
--| resulting in a CURLE_ABORTED_BY_CALLBACK error code from the transfer (Added in 7.12.1)
|
||||
--|
|
||||
--| From 7.18.0, the function can return CURL_READFUNC_PAUSE which then will cause reading from this connection to become paused.
|
||||
--| See curl_easy_pause(3) for further details.
|
||||
--|
|
||||
--| Bugs: when doing TFTP uploads, you must return the exact amount of data that the callback wants,
|
||||
--| or it will be considered the final packet by the server end and the transfer will end there.
|
||||
--|
|
||||
--| If you set this callback pointer to NULL, or don't set it at all, the default internal read function will be used.
|
||||
--| It is doing an fread() on the FILE * userdata set with CURLOPT_READDATA.
|
||||
deferred
|
||||
end
|
||||
|
||||
debug_function (a_curl_handle: POINTER; a_curl_infotype: INTEGER; a_char_pointer: POINTER; a_size: INTEGER; a_object_id: POINTER): INTEGER
|
||||
-- Function correspond to {CURL_OPT_CONSTANTS}.curlopt_debugfunction
|
||||
-- Note, pass a {IDENTIFIED}.object_id as `a_object_id' value is helpful since we can't directly pass an Eiffel Object address which
|
||||
-- may changed during GC.
|
||||
require
|
||||
vaild: (create {CURL_INFO_TYPE}).is_valid (a_curl_infotype)
|
||||
deferred
|
||||
end
|
||||
|
||||
feature {NONE} -- Externals
|
||||
|
||||
c_set_object (a_object: POINTER)
|
||||
-- Set Current object address.
|
||||
external
|
||||
"C signature (EIF_REFERENCE) use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_release_object
|
||||
-- Release Current pointer in C
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_progress_function_address (a_address: POINTER)
|
||||
-- Set progress function address.
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_write_function_address (a_address: POINTER)
|
||||
-- Set write function address.
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_read_function_address (a_address: POINTER)
|
||||
-- Set read function address.
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
c_set_debug_function_address (a_address: POINTER)
|
||||
-- Set write function address.
|
||||
external
|
||||
"C use %"eiffel_curl.h%""
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
dispose
|
||||
-- Wean `Current'
|
||||
do
|
||||
c_release_object
|
||||
c_set_object (default_pointer)
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,78 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL library constants used by curl_global_init ()
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_GLOBAL_CONSTANTS
|
||||
|
||||
feature -- Query
|
||||
|
||||
curl_global_ssl: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_SSL
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_SSL;
|
||||
]"
|
||||
end
|
||||
|
||||
curl_global_win32: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_WIN32
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_WIN32;
|
||||
]"
|
||||
end
|
||||
|
||||
curl_global_all: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_ALL
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_ALL;
|
||||
]"
|
||||
end
|
||||
|
||||
curl_global_nothing: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_NOTHING
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_NOTHING;
|
||||
]"
|
||||
end
|
||||
|
||||
curl_global_default: NATURAL_64
|
||||
-- Delcared as CURL_GLOBAL_DEFAULT
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return CURL_GLOBAL_DEFAULT;
|
||||
]"
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL library info constants.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_INFO_CONSTANTS
|
||||
|
||||
feature -- Constants
|
||||
|
||||
curlinfo_string: INTEGER = 0x100000
|
||||
-- Declared as CURLINFO_STRING
|
||||
|
||||
curlinfo_long: INTEGER = 0x200000
|
||||
-- Declared as CURLINFO_LONG
|
||||
|
||||
curlinfo_double: INTEGER = 0x300000
|
||||
-- Declared as CURLINFO_DOUBLE
|
||||
|
||||
curlinfo_slist: INTEGER = 0x400000
|
||||
-- Declared as CURLINFO_SLIST
|
||||
|
||||
curlinfo_mask: INTEGER = 0x0fffff
|
||||
-- Declared as CURLINFO_MASK
|
||||
|
||||
curlinfo_typemask: INTEGER = 0xf00000
|
||||
-- Declared as CURLINFO_TYPEMASK
|
||||
|
||||
feature -- Info constants
|
||||
|
||||
curlinfo_effective_url: INTEGER = 0x100001 -- CURLINFO_STRING + 1,
|
||||
curlinfo_response_code: INTEGER = 0x200002 -- CURLINFO_LONG + 2,
|
||||
curlinfo_total_time: INTEGER = 0x300003 -- CURLINFO_DOUBLE + 3,
|
||||
curlinfo_namelookup_time: INTEGER = 0x300004 -- CURLINFO_DOUBLE + 4,
|
||||
curlinfo_connect_time: INTEGER = 0x300005 -- CURLINFO_DOUBLE + 5,
|
||||
curlinfo_pretransfer_time: INTEGER = 0x300006 -- CURLINFO_DOUBLE + 6,
|
||||
curlinfo_size_upload: INTEGER = 0x300007 -- CURLINFO_DOUBLE + 7,
|
||||
curlinfo_size_download: INTEGER = 0x300008 -- CURLINFO_DOUBLE + 8,
|
||||
curlinfo_speed_download: INTEGER = 0x300009 -- CURLINFO_DOUBLE + 9,
|
||||
curlinfo_speed_upload: INTEGER = 0x30000a -- CURLINFO_DOUBLE + 10,
|
||||
curlinfo_header_size: INTEGER = 0x20000b -- CURLINFO_LONG + 11,
|
||||
curlinfo_request_size: INTEGER = 0x20000c -- CURLINFO_LONG + 12,
|
||||
curlinfo_ssl_verifyresult: INTEGER = 0x20000d -- CURLINFO_LONG + 13,
|
||||
curlinfo_filetime: INTEGER = 0x20000e -- CURLINFO_LONG + 14,
|
||||
curlinfo_content_length_download: INTEGER = 0x30000f -- CURLINFO_DOUBLE + 15,
|
||||
curlinfo_content_length_upload: INTEGER = 0x300010 -- CURLINFO_DOUBLE + 16,
|
||||
curlinfo_starttransfer_time: INTEGER = 0x300011 -- CURLINFO_DOUBLE + 17,
|
||||
curlinfo_content_type: INTEGER = 0x100012 -- CURLINFO_STRING + 18,
|
||||
curlinfo_redirect_time: INTEGER = 0x300013 -- CURLINFO_DOUBLE + 19,
|
||||
curlinfo_redirect_count: INTEGER = 0x200014 -- CURLINFO_LONG + 20,
|
||||
curlinfo_private: INTEGER = 0x100015 -- CURLINFO_STRING + 21,
|
||||
curlinfo_http_connectcode: INTEGER = 0x200016 -- CURLINFO_LONG + 22,
|
||||
curlinfo_httpauth_avail: INTEGER = 0x200017 -- CURLINFO_LONG + 23,
|
||||
curlinfo_proxyauth_avail: INTEGER = 0x200018 -- CURLINFO_LONG + 24,
|
||||
curlinfo_os_errno: INTEGER = 0x200019 -- CURLINFO_LONG + 25,
|
||||
curlinfo_num_connects: INTEGER = 0x20001a -- CURLINFO_LONG + 26,
|
||||
curlinfo_ssl_engines: INTEGER = 0x40001b -- CURLINFO_SLIST + 27,
|
||||
curlinfo_cookielist: INTEGER = 0x40001c -- CURLINFO_SLIST + 28,
|
||||
curlinfo_lastsocket: INTEGER = 0x20001d -- CURLINFO_LONG + 29,
|
||||
curlinfo_ftp_entry_path: INTEGER = 0x10001e -- CURLINFO_STRING + 30,
|
||||
|
||||
feature -- Contract support
|
||||
|
||||
is_valid (a_code: INTEGER): BOOLEAN
|
||||
-- Is `a_code' valid?
|
||||
do
|
||||
inspect a_code
|
||||
when
|
||||
curlinfo_effective_url,
|
||||
curlinfo_response_code,
|
||||
curlinfo_total_time,
|
||||
curlinfo_namelookup_time,
|
||||
curlinfo_connect_time,
|
||||
curlinfo_pretransfer_time,
|
||||
curlinfo_size_upload,
|
||||
curlinfo_size_download,
|
||||
curlinfo_speed_download,
|
||||
curlinfo_speed_upload,
|
||||
curlinfo_header_size,
|
||||
curlinfo_request_size,
|
||||
curlinfo_ssl_verifyresult,
|
||||
curlinfo_filetime,
|
||||
curlinfo_content_length_download,
|
||||
curlinfo_content_length_upload,
|
||||
curlinfo_starttransfer_time,
|
||||
curlinfo_content_type,
|
||||
curlinfo_redirect_time,
|
||||
curlinfo_redirect_count,
|
||||
curlinfo_private,
|
||||
curlinfo_http_connectcode,
|
||||
curlinfo_httpauth_avail,
|
||||
curlinfo_proxyauth_avail,
|
||||
curlinfo_os_errno,
|
||||
curlinfo_num_connects,
|
||||
curlinfo_ssl_engines,
|
||||
curlinfo_cookielist,
|
||||
curlinfo_lastsocket,
|
||||
curlinfo_ftp_entry_path
|
||||
then
|
||||
Result := True
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,69 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
cURL library info type constants.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_INFO_TYPE
|
||||
|
||||
feature -- Enumeration
|
||||
|
||||
curlinfo_text: INTEGER = 0
|
||||
-- Declared as CURLINFO_TEXT
|
||||
|
||||
curlinfo_header_in: INTEGER = 1
|
||||
-- Declared as CURLINFO_HEADER_IN
|
||||
|
||||
curlinfo_header_out: INTEGER = 2
|
||||
-- Declared as CURLINFO_HEADER_OUT
|
||||
|
||||
curlinfo_data_in: INTEGER = 3
|
||||
-- Declared as CURLINFO_DATA_IN
|
||||
|
||||
curlinfo_data_out: INTEGER = 4
|
||||
-- Declared as CURLINFO_DATA_OUT
|
||||
|
||||
curlinfo_ssl_data_in: INTEGER = 5
|
||||
-- Declared as CURLINFO_SSL_DATA_IN
|
||||
|
||||
curlinfo_ssl_data_out: INTEGER = 6
|
||||
-- Declared as CURLINFO_SSL_DATA_OUT
|
||||
|
||||
feature -- Contract support
|
||||
|
||||
is_valid (a_type: INTEGER): BOOLEAN
|
||||
-- If `a_type' valid?
|
||||
do
|
||||
inspect a_type
|
||||
when
|
||||
curlinfo_data_in,
|
||||
curlinfo_data_out,
|
||||
curlinfo_header_in,
|
||||
curlinfo_header_out,
|
||||
curlinfo_ssl_data_in,
|
||||
curlinfo_ssl_data_out,
|
||||
curlinfo_text
|
||||
then
|
||||
Result := True
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,51 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
C CURLMSG enum
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_MSG
|
||||
|
||||
feature -- Query
|
||||
|
||||
curlmsg_done: INTEGER
|
||||
-- Declared as CURLMSG_DONE.
|
||||
-- This easy handle has completed.
|
||||
-- 'result' contains the CURLcode of the transfer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return CURLMSG_DONE;"
|
||||
end
|
||||
|
||||
curlmsg_none: INTEGER
|
||||
-- Declared as CURLMSG_NONE.
|
||||
-- First, not used
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return CURLMSG_NONE;"
|
||||
end
|
||||
|
||||
curlmsg_last: INTEGER
|
||||
-- Declared as CURLMSG_LAST.
|
||||
-- Last, not used
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return CURLMSG_LAST;"
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -1,83 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
|
||||
C Struct CURLMsg wrapper
|
||||
Read multi stack informationals
|
||||
|
||||
This class is used by {CURL_MSG_STRUCT}.info_read
|
||||
|
||||
More info:
|
||||
http://curl.haxx.se/libcurl/c/curl_multi_info_read.html
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_MSG_STRUCT
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_pointer: POINTER)
|
||||
-- Creation method
|
||||
-- Bind message structure to the address `a_pointer'".
|
||||
require
|
||||
not_default: a_pointer /= default_pointer
|
||||
do
|
||||
item := a_pointer
|
||||
ensure
|
||||
set: item = a_pointer
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
curl_handle: POINTER
|
||||
-- CURL easy_handle
|
||||
-- The handle it concerns
|
||||
do
|
||||
Result := c_curl_handle (item)
|
||||
end
|
||||
|
||||
msg: INTEGER
|
||||
-- What does this message mean?
|
||||
-- It's one value from {CURLMSG}
|
||||
do
|
||||
Result := c_msg (item)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
item: POINTER
|
||||
-- C struct item
|
||||
|
||||
feature {NONE} -- C externals
|
||||
|
||||
c_curl_handle (a_item: POINTER): POINTER
|
||||
-- cURL easy handle it concerns
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return (CURL *)((CURLMsg *)$a_item)->easy_handle;"
|
||||
end
|
||||
|
||||
c_msg (a_item: POINTER): INTEGER
|
||||
-- Get msg
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"return (CURLMSG)((CURLMsg *)$a_item)->msg;"
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -1,48 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
The generic return code used by functions in the libcurl multi interface.
|
||||
Also consider curl_multi_strerror(3).
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_MULTI_CODES
|
||||
|
||||
feature -- Query
|
||||
|
||||
curlm_call_multi_perform: INTEGER = -1
|
||||
-- This is not really an error. It means you should call curl_multi_perform(3) again without doing select() or similar in between.
|
||||
|
||||
curlm_ok: INTEGER = 0
|
||||
-- Things are fine.
|
||||
|
||||
curlm_bad_handle: INTEGER = 1
|
||||
-- The passed-in handle is not a valid CURLM handle.
|
||||
|
||||
curlm_bad_easy_handle: INTEGER = 2
|
||||
-- An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle.
|
||||
|
||||
curlm_out_of_memory: INTEGER = 3
|
||||
-- You are doomed.
|
||||
|
||||
curlm_internal_error: INTEGER = 4
|
||||
-- This can only be returned if libcurl bugs. Please report it to us!
|
||||
|
||||
curlm_bad_socket: INTEGER = 5
|
||||
-- The passed-in socket is not a valid one that libcurl already knows about. (Added in 7.15.4)
|
||||
|
||||
curlm_unknown_option: INTEGER = 6
|
||||
-- curl_multi_setopt() with unsupported option (Added in 7.15.4)
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -1,251 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
The multi interface offers several abilities that the easy interface doesn't. They are mainly:
|
||||
1. Enable a "pull" interface. The application that uses libcurl decides where and when to ask libcurl to get/send data.
|
||||
2. Enable multiple simultaneous transfers in the same thread without making it complicated for the application.
|
||||
3. Enable the application to wait for action on its own file descriptors and curl's file descriptors simultaneous easily.
|
||||
|
||||
More info: http://curl.haxx.se/libcurl/c/libcurl-multi.html
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_MULTI_EXTERNALS
|
||||
|
||||
feature -- Command
|
||||
|
||||
init
|
||||
-- Create a multi handle.
|
||||
-- If success, Result is a cURL multi hanlde just created.
|
||||
-- This feature maybe failed in some cases: cannot find required DLL, etc.
|
||||
-- Then the post condition would be violated.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_init")
|
||||
if l_api /= default_pointer then
|
||||
item := c_init (l_api)
|
||||
end
|
||||
end
|
||||
|
||||
add_handle (a_easy_handle: POINTER)
|
||||
-- Add an easy handle to a multi session.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_add_handle")
|
||||
if l_api /= default_pointer then
|
||||
c_add_handle (l_api, item, a_easy_handle)
|
||||
end
|
||||
end
|
||||
|
||||
remove_handle (a_easy_handle: POINTER)
|
||||
-- Remove an easy handle from a multi session.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_remove_handle")
|
||||
if l_api /= default_pointer then
|
||||
c_remove_handle (l_api, item, a_easy_handle)
|
||||
end
|
||||
end
|
||||
|
||||
cleanup: INTEGER
|
||||
-- Close down a multi session.
|
||||
-- Result is one value from {CURL_MULTI_CODES}.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_cleanup")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_cleanup (l_api, item)
|
||||
end
|
||||
end
|
||||
|
||||
perform (a_running_handle: CELL [INTEGER]): INTEGER
|
||||
-- Reads/writes available data from each easy handle.
|
||||
-- Result is one value from {CURL_MULTI_CODES}.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
l_running_handle: INTEGER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_perform")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_perform (l_api, item, $l_running_handle)
|
||||
a_running_handle.put (l_running_handle)
|
||||
end
|
||||
end
|
||||
|
||||
info_read (a_msgs_in_queue: CELL [INTEGER]): POINTER
|
||||
-- Read multi stack informationals.
|
||||
-- The result is C struct CURLMsg {CURL_MSG_STRUCT}.
|
||||
-- Repeated calls to this function will return a new struct each time, until a NULL
|
||||
-- is returned as a signal that there is no more to get at this point. The integer
|
||||
-- pointed to with msgs_in_queue will contain the number of remaining messages after
|
||||
-- this function was called.
|
||||
-- When you fetch a message using this function, it is removed from the internal queue
|
||||
-- so calling this function again will not return the same message again. It will instead
|
||||
-- return new messages at each new invoke until the queue is emptied.
|
||||
require
|
||||
dynamic_library_exists: is_dynamic_library_exists
|
||||
is_multi_handle_exists: is_exists
|
||||
local
|
||||
l_api: POINTER
|
||||
l_msgs_in_queue: INTEGER
|
||||
do
|
||||
l_api := api_loader.api_pointer ("curl_multi_info_read")
|
||||
if l_api /= default_pointer then
|
||||
Result := c_info_read (l_api, item, $l_msgs_in_queue)
|
||||
a_msgs_in_queue.put (l_msgs_in_queue)
|
||||
end
|
||||
end
|
||||
|
||||
is_dynamic_library_exists: BOOLEAN
|
||||
-- Are required .dll/.so files available?
|
||||
do
|
||||
Result := api_loader.is_interface_usable
|
||||
end
|
||||
|
||||
-- Feature not yet wrapped/tested
|
||||
-- curl_multi_assign
|
||||
-- curl_multi_fdset
|
||||
-- curl_multi_setopt
|
||||
-- curl_multi_socket
|
||||
-- curl_multi_socket_action
|
||||
-- curl_multi_strerror
|
||||
-- curl_multi_timeout
|
||||
|
||||
feature -- Query
|
||||
|
||||
is_exists: BOOLEAN
|
||||
-- If C pointer exists?
|
||||
do
|
||||
Result := item /= default_pointer
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
item: POINTER
|
||||
-- C pointer item for cURL multi
|
||||
|
||||
feature {NONE} -- C externals
|
||||
|
||||
c_init (a_api: POINTER): POINTER
|
||||
-- Declared as curl_multi_init ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLM *, ()) $a_api)();
|
||||
]"
|
||||
end
|
||||
|
||||
c_cleanup (a_api: POINTER; a_multi_handle: POINTER): INTEGER
|
||||
-- Declared as curl_multi_cleanup ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLMcode, (CURLM *)) $a_api)
|
||||
((CURLM *)$a_multi_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_add_handle (a_api: POINTER; a_multi_handle: POINTER; a_easy_handle: POINTER)
|
||||
-- Declared as curl_multi_add_handle ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (CURLM *, CURL *)) $a_api)
|
||||
((CURLM *) $a_multi_handle,
|
||||
(CURL *) $a_easy_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_remove_handle (a_api: POINTER; a_multi_handle: POINTER; a_easy_handle: POINTER)
|
||||
-- Declared as curl_multi_remove_handle ().
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
(FUNCTION_CAST(void, (CURLM *, CURL *)) $a_api)
|
||||
((CURLM *) $a_multi_handle,
|
||||
(CURL *) $a_easy_handle);
|
||||
]"
|
||||
end
|
||||
|
||||
c_perform (a_api: POINTER; a_multi_handle: POINTER; a_running_handles: TYPED_POINTER [INTEGER]): INTEGER
|
||||
-- Declared as curl_multi_perform.
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLMcode, (CURLM *, int *)) $a_api)
|
||||
((CURLM *) $a_multi_handle,
|
||||
(int *) $a_running_handles);
|
||||
]"
|
||||
end
|
||||
|
||||
c_info_read (a_api: POINTER; a_multi_handle: POINTER; a_msgs_in_queue: TYPED_POINTER [INTEGER]): POINTER
|
||||
-- Declared as curl_multi_info_read.
|
||||
require
|
||||
exists: a_api /= default_pointer
|
||||
external
|
||||
"C inline use <curl/curl.h>"
|
||||
alias
|
||||
"[
|
||||
return (FUNCTION_CAST(CURLMsg *, (CURLM *, int *)) $a_api)
|
||||
((CURLM *) $a_multi_handle,
|
||||
(int *) $a_msgs_in_queue);
|
||||
]"
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
api_loader: DYNAMIC_MODULE
|
||||
-- Module name.
|
||||
local
|
||||
l_utility: CURL_UTILITY
|
||||
once
|
||||
create l_utility
|
||||
Result := l_utility.api_loader
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,50 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
String used by cURL wrapper library.
|
||||
Only added features from IDENTIFIED.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_STRING
|
||||
|
||||
inherit
|
||||
STRING
|
||||
select
|
||||
is_equal,
|
||||
copy,
|
||||
out
|
||||
end
|
||||
|
||||
IDENTIFIED
|
||||
rename
|
||||
is_equal as identified_is_equal,
|
||||
copy as identified_copy,
|
||||
out as identified_out
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_empty,
|
||||
make_filled,
|
||||
make_from_string,
|
||||
make_from_c,
|
||||
make_from_cil
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Utilities for Eiffel cURL wrapper library.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CURL_UTILITY
|
||||
|
||||
feature -- Query
|
||||
|
||||
api_loader: DYNAMIC_MODULE
|
||||
-- API dynamic loader
|
||||
local
|
||||
l_platform: PLATFORM
|
||||
once
|
||||
create l_platform
|
||||
if l_platform.is_unix or l_platform.is_mac then
|
||||
create Result.make_with_version (module_name, "3")
|
||||
else
|
||||
check is_window: l_platform.is_windows end
|
||||
create Result.make (module_name)
|
||||
end
|
||||
ensure
|
||||
not_void: Result /= Void
|
||||
end
|
||||
|
||||
module_name: STRING
|
||||
-- Module name.
|
||||
once
|
||||
Result := "libcurl"
|
||||
ensure
|
||||
not_void: Result /= Void
|
||||
end
|
||||
|
||||
note
|
||||
library: "cURL: Library of reusable components for Eiffel."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1,65 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Interactive with native system APIs for dynamic loading.
|
||||
Cocoa verson.
|
||||
]"
|
||||
status: "See notice at end of class."
|
||||
legal: "See notice at end of class."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
API_LOADER_IMP
|
||||
|
||||
feature -- Command
|
||||
|
||||
load_module (a_name: STRING): POINTER
|
||||
-- Load module with `a_name'.
|
||||
require
|
||||
exists: a_name /= Void
|
||||
do
|
||||
-- fixme: implement
|
||||
end
|
||||
|
||||
loal_api (a_module: POINTER; a_name: STRING): POINTER
|
||||
-- Load api which name is `a_name' in `a_module'
|
||||
require
|
||||
exists: a_module /= default_pointer
|
||||
exists: a_name /= Void
|
||||
do
|
||||
-- fixme: implement
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "Copyright (c) 1984-2007, Eiffel Software"
|
||||
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
|
||||
licensing_options: "http://www.eiffel.com/licensing"
|
||||
copying: "[
|
||||
This file is part of Eiffel Software's Eiffel Development Environment.
|
||||
|
||||
Eiffel Software's Eiffel Development Environment 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, version 2 of the License
|
||||
(available at the URL listed under "license" above).
|
||||
|
||||
Eiffel Software's Eiffel Development Environment 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 Eiffel Software's Eiffel Development
|
||||
Environment; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
]"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
|
||||
end
|
||||
@@ -1 +0,0 @@
|
||||
reference:forum2
|
||||
@@ -1,5 +0,0 @@
|
||||
When your Eiffel executable running, Eiffel cURL library needs 3 DLLs, they are:
|
||||
|
||||
libcurl.dll, libeay32.dll and ssleay32.dll
|
||||
|
||||
Please make sure the 3 DLLs files can be found in your environment PATH or in same folder of your executable.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,67 +0,0 @@
|
||||
#ifndef __CURL_CURLVER_H
|
||||
#define __CURL_CURLVER_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
/* This header file contains nothing but libcurl version info, generated by
|
||||
a script at release-time. This was made its own header file in 7.11.2 */
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.17.0"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 17
|
||||
#define LIBCURL_VERSION_PATCH 0
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||
always follow this syntax:
|
||||
|
||||
0xXXYYZZ
|
||||
|
||||
Where XX, YY and ZZ are the main version, release and patch numbers in
|
||||
hexadecimal (using 8 bits each). All three numbers are always represented
|
||||
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
|
||||
appears as "0x090b07".
|
||||
|
||||
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
|
||||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x071100
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
* timestamp is not stored in CVS, as the timestamp is properly set in the
|
||||
* tarballs by the maketgz script.
|
||||
*
|
||||
* The format of the date should follow this template:
|
||||
*
|
||||
* "Mon Feb 12 11:35:33 UTC 2007"
|
||||
*/
|
||||
#define LIBCURL_TIMESTAMP "Thu Sep 13 20:22:24 UTC 2007"
|
||||
|
||||
#endif /* __CURL_CURLVER_H */
|
||||
@@ -1,81 +0,0 @@
|
||||
#ifndef __CURL_EASY_H
|
||||
#define __CURL_EASY_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CURL_EXTERN CURL *curl_easy_init(void);
|
||||
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
|
||||
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
|
||||
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_getinfo()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Request internal information from the curl session with this function. The
|
||||
* third argument MUST be a pointer to a long, a pointer to a char * or a
|
||||
* pointer to a double (as the documentation describes elsewhere). The data
|
||||
* pointed to will be filled in accordingly and can be relied upon only if the
|
||||
* function returns CURLE_OK. This function is intended to get used *AFTER* a
|
||||
* performed transfer, all results from this function are undefined until the
|
||||
* transfer is completed.
|
||||
*/
|
||||
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
|
||||
|
||||
|
||||
/*
|
||||
* NAME curl_easy_duphandle()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Creates a new curl session handle with the same options set for the handle
|
||||
* passed in. Duplicating a handle could only be a matter of cloning data and
|
||||
* options, internal state info and things like persistant connections cannot
|
||||
* be transfered. It is useful in multithreaded applications when you can run
|
||||
* curl_easy_duphandle() for each new thread to avoid a series of identical
|
||||
* curl_easy_setopt() invokes in every thread.
|
||||
*/
|
||||
CURL_EXTERN CURL* curl_easy_duphandle(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_reset()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Re-initializes a CURL handle to the default values. This puts back the
|
||||
* handle to the same state as it was in when it was just created.
|
||||
*
|
||||
* It does keep: live connections, the Session ID cache, the DNS cache and the
|
||||
* cookies.
|
||||
*/
|
||||
CURL_EXTERN void curl_easy_reset(CURL *curl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
#ifndef __CURL_MPRINTF_H
|
||||
#define __CURL_MPRINTF_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h> /* needed for FILE */
|
||||
|
||||
#include "curl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CURL_EXTERN int curl_mprintf(const char *format, ...);
|
||||
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
|
||||
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
|
||||
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
|
||||
CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
|
||||
CURL_EXTERN char *curl_maprintf(const char *format, ...);
|
||||
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
|
||||
|
||||
#ifdef _MPRINTF_REPLACE
|
||||
# undef printf
|
||||
# undef fprintf
|
||||
# undef sprintf
|
||||
# undef vsprintf
|
||||
# undef snprintf
|
||||
# undef vprintf
|
||||
# undef vfprintf
|
||||
# undef vsnprintf
|
||||
# undef aprintf
|
||||
# undef vaprintf
|
||||
# define printf curl_mprintf
|
||||
# define fprintf curl_mfprintf
|
||||
#ifdef CURLDEBUG
|
||||
/* When built with CURLDEBUG we define away the sprintf() functions since we
|
||||
don't want internal code to be using them */
|
||||
# define sprintf sprintf_was_used
|
||||
# define vsprintf vsprintf_was_used
|
||||
#else
|
||||
# define sprintf curl_msprintf
|
||||
# define vsprintf curl_mvsprintf
|
||||
#endif
|
||||
# define snprintf curl_msnprintf
|
||||
# define vprintf curl_mvprintf
|
||||
# define vfprintf curl_mvfprintf
|
||||
# define vsnprintf curl_mvsnprintf
|
||||
# define aprintf curl_maprintf
|
||||
# define vaprintf curl_mvaprintf
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CURL_MPRINTF_H */
|
||||
@@ -1,346 +0,0 @@
|
||||
#ifndef __CURL_MULTI_H
|
||||
#define __CURL_MULTI_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
/*
|
||||
This is an "external" header file. Don't give away any internals here!
|
||||
|
||||
GOALS
|
||||
|
||||
o Enable a "pull" interface. The application that uses libcurl decides where
|
||||
and when to ask libcurl to get/send data.
|
||||
|
||||
o Enable multiple simultaneous transfers in the same thread without making it
|
||||
complicated for the application.
|
||||
|
||||
o Enable the application to select() on its own file descriptors and curl's
|
||||
file descriptors simultaneous easily.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header file should not really need to include "curl.h" since curl.h
|
||||
* itself includes this file and we expect user applications to do #include
|
||||
* <curl/curl.h> without the need for especially including multi.h.
|
||||
*
|
||||
* For some reason we added this include here at one point, and rather than to
|
||||
* break existing (wrongly written) libcurl applications, we leave it as-is
|
||||
* but with this warning attached.
|
||||
*/
|
||||
#include "curl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void CURLM;
|
||||
|
||||
typedef enum {
|
||||
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
|
||||
curl_multi_socket*() soon */
|
||||
CURLM_OK,
|
||||
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
|
||||
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
||||
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
|
||||
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
|
||||
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
|
||||
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
|
||||
CURLM_LAST
|
||||
} CURLMcode;
|
||||
|
||||
/* just to make code nicer when using curl_multi_socket() you can now check
|
||||
for CURLM_CALL_MULTI_SOCKET too in the same style it works for
|
||||
curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
|
||||
#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
|
||||
|
||||
typedef enum {
|
||||
CURLMSG_NONE, /* first, not used */
|
||||
CURLMSG_DONE, /* This easy handle has completed. 'result' contains
|
||||
the CURLcode of the transfer */
|
||||
CURLMSG_LAST /* last, not used */
|
||||
} CURLMSG;
|
||||
|
||||
struct CURLMsg {
|
||||
CURLMSG msg; /* what this message means */
|
||||
CURL *easy_handle; /* the handle it concerns */
|
||||
union {
|
||||
void *whatever; /* message-specific data */
|
||||
CURLcode result; /* return code for transfer */
|
||||
} data;
|
||||
};
|
||||
typedef struct CURLMsg CURLMsg;
|
||||
|
||||
/*
|
||||
* Name: curl_multi_init()
|
||||
*
|
||||
* Desc: inititalize multi-style curl usage
|
||||
*
|
||||
* Returns: a new CURLM handle to use in all 'curl_multi' functions.
|
||||
*/
|
||||
CURL_EXTERN CURLM *curl_multi_init(void);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_add_handle()
|
||||
*
|
||||
* Desc: add a standard curl handle to the multi stack
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_remove_handle()
|
||||
*
|
||||
* Desc: removes a curl handle from the multi stack again
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_fdset()
|
||||
*
|
||||
* Desc: Ask curl for its fd_set sets. The app can use these to select() or
|
||||
* poll() on. We want curl_multi_perform() called as soon as one of
|
||||
* them are ready.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
fd_set *exc_fd_set,
|
||||
int *max_fd);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_perform()
|
||||
*
|
||||
* Desc: When the app thinks there's data available for curl it calls this
|
||||
* function to read/write whatever there is right now. This returns
|
||||
* as soon as the reads and writes are done. This function does not
|
||||
* require that there actually is data available for reading or that
|
||||
* data can be written, it can be called just in case. It returns
|
||||
* the number of handles that still transfer data in the second
|
||||
* argument's integer-pointer.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code. *NOTE* that this only
|
||||
* returns errors etc regarding the whole multi stack. There might
|
||||
* still have occurred problems on invidual transfers even when this
|
||||
* returns OK.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_cleanup()
|
||||
*
|
||||
* Desc: Cleans up and removes a whole multi stack. It does not free or
|
||||
* touch any individual easy handles in any way. We need to define
|
||||
* in what state those handles will be if this function is called
|
||||
* in the middle of a transfer.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_info_read()
|
||||
*
|
||||
* Desc: Ask the multi handle if there's any messages/informationals from
|
||||
* the individual transfers. Messages include informationals such as
|
||||
* error code from the transfer or just the fact that a transfer is
|
||||
* completed. More details on these should be written down as well.
|
||||
*
|
||||
* Repeated calls to this function will return a new struct each
|
||||
* time, until a special "end of msgs" struct is returned as a signal
|
||||
* that there is no more to get at this point.
|
||||
*
|
||||
* The data the returned pointer points to will not survive calling
|
||||
* curl_multi_cleanup().
|
||||
*
|
||||
* The 'CURLMsg' struct is meant to be very simple and only contain
|
||||
* very basic informations. If more involved information is wanted,
|
||||
* we will provide the particular "transfer handle" in that struct
|
||||
* and that should/could/would be used in subsequent
|
||||
* curl_easy_getinfo() calls (or similar). The point being that we
|
||||
* must never expose complex structs to applications, as then we'll
|
||||
* undoubtably get backwards compatibility problems in the future.
|
||||
*
|
||||
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
|
||||
* of structs. It also writes the number of messages left in the
|
||||
* queue (after this read) in the integer the second argument points
|
||||
* to.
|
||||
*/
|
||||
CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
|
||||
int *msgs_in_queue);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_strerror()
|
||||
*
|
||||
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode
|
||||
* value into the equivalent human readable error string. This is
|
||||
* useful for printing meaningful error messages.
|
||||
*
|
||||
* Returns: A pointer to a zero-terminated error message.
|
||||
*/
|
||||
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_socket() and
|
||||
* curl_multi_socket_all()
|
||||
*
|
||||
* Desc: An alternative version of curl_multi_perform() that allows the
|
||||
* application to pass in one of the file descriptors that have been
|
||||
* detected to have "action" on them and let libcurl perform.
|
||||
* See man page for details.
|
||||
*/
|
||||
#define CURL_POLL_NONE 0
|
||||
#define CURL_POLL_IN 1
|
||||
#define CURL_POLL_OUT 2
|
||||
#define CURL_POLL_INOUT 3
|
||||
#define CURL_POLL_REMOVE 4
|
||||
|
||||
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
|
||||
|
||||
#define CURL_CSELECT_IN 0x01
|
||||
#define CURL_CSELECT_OUT 0x02
|
||||
#define CURL_CSELECT_ERR 0x04
|
||||
|
||||
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
|
||||
curl_socket_t s, /* socket */
|
||||
int what, /* see above */
|
||||
void *userp, /* private callback
|
||||
pointer */
|
||||
void *socketp); /* private socket
|
||||
pointer */
|
||||
/*
|
||||
* Name: curl_multi_timer_callback
|
||||
*
|
||||
* Desc: Called by libcurl whenever the library detects a change in the
|
||||
* maximum number of milliseconds the app is allowed to wait before
|
||||
* curl_multi_socket() or curl_multi_perform() must be called
|
||||
* (to allow libcurl's timed events to take place).
|
||||
*
|
||||
* Returns: The callback should return zero.
|
||||
*/
|
||||
typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
|
||||
long timeout_ms, /* see above */
|
||||
void *userp); /* private callback
|
||||
pointer */
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
|
||||
int *running_handles);
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
|
||||
curl_socket_t s,
|
||||
int ev_bitmask,
|
||||
int *running_handles);
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
|
||||
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
|
||||
/* This macro below was added in 7.16.3 to push users who recompile to use
|
||||
the new curl_multi_socket_action() instead of the old curl_multi_socket()
|
||||
*/
|
||||
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Name: curl_multi_timeout()
|
||||
*
|
||||
* Desc: Returns the maximum number of milliseconds the app is allowed to
|
||||
* wait before curl_multi_socket() or curl_multi_perform() must be
|
||||
* called (to allow libcurl's timed events to take place).
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
|
||||
long *milliseconds);
|
||||
|
||||
#undef CINIT /* re-using the same name as in curl.h */
|
||||
|
||||
#ifdef CURL_ISOCPP
|
||||
#define CINIT(name,type,number) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + number
|
||||
#else
|
||||
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
|
||||
#define LONG CURLOPTTYPE_LONG
|
||||
#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
|
||||
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
|
||||
#define OFF_T CURLOPTTYPE_OFF_T
|
||||
#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
/* This is the socket callback function pointer */
|
||||
CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
|
||||
|
||||
/* This is the argument passed to the socket callback */
|
||||
CINIT(SOCKETDATA, OBJECTPOINT, 2),
|
||||
|
||||
/* set to 1 to enable pipelining for this multi handle */
|
||||
CINIT(PIPELINING, LONG, 3),
|
||||
|
||||
/* This is the timer callback function pointer */
|
||||
CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
|
||||
|
||||
/* This is the argument passed to the timer callback */
|
||||
CINIT(TIMERDATA, OBJECTPOINT, 5),
|
||||
|
||||
/* maximum number of entries in the connection cache */
|
||||
CINIT(MAXCONNECTS, LONG, 6),
|
||||
|
||||
CURLMOPT_LASTENTRY /* the last unused */
|
||||
} CURLMoption;
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_multi_setopt()
|
||||
*
|
||||
* Desc: Sets options for the multi handle.
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
|
||||
CURLMoption option, ...);
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_multi_assign()
|
||||
*
|
||||
* Desc: This function sets an association in the multi handle between the
|
||||
* given socket and a private pointer of the application. This is
|
||||
* (only) useful for curl_multi_socket uses.
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
|
||||
curl_socket_t sockfd, void *sockp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef __STDC_HEADERS_H
|
||||
#define __STDC_HEADERS_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
size_t fread (void *, size_t, size_t, FILE *);
|
||||
size_t fwrite (const void *, size_t, size_t, FILE *);
|
||||
|
||||
int strcasecmp(const char *, const char *);
|
||||
int strncasecmp(const char *, const char *, size_t);
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
/* not used */
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
indexing
|
||||
description: "Functions used by the class CURL_FUNCTION."
|
||||
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
356 Storke Road, Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
*/
|
||||
|
||||
#ifndef _eiffel_curl_h_
|
||||
#define _eiffel_curl_h_
|
||||
|
||||
#include "eif_eiffel.h"
|
||||
|
||||
/* unix-specific */
|
||||
#ifndef EIF_WINDOWS
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void c_set_object(EIF_REFERENCE a_address);
|
||||
extern void c_release_object(void);
|
||||
extern void c_set_progress_function_address( EIF_POINTER a_address);
|
||||
extern void c_set_read_function_address( EIF_POINTER a_address);
|
||||
extern void c_set_write_function_address( EIF_POINTER a_address);
|
||||
extern void c_set_debug_function_address (EIF_POINTER a_address);
|
||||
extern size_t curl_write_function (void *ptr, size_t size, size_t nmemb, void *data);
|
||||
extern size_t curl_read_function (void *ptr, size_t size, size_t nmemb, void *data);
|
||||
extern size_t curl_progress_function (void * a_object_id, double a_dltotal, double a_dlnow, double a_ultotal, double a_ulnow);
|
||||
extern size_t curl_debug_function (CURL * a_curl_handle, curl_infotype a_curl_infotype, unsigned char * a_char_pointer, size_t a_size, void * a_object_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
reference:forum2
|
||||
@@ -1,352 +0,0 @@
|
||||
note
|
||||
description : "[
|
||||
Object that represents an IRI Scheme
|
||||
|
||||
See http://en.wikipedia.org/wiki/Internationalized_Resource_Identifier
|
||||
See http://tools.ietf.org/html/rfc3987 (IRI)
|
||||
|
||||
]"
|
||||
author: "$Author: manus $"
|
||||
date: "$Date: 2013-01-26 01:40:46 +0100 (sam., 26 janv. 2013) $"
|
||||
revision: "$Revision: 90880 $"
|
||||
EIS: "name=IRI-RFC3987", "protocol=URI", "src=http://tools.ietf.org/html/rfc3987"
|
||||
EIS: "name=IRI-Wikipedia", "protocol=URI", "src=http://en.wikipedia.org/wiki/Internationalized_Resource_Identifier"
|
||||
|
||||
class
|
||||
IRI
|
||||
|
||||
inherit
|
||||
URI
|
||||
rename
|
||||
make_from_string as make_from_uri_string,
|
||||
userinfo as uri_userinfo,
|
||||
path as uri_path, path_segments as uri_path_segments,
|
||||
query as uri_query, query_items as uri_query_items,
|
||||
fragment as uri_fragment,
|
||||
username_password as uri_username_password,
|
||||
username as uri_username, password as uri_password,
|
||||
hier as uri_hier,
|
||||
authority as uri_authority,
|
||||
string as uri_string
|
||||
end
|
||||
|
||||
create
|
||||
make_from_string,
|
||||
make_from_uri
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_from_string (a_string: READABLE_STRING_GENERAL)
|
||||
-- Make from Internationalized resource identifier text `a_string'
|
||||
note
|
||||
EIS: "name=IRI-RFC3987", "protocol=URI", "src=http://tools.ietf.org/html/rfc3987"
|
||||
EIS: "name=IRI-Wikipedia", "protocol=URI", "src=http://en.wikipedia.org/wiki/Internationalized_Resource_Identifier"
|
||||
local
|
||||
l_uri_string: STRING_8
|
||||
do
|
||||
create l_uri_string.make (a_string.count)
|
||||
iri_into_uri (a_string, l_uri_string)
|
||||
make_from_uri_string (l_uri_string)
|
||||
end
|
||||
|
||||
make_from_uri (a_uri: URI)
|
||||
-- Make Current Internationalized resource identifier from `uri' object
|
||||
do
|
||||
make_from_uri_string (a_uri.string)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
userinfo: detachable READABLE_STRING_32
|
||||
-- User information.
|
||||
--| username:password
|
||||
--| RFC3986: userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
|
||||
do
|
||||
Result := to_internationalized_percent_encoded_string (uri_userinfo)
|
||||
end
|
||||
|
||||
path: READABLE_STRING_32
|
||||
-- Path component containing data, usually organized in hierarchical form.
|
||||
do
|
||||
Result := to_attached_internationalized_percent_encoded_string (uri_path)
|
||||
end
|
||||
|
||||
query: detachable READABLE_STRING_32
|
||||
-- Query string.
|
||||
do
|
||||
Result := to_internationalized_percent_encoded_string (uri_query)
|
||||
end
|
||||
|
||||
fragment: detachable READABLE_STRING_32
|
||||
-- The fragment identifier component of a URI allows indirect
|
||||
-- identification of a secondary resource by reference to a primary
|
||||
-- resource and additional identifying information.
|
||||
do
|
||||
Result := to_internationalized_percent_encoded_string (uri_fragment)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
path_segments: LIST [READABLE_STRING_32]
|
||||
-- Segments composing `path'.
|
||||
do
|
||||
Result := path.split ('/')
|
||||
end
|
||||
|
||||
query_items: detachable LIST [TUPLE [name: READABLE_STRING_32; value: detachable READABLE_STRING_32]]
|
||||
-- Query items composing the `query'.
|
||||
local
|
||||
lst: LIST [READABLE_STRING_32]
|
||||
i: INTEGER
|
||||
do
|
||||
if attached query as q then
|
||||
lst := q.split ('&')
|
||||
create {ARRAYED_LIST [like query_items.item]} Result.make (lst.count)
|
||||
across
|
||||
lst as e
|
||||
loop
|
||||
i := e.item.index_of ('=', 1)
|
||||
if i > 0 then
|
||||
Result.force ([e.item.substring (1, i - 1), e.item.substring (i + 1, e.item.count)])
|
||||
else
|
||||
Result.force ([e.item, Void])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
hier: READABLE_STRING_32
|
||||
-- Hier part.
|
||||
-- hier-part = "//" authority path-abempty
|
||||
-- / path-absolute
|
||||
-- / path-rootless
|
||||
-- / path-empty
|
||||
local
|
||||
s: STRING_32
|
||||
do
|
||||
create s.make (10)
|
||||
if attached authority as l_authority then
|
||||
s.append_character ('/')
|
||||
s.append_character ('/')
|
||||
s.append (l_authority)
|
||||
end
|
||||
s.append (path)
|
||||
Result := s
|
||||
end
|
||||
|
||||
username_password: detachable TUPLE [username: READABLE_STRING_32; password: detachable READABLE_STRING_32]
|
||||
-- Username and password value extrated from `userinfo'.
|
||||
--| userinfo = username:password
|
||||
local
|
||||
i: INTEGER
|
||||
u,p: detachable READABLE_STRING_32
|
||||
do
|
||||
if attached userinfo as t then
|
||||
i := t.index_of (':', 1)
|
||||
if i > 0 then
|
||||
p := t.substring (i + 1, t.count)
|
||||
u := t.substring (1, i - 1)
|
||||
else
|
||||
u := t
|
||||
p := Void
|
||||
end
|
||||
Result := [u, p]
|
||||
end
|
||||
end
|
||||
|
||||
username: detachable READABLE_STRING_32
|
||||
-- Eventual username.
|
||||
do
|
||||
if attached username_password as up then
|
||||
Result := up.username
|
||||
end
|
||||
end
|
||||
|
||||
password: detachable READABLE_STRING_32
|
||||
-- Eventual password.
|
||||
do
|
||||
if attached username_password as up then
|
||||
Result := up.password
|
||||
end
|
||||
end
|
||||
|
||||
authority: detachable READABLE_STRING_32
|
||||
-- Hierarchical element for naming authority.
|
||||
--| RFC3986: authority = [ userinfo "@" ] host [ ":" port ]
|
||||
local
|
||||
s: STRING_32
|
||||
do
|
||||
if attached host as h then
|
||||
if attached userinfo as u then
|
||||
create s.make_from_string (u)
|
||||
s.append_character ('@')
|
||||
s.append_string_general (h)
|
||||
else
|
||||
create s.make (h.count)
|
||||
s.append_string_general (h)
|
||||
end
|
||||
if port /= 0 then
|
||||
s.append_character (':')
|
||||
s.append_integer (port)
|
||||
end
|
||||
Result := s
|
||||
else
|
||||
check not is_valid or else (userinfo = Void and port = 0) end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
string: READABLE_STRING_32
|
||||
-- String representation.
|
||||
-- scheme://username:password@hostname/path?query#fragment
|
||||
local
|
||||
s: STRING_32
|
||||
do
|
||||
if attached scheme as l_scheme and then not l_scheme.is_empty then
|
||||
create s.make (l_scheme.count)
|
||||
s.append_string_general (l_scheme)
|
||||
s.append_character (':')
|
||||
else
|
||||
create s.make_empty
|
||||
end
|
||||
s.append (hier)
|
||||
if attached query as q then
|
||||
s.append_character ('?')
|
||||
s.append (q)
|
||||
end
|
||||
if attached fragment as f then
|
||||
s.append_character ('#')
|
||||
s.append (f)
|
||||
end
|
||||
Result := s
|
||||
end
|
||||
|
||||
to_uri: URI
|
||||
do
|
||||
create Result.make_from_string (uri_string)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: Internationalization
|
||||
|
||||
iri_into_uri (a_string: READABLE_STRING_GENERAL; a_result: STRING_8)
|
||||
require
|
||||
is_valid_iri: True
|
||||
local
|
||||
i,n: INTEGER
|
||||
c: NATURAL_32
|
||||
do
|
||||
from
|
||||
i := 1
|
||||
n := a_string.count
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
c := a_string.code (i)
|
||||
if c > 0x7F then
|
||||
-- extended ASCII and/or Unicode
|
||||
append_percent_encoded_character_code_to (c, a_result)
|
||||
-- elseif c = 37 then -- '%'
|
||||
-- -- Check for %u + code
|
||||
-- if i + 1 <= n then
|
||||
-- c := a_string.code (i + 1)
|
||||
-- if c = 85 or c = 117 then -- 85 'U' 117 'u'
|
||||
-- TODO: Convert it to standard percent-encoding without %U...
|
||||
-- end
|
||||
-- else
|
||||
-- a_result.append_code (c)
|
||||
-- end
|
||||
else
|
||||
-- keep as it is
|
||||
a_result.append_code (c)
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
to_internationalized_percent_encoded_string (s: detachable READABLE_STRING_8): detachable STRING_32
|
||||
-- Convert string `s' to Internationalized Resource Identifier string
|
||||
-- Result is Void if `s' is Void.
|
||||
do
|
||||
if s /= Void then
|
||||
create Result.make (s.count)
|
||||
append_percent_encoded_string_into_internationalized_percent_encoded_string (s, Result)
|
||||
end
|
||||
end
|
||||
|
||||
to_attached_internationalized_percent_encoded_string (s: READABLE_STRING_8): STRING_32
|
||||
-- Convert string `s' to Internationalized Resource Identifier string
|
||||
do
|
||||
create Result.make (s.count)
|
||||
append_percent_encoded_string_into_internationalized_percent_encoded_string (s, Result)
|
||||
end
|
||||
|
||||
append_percent_encoded_string_into_internationalized_percent_encoded_string (v: READABLE_STRING_GENERAL; a_result: STRING_32)
|
||||
-- Append to `a_result' the Internationalized URL-decoded equivalent of the given percent-encoded string `v'
|
||||
-- It simply decode any percent-encoded Unicode character and kept the rest untouched
|
||||
-- "http://example.com/summer/%C3%A9t%C3%A9" will be converted to IRI "http://example.com/summer/<2F>t<EFBFBD>"
|
||||
local
|
||||
i,n: INTEGER
|
||||
c1,
|
||||
c: NATURAL_32
|
||||
pr: CELL [INTEGER]
|
||||
do
|
||||
from
|
||||
i := 1
|
||||
create pr.put (i)
|
||||
n := v.count
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
c := v.code (i)
|
||||
inspect c
|
||||
when 43 then -- 43 '+'
|
||||
-- Some implementation are replacing spaces with "+" instead of "%20"
|
||||
-- Here fix this bad behavior
|
||||
a_result.append_code (37) -- 37 '%'
|
||||
a_result.append_code (50) -- 50 '2'
|
||||
a_result.append_code (48) -- 48 '0'
|
||||
when 37 then -- 37 '%%'
|
||||
-- An escaped character ?
|
||||
if i = n then -- Error?
|
||||
a_result.append_code (c)
|
||||
elseif i + 1 <= n then
|
||||
c1 := v.code (i + 1)
|
||||
if c1 = 85 or c1 = 117 then -- 117 'u' 85 'U'
|
||||
-- %u + UTF-32 code
|
||||
pr.replace (i)
|
||||
c1 := next_percent_decoded_character_code (v, pr)
|
||||
i := pr.item
|
||||
a_result.append_code (c1)
|
||||
else
|
||||
pr.replace (i)
|
||||
c1 := next_percent_decoded_unicode_character_code (v, pr)
|
||||
if c1 > 0x7F then
|
||||
a_result.append_code (c1)
|
||||
i := pr.item
|
||||
else
|
||||
a_result.append_code (c)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
a_result.append_code (c)
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2013, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -1,971 +0,0 @@
|
||||
note
|
||||
description : "[
|
||||
Object that represent a URI Scheme
|
||||
|
||||
See http://en.wikipedia.org/wiki/URI_scheme
|
||||
See http://en.wikipedia.org/wiki/Uniform_resource_identifier
|
||||
See http://en.wikipedia.org/wiki/Uniform_resource_locator
|
||||
See http://tools.ietf.org/html/rfc3986 (URI)
|
||||
|
||||
Global syntax element:
|
||||
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
||||
pct-encoded = "%" HEXDIG HEXDIG
|
||||
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
||||
reserved = gen-delims / sub-delims
|
||||
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
|
||||
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
||||
/ "*" / "+" / "," / ";" / "="
|
||||
]"
|
||||
date: "$Date: 2013-01-21 10:25:01 +0100 (lun., 21 janv. 2013) $"
|
||||
revision: "$Revision: 90748 $"
|
||||
EIS: "name=URI-RFC3986 Generic syntax", "protocol=URI", "src=http://tools.ietf.org/html/rfc3986"
|
||||
EIS: "name=URI-Wikipedia", "protocol=URI", "src=http://en.wikipedia.org/wiki/URI_scheme"
|
||||
EIS: "name=IRI-RFC3987", "protocol=URI", "src=http://tools.ietf.org/html/rfc3987"
|
||||
EIS: "name=IRI-Wikipedia", "protocol=URI", "src=http://en.wikipedia.org/wiki/Internationalized_Resource_Identifier"
|
||||
EIS: "name=Percent-encoding", "protocol=URI", "src=http://en.wikipedia.org/wiki/Percent-encoding"
|
||||
|
||||
EIS: "name=url-RFC1738", "protocol=URI", "src=http://tools.ietf.org/html/rfc1738"
|
||||
EIS: "name=mailto-RFC2368", "protocol=URI", "src=http://tools.ietf.org/html/rfc2368"
|
||||
EIS: "name=ipv6-RFC2373", "protocol=URI", "src=http://tools.ietf.org/html/rfc2373"
|
||||
EIS: "name=ipv6-RFC2373 in URL", "protocol=URI", "src=http://tools.ietf.org/html/rfc2732"
|
||||
|
||||
class
|
||||
URI
|
||||
|
||||
inherit
|
||||
ANY
|
||||
|
||||
PERCENT_ENCODER
|
||||
export
|
||||
{NONE} all
|
||||
end
|
||||
|
||||
DEBUG_OUTPUT
|
||||
|
||||
create
|
||||
make_from_string
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_from_string (a_string: READABLE_STRING_8)
|
||||
-- Parse `a_string' as a URI as specified by RFC3986
|
||||
--| Note: for now the result of the parsing does not check the strict validity of each part.
|
||||
--| URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
||||
note
|
||||
EIS: "name=Syntax Components", "protocol=URI", "src=http://tools.ietf.org/html/rfc3986#section-3"
|
||||
local
|
||||
p,q: INTEGER
|
||||
s, t: STRING_8
|
||||
do
|
||||
is_valid := True
|
||||
p := a_string.index_of (':', 1)
|
||||
if p > 0 then
|
||||
set_scheme (a_string.substring (1, p - 1))
|
||||
if a_string.count > p + 1 and then a_string[p+1] = '/' and then a_string[p+2] = '/' then
|
||||
--| Starts by scheme://
|
||||
--| waiting for hierarchical part username:password@hostname:port
|
||||
p := p + 2
|
||||
q := a_string.index_of ('@', p + 1)
|
||||
if q > 0 then
|
||||
--| found user:passwd
|
||||
t := a_string.substring (p + 1, q - 1)
|
||||
set_userinfo (t)
|
||||
p := q
|
||||
end
|
||||
q := a_string.index_of ('/', p + 1)
|
||||
if q > 0 then
|
||||
t := a_string.substring (p + 1, q - 1)
|
||||
else
|
||||
q := a_string.count
|
||||
t := a_string.substring (p + 1, q)
|
||||
q := 0 --| end of processing
|
||||
end
|
||||
if not t.is_empty and then t[1] = '[' then
|
||||
p := t.index_of (']', 2)
|
||||
if p > 0 then
|
||||
p := t.index_of (':', p + 1)
|
||||
else
|
||||
is_valid := False
|
||||
end
|
||||
else
|
||||
p := t.index_of (':', 1)
|
||||
end
|
||||
if p > 0 then
|
||||
set_hostname (t.substring (1, p - 1))
|
||||
t.remove_head (p)
|
||||
if t.is_integer then
|
||||
set_port (t.to_integer)
|
||||
else
|
||||
set_port (0)
|
||||
is_valid := False
|
||||
end
|
||||
else
|
||||
set_hostname (t)
|
||||
set_port (0)
|
||||
end
|
||||
else
|
||||
--| Keep eventual '/' as part of the path
|
||||
q := p + 1
|
||||
set_hostname (Void)
|
||||
end
|
||||
|
||||
if q > 0 and q <= a_string.count then
|
||||
--| found query
|
||||
t := a_string.substring (q, a_string.count)
|
||||
q := t.index_of ('?', 1)
|
||||
if q > 0 then
|
||||
s := t.substring (1, q - 1)
|
||||
if is_valid_in_uri_string (s) then
|
||||
set_path (s)
|
||||
else
|
||||
set_path ("")
|
||||
is_valid := False
|
||||
end
|
||||
t.remove_head (q)
|
||||
q := t.index_of ('#', 1)
|
||||
if q > 0 then
|
||||
set_query (t.substring (1, q - 1))
|
||||
t.remove_head (q)
|
||||
set_fragment (t)
|
||||
else
|
||||
set_query (t)
|
||||
end
|
||||
else
|
||||
if is_valid_in_uri_string (t) then
|
||||
set_path (t)
|
||||
else
|
||||
set_path ("")
|
||||
is_valid := False
|
||||
end
|
||||
end
|
||||
else
|
||||
set_path ("")
|
||||
end
|
||||
else
|
||||
set_scheme ("")
|
||||
set_hostname (Void)
|
||||
set_path ("")
|
||||
end
|
||||
if is_valid then
|
||||
check_validity (True)
|
||||
end
|
||||
ensure
|
||||
same_if_valid: is_valid and not is_corrected implies a_string.starts_with (string)
|
||||
end
|
||||
|
||||
feature -- Basic operation
|
||||
|
||||
check_validity (a_fixing: BOOLEAN)
|
||||
-- Check validity of URI
|
||||
-- If `a_fixing' is True, attempt to correct input URI.
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
-- check scheme
|
||||
-- TODO: RFC3986: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
||||
if not is_valid_scheme (scheme) then
|
||||
is_valid := False
|
||||
end
|
||||
|
||||
-- check userinfo
|
||||
-- TODO: RFC3986: userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
|
||||
if not is_valid_userinfo (userinfo) then
|
||||
is_valid := False
|
||||
end
|
||||
|
||||
-- check host
|
||||
-- TODO: RFC3986: host = IP-literal / IPv4address / reg-name
|
||||
if not is_valid_host (host) then
|
||||
is_valid := False
|
||||
end
|
||||
|
||||
-- Check path
|
||||
-- TODO: no space, all character well escaped, ...
|
||||
if path.has (' ') then
|
||||
-- Fix bad URI
|
||||
if a_fixing then
|
||||
create s.make_from_string (path)
|
||||
s.replace_substring_all (" ", "%%20")
|
||||
set_path (s)
|
||||
is_corrected := True
|
||||
end
|
||||
end
|
||||
if not is_valid_path (path) then
|
||||
is_valid := False
|
||||
end
|
||||
|
||||
-- Check query
|
||||
-- TODO: no space, all character well escaped, ...
|
||||
if attached query as q then
|
||||
if q.has (' ') then
|
||||
-- Fix bad URI
|
||||
if a_fixing then
|
||||
create s.make_from_string (q)
|
||||
s.replace_substring_all (" ", "%%20")
|
||||
set_query (s)
|
||||
is_corrected := True
|
||||
else
|
||||
is_valid := False
|
||||
end
|
||||
end
|
||||
end
|
||||
if not is_valid_query (query) then
|
||||
is_valid := True
|
||||
end
|
||||
|
||||
-- Check fragment
|
||||
if not is_valid_fragment (fragment) then
|
||||
is_valid := False
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status
|
||||
|
||||
is_valid: BOOLEAN
|
||||
-- Is Current valid?
|
||||
|
||||
is_corrected: BOOLEAN
|
||||
-- Is Current valid after eventual correction?
|
||||
|
||||
has_authority: BOOLEAN
|
||||
do
|
||||
Result := host /= Void
|
||||
end
|
||||
|
||||
has_query: BOOLEAN
|
||||
do
|
||||
Result := query /= Void
|
||||
end
|
||||
|
||||
has_path: BOOLEAN
|
||||
do
|
||||
Result := not path.is_empty
|
||||
end
|
||||
|
||||
has_fragment: BOOLEAN
|
||||
do
|
||||
Result := fragment /= Void
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
scheme: IMMUTABLE_STRING_8
|
||||
-- Scheme name.
|
||||
--| scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
||||
|
||||
userinfo: detachable IMMUTABLE_STRING_8
|
||||
-- User information.
|
||||
--| username:password
|
||||
--| RFC3986: userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
|
||||
|
||||
host: detachable IMMUTABLE_STRING_8
|
||||
-- Host name.
|
||||
--| RFC3986: host = IP-literal / IPv4address / reg-name
|
||||
|
||||
port: INTEGER
|
||||
-- Associated port, if `0' this is not defined.
|
||||
-- RFC3986: port = *DIGIT
|
||||
|
||||
path: IMMUTABLE_STRING_8
|
||||
-- Path component containing data, usually organized in hierarchical form.
|
||||
|
||||
query: detachable IMMUTABLE_STRING_8
|
||||
-- Query string.
|
||||
|
||||
fragment: detachable IMMUTABLE_STRING_8
|
||||
-- The fragment identifier component of a URI allows indirect
|
||||
-- identification of a secondary resource by reference to a primary
|
||||
-- resource and additional identifying information.
|
||||
|
||||
feature -- Access
|
||||
|
||||
decoded_path: READABLE_STRING_32
|
||||
-- Decoded `path'
|
||||
local
|
||||
s: STRING_32
|
||||
do
|
||||
create s.make (path.count)
|
||||
append_decoded_www_form_urlencoded_string_to (path, s)
|
||||
Result := s
|
||||
end
|
||||
|
||||
path_segments: LIST [READABLE_STRING_8]
|
||||
-- Segments composing `path'.
|
||||
do
|
||||
Result := path.split ('/')
|
||||
end
|
||||
|
||||
decoded_path_segments: LIST [READABLE_STRING_32]
|
||||
-- Decoded Segments composing `path'.
|
||||
local
|
||||
lst: like path_segments
|
||||
do
|
||||
lst := path_segments
|
||||
create {ARRAYED_LIST [READABLE_STRING_32]} Result.make (lst.count)
|
||||
across
|
||||
lst as e
|
||||
loop
|
||||
Result.force (decoded_www_form_urlencoded_string (e.item))
|
||||
end
|
||||
end
|
||||
|
||||
query_items: detachable LIST [TUPLE [name: READABLE_STRING_8; value: detachable READABLE_STRING_8]]
|
||||
-- Query items composing the `query'.
|
||||
local
|
||||
lst: LIST [READABLE_STRING_8]
|
||||
i: INTEGER
|
||||
do
|
||||
if attached query as q then
|
||||
lst := q.split ('&')
|
||||
create {ARRAYED_LIST [like query_items.item]} Result.make (lst.count)
|
||||
across
|
||||
lst as e
|
||||
loop
|
||||
i := e.item.index_of ('=', 1)
|
||||
if i > 0 then
|
||||
Result.force ([e.item.substring (1, i - 1), e.item.substring (i + 1, e.item.count)])
|
||||
else
|
||||
Result.force ([e.item, Void])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
decoded_query_items: detachable LIST [TUPLE [name: READABLE_STRING_32; value: detachable READABLE_STRING_32]]
|
||||
-- Decoded query items composing the `query'.
|
||||
do
|
||||
if attached query_items as lst then
|
||||
create {ARRAYED_LIST [like decoded_query_items.item]} Result.make (lst.count)
|
||||
across
|
||||
lst as e
|
||||
loop
|
||||
if attached e.item.value as l_val then
|
||||
Result.force ([decoded_www_form_urlencoded_string (e.item.name), decoded_www_form_urlencoded_string (l_val)])
|
||||
else
|
||||
Result.force ([decoded_www_form_urlencoded_string (e.item.name), Void])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
hier: READABLE_STRING_8
|
||||
-- Hier part.
|
||||
-- hier-part = "//" authority path-abempty
|
||||
-- / path-absolute
|
||||
-- / path-rootless
|
||||
-- / path-empty
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
create s.make (10)
|
||||
if attached authority as l_authority then
|
||||
s.append_character ('/')
|
||||
s.append_character ('/')
|
||||
s.append (l_authority)
|
||||
end
|
||||
s.append (path)
|
||||
Result := s
|
||||
end
|
||||
|
||||
username_password: detachable TUPLE [username: READABLE_STRING_8; password: detachable READABLE_STRING_8]
|
||||
-- Username and password value extrated from `userinfo'.
|
||||
--| userinfo = username:password
|
||||
local
|
||||
i: INTEGER
|
||||
u,p: detachable READABLE_STRING_8
|
||||
do
|
||||
if attached userinfo as t then
|
||||
i := t.index_of (':', 1)
|
||||
if i > 0 then
|
||||
p := t.substring (i + 1, t.count)
|
||||
u := t.substring (1, i - 1)
|
||||
else
|
||||
u := t
|
||||
p := Void
|
||||
end
|
||||
Result := [u, p]
|
||||
end
|
||||
end
|
||||
|
||||
username: detachable READABLE_STRING_8
|
||||
-- Eventual username.
|
||||
do
|
||||
if attached username_password as up then
|
||||
Result := up.username
|
||||
end
|
||||
end
|
||||
|
||||
password: detachable READABLE_STRING_8
|
||||
-- Eventual password.
|
||||
do
|
||||
if attached username_password as up then
|
||||
Result := up.password
|
||||
end
|
||||
end
|
||||
|
||||
authority: detachable READABLE_STRING_8
|
||||
-- Hierarchical element for naming authority.
|
||||
--| RFC3986: authority = [ userinfo "@" ] host [ ":" port ]
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
if attached host as h then
|
||||
if attached userinfo as u then
|
||||
create s.make_from_string (u)
|
||||
s.append_character ('@')
|
||||
s.append (h)
|
||||
else
|
||||
create s.make_from_string (h)
|
||||
end
|
||||
if port /= 0 then
|
||||
s.append_character (':')
|
||||
s.append_integer (port)
|
||||
end
|
||||
Result := s
|
||||
else
|
||||
check not is_valid or else (userinfo = Void and port = 0) end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
string: READABLE_STRING_8
|
||||
-- String representation.
|
||||
-- scheme://username:password@hostname/path?query#fragment
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
if attached scheme as l_scheme and then not l_scheme.is_empty then
|
||||
create s.make_from_string (l_scheme)
|
||||
s.append_character (':')
|
||||
else
|
||||
create s.make_empty
|
||||
end
|
||||
s.append (hier)
|
||||
if attached query as q then
|
||||
s.append_character ('?')
|
||||
s.append (q)
|
||||
end
|
||||
if attached fragment as f then
|
||||
s.append_character ('#')
|
||||
s.append (f)
|
||||
end
|
||||
Result := s
|
||||
end
|
||||
|
||||
resolved_uri: URI
|
||||
-- Resolved URI, i.e remove segment-component from `path'
|
||||
local
|
||||
p: STRING_8
|
||||
lst: like path_segments
|
||||
l_first: BOOLEAN
|
||||
do
|
||||
from
|
||||
lst := path_segments
|
||||
lst.start
|
||||
until
|
||||
lst.off
|
||||
loop
|
||||
if lst.item.same_string (".") then
|
||||
lst.remove
|
||||
elseif lst.item.same_string ("..") then
|
||||
lst.back
|
||||
if not lst.before then
|
||||
lst.remove
|
||||
lst.remove
|
||||
else
|
||||
lst.forth
|
||||
lst.remove
|
||||
end
|
||||
else
|
||||
lst.forth
|
||||
end
|
||||
end
|
||||
create p.make (path.count)
|
||||
l_first := True
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
if l_first then
|
||||
l_first := False
|
||||
else
|
||||
p.append_character ('/')
|
||||
end
|
||||
p.append (c.item)
|
||||
end
|
||||
if p.is_empty then
|
||||
else
|
||||
if p.item (1) /= '/' then
|
||||
if not path.is_empty and then path.item (1) = '/' then
|
||||
p.prepend_character ('/')
|
||||
end
|
||||
end
|
||||
end
|
||||
create Result.make_from_string (string)
|
||||
Result.set_path (p)
|
||||
end
|
||||
|
||||
feature -- Comparison
|
||||
|
||||
is_same_uri (a_uri: URI): BOOLEAN
|
||||
-- Is `a_uri' same as Current ?
|
||||
--| See http://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_unreserved_characters
|
||||
do
|
||||
Result := decoded_www_form_urlencoded_string (string).same_string (decoded_www_form_urlencoded_string (a_uri.string))
|
||||
end
|
||||
|
||||
feature -- Element Change
|
||||
|
||||
set_scheme (v: READABLE_STRING_8)
|
||||
-- Set `scheme' to `v'
|
||||
require
|
||||
is_valid_scheme (v)
|
||||
do
|
||||
create scheme.make_from_string (v)
|
||||
ensure
|
||||
scheme_set: scheme.same_string (v)
|
||||
end
|
||||
|
||||
set_userinfo (v: detachable READABLE_STRING_8)
|
||||
require
|
||||
is_valid_userinfo (v)
|
||||
do
|
||||
if v = Void then
|
||||
userinfo := Void
|
||||
else
|
||||
create userinfo.make_from_string (v.as_string_8)
|
||||
end
|
||||
ensure
|
||||
userinfo_set: is_same_string (v, userinfo)
|
||||
end
|
||||
|
||||
set_hostname (v: detachable READABLE_STRING_8)
|
||||
-- Set `host' to `v'
|
||||
require
|
||||
is_valid_host (v)
|
||||
do
|
||||
if v = Void then
|
||||
host := Void
|
||||
else
|
||||
create host.make_from_string (v)
|
||||
end
|
||||
ensure
|
||||
hostname_set: is_same_string (v, host)
|
||||
end
|
||||
|
||||
set_port (v: like port)
|
||||
-- Set `port' to `v'
|
||||
do
|
||||
port := v
|
||||
ensure
|
||||
port_set: port = v
|
||||
end
|
||||
|
||||
set_path (a_path: READABLE_STRING_8)
|
||||
-- Set `path' to `a_path'
|
||||
require
|
||||
is_valid_path (a_path)
|
||||
do
|
||||
create path.make_from_string (a_path)
|
||||
ensure
|
||||
path_set: path.same_string_general (a_path)
|
||||
end
|
||||
|
||||
set_query (v: detachable READABLE_STRING_8)
|
||||
-- Set `query' to `v'
|
||||
require
|
||||
is_valid_query (v)
|
||||
do
|
||||
if v = Void then
|
||||
query := Void
|
||||
else
|
||||
create query.make_from_string (v)
|
||||
end
|
||||
ensure
|
||||
query_set: is_same_string (v, query)
|
||||
end
|
||||
|
||||
set_fragment (v: detachable READABLE_STRING_8)
|
||||
-- Set `fragment' to `v'
|
||||
require
|
||||
is_valid_fragment (v)
|
||||
do
|
||||
if v = Void then
|
||||
fragment := Void
|
||||
else
|
||||
create fragment.make_from_string (v)
|
||||
end
|
||||
ensure
|
||||
fragment_set: is_same_string (v, fragment)
|
||||
end
|
||||
|
||||
feature -- Change: query
|
||||
|
||||
remove_query
|
||||
-- Remove query from Current URI
|
||||
do
|
||||
query := Void
|
||||
end
|
||||
|
||||
add_query_parameter (a_name: READABLE_STRING_GENERAL; a_value: detachable READABLE_STRING_GENERAL)
|
||||
-- Add non percent-encoded parameters
|
||||
local
|
||||
q: detachable STRING
|
||||
do
|
||||
if attached query as l_query then
|
||||
create q.make_from_string (l_query)
|
||||
else
|
||||
create q.make_empty
|
||||
end
|
||||
if not q.is_empty then
|
||||
q.append_character ('&')
|
||||
end
|
||||
|
||||
q.append (www_form_urlencoded_string (a_name))
|
||||
if a_value /= Void then
|
||||
q.append_character ('=')
|
||||
q.append (www_form_urlencoded_string (a_value))
|
||||
end
|
||||
create query.make_from_string (q)
|
||||
end
|
||||
|
||||
add_query_parameters (lst: ITERABLE [TUPLE [name: READABLE_STRING_GENERAL; value: detachable READABLE_STRING_GENERAL]])
|
||||
-- Add non percent-encoded parameters from manifest
|
||||
do
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
add_query_parameter (c.item.name, c.item.value)
|
||||
end
|
||||
end
|
||||
|
||||
add_query_parameters_from_table (tb: TABLE_ITERABLE [detachable READABLE_STRING_GENERAL, READABLE_STRING_GENERAL])
|
||||
-- Add non percent-encoded parameters from table
|
||||
do
|
||||
across
|
||||
tb as c
|
||||
loop
|
||||
add_query_parameter (c.key, c.item)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_valid_scheme (s: READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
||||
local
|
||||
i,n: INTEGER
|
||||
c: CHARACTER_32
|
||||
do
|
||||
if s.is_empty then
|
||||
Result := False -- Check for URI-reference ..
|
||||
else
|
||||
from
|
||||
i := 1
|
||||
n := s.count
|
||||
Result := is_alpha_character (string_item (s, i))
|
||||
i := 2
|
||||
until
|
||||
not Result or i > n
|
||||
loop
|
||||
c := string_item (s, i)
|
||||
Result := is_alpha_or_digit_character (c) or c = '+' or c = '-' or c = '.'
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_valid_userinfo (s: detachable READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
|
||||
local
|
||||
i,n: INTEGER
|
||||
c: CHARACTER_32
|
||||
do
|
||||
Result := True
|
||||
if s /= Void then
|
||||
from
|
||||
i := 1
|
||||
n := s.count
|
||||
until
|
||||
not Result or i > n
|
||||
loop
|
||||
c := string_item (s, i)
|
||||
-- unreserved
|
||||
if is_unreserved_character (c)
|
||||
or is_sub_delims_character (c)
|
||||
or c = ':'
|
||||
then
|
||||
-- True
|
||||
elseif c = '%%' then
|
||||
if
|
||||
i + 2 <= n and then
|
||||
is_hexa_decimal_character (string_item (s, i+ 1)) and is_hexa_decimal_character (string_item (s, i + 2))
|
||||
then
|
||||
-- True
|
||||
i := i + 2
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_valid_host (s: detachable READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- host = IP-literal / IPv4address / reg-name
|
||||
-- IP-literal = "[" ( IPv6address / IPvFuture ) "]"
|
||||
-- IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
|
||||
-- IPv6address = 6( h16 ":" ) ls32
|
||||
-- / "::" 5( h16 ":" ) ls32
|
||||
-- / [ h16 ] "::" 4( h16 ":" ) ls32
|
||||
-- / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
||||
-- / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
||||
-- / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
||||
-- / [ *4( h16 ":" ) h16 ] "::" ls32
|
||||
-- / [ *5( h16 ":" ) h16 ] "::" h16
|
||||
-- / [ *6( h16 ":" ) h16 ] "::"
|
||||
--
|
||||
-- ls32 = ( h16 ":" h16 ) / IPv4address
|
||||
-- ; least-significant 32 bits of address
|
||||
--
|
||||
-- h16 = 1*4HEXDIG
|
||||
-- ; 16 bits of address represented in hexadecimal
|
||||
--
|
||||
-- IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
|
||||
--
|
||||
-- dec-octet = DIGIT ; 0-9
|
||||
-- / %x31-39 DIGIT ; 10-99
|
||||
-- / "1" 2DIGIT ; 100-199
|
||||
-- / "2" %x30-34 DIGIT ; 200-249
|
||||
-- / "25" %x30-35 ; 250-255
|
||||
--
|
||||
-- reg-name = *( unreserved / pct-encoded / sub-delims )
|
||||
do
|
||||
Result := True
|
||||
if s /= Void and then not s.is_empty then
|
||||
if string_item (s, 1) = '[' and string_item (s, s.count) = ']' then
|
||||
Result := True -- IPV6 : to complete
|
||||
else
|
||||
Result := is_hexa_decimal_character (string_item (s, 1)) -- IPV4 or reg-name : to complete
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_valid_path (s: READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- path = path-abempty ; begins with "/" or is empty
|
||||
-- / path-absolute ; begins with "/" but not "//"
|
||||
-- / path-noscheme ; begins with a non-colon segment
|
||||
-- / path-rootless ; begins with a segment
|
||||
-- / path-empty ; zero characters
|
||||
--
|
||||
-- path-abempty = *( "/" segment )
|
||||
-- path-absolute = "/" [ segment-nz *( "/" segment ) ]
|
||||
-- path-noscheme = segment-nz-nc *( "/" segment )
|
||||
-- path-rootless = segment-nz *( "/" segment )
|
||||
-- path-empty = 0<pchar>
|
||||
-- segment = *pchar
|
||||
-- segment-nz = 1*pchar
|
||||
-- segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
|
||||
-- ; non-zero-length segment without any colon ":"
|
||||
--
|
||||
-- pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
||||
do
|
||||
if s.is_empty or string_item (s, 1) = '/' then
|
||||
Result := is_valid_in_uri_string (s)
|
||||
elseif has_authority then
|
||||
if string_item (s, 1) = '/' and (s.count > 1 implies string_item (s, 2) /= '/') then
|
||||
Result := is_valid_in_uri_string (s)
|
||||
end
|
||||
elseif s.is_empty then
|
||||
Result := True
|
||||
else
|
||||
Result := is_valid_in_uri_string (s)
|
||||
end
|
||||
-- TO COMPLETE
|
||||
end
|
||||
|
||||
is_valid_query (s: detachable READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- query = *( pchar / "/" / "?" )
|
||||
local
|
||||
i,n: INTEGER
|
||||
c: CHARACTER_32
|
||||
do
|
||||
Result := True
|
||||
if s /= Void then
|
||||
from
|
||||
i := 1
|
||||
n := s.count
|
||||
until
|
||||
not Result or i > n
|
||||
loop
|
||||
c := string_item (s, i)
|
||||
-- pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
||||
if -- pchar
|
||||
is_unreserved_character (c)
|
||||
or is_sub_delims_character (c)
|
||||
or c = ':' or c = '@'
|
||||
then
|
||||
Result := True
|
||||
elseif c = '/' or c = '?' then
|
||||
Result := True
|
||||
elseif c = '%%' then
|
||||
if
|
||||
i + 2 <= n and then
|
||||
is_hexa_decimal_character (string_item (s, i + 1)) and is_hexa_decimal_character (string_item (s, i + 2))
|
||||
then
|
||||
-- True
|
||||
i := i + 2
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_valid_fragment (s: detachable READABLE_STRING_GENERAL): BOOLEAN
|
||||
--fragment = *( pchar / "/" / "?" )
|
||||
local
|
||||
i,n: INTEGER
|
||||
c: CHARACTER_32
|
||||
do
|
||||
Result := True
|
||||
if s /= Void then
|
||||
from
|
||||
i := 1
|
||||
n := s.count
|
||||
until
|
||||
not Result or i > n
|
||||
loop
|
||||
c := string_item (s, i)
|
||||
-- pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
||||
if -- pchar
|
||||
is_unreserved_character (c)
|
||||
or is_sub_delims_character (c)
|
||||
or c = ':' or c = '@'
|
||||
then
|
||||
Result := True
|
||||
elseif c = '/' or c = '?' then
|
||||
Result := True
|
||||
elseif c = '%%' then
|
||||
if
|
||||
i + 2 <= n and then
|
||||
is_alpha_or_digit_character (string_item (s, i + 1)) and is_alpha_or_digit_character (string_item (s, i + 2))
|
||||
then
|
||||
i := i + 2
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
else
|
||||
Result := False
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
string_item (s: READABLE_STRING_GENERAL; i: INTEGER): CHARACTER_32
|
||||
do
|
||||
Result := s.code (i).to_character_32
|
||||
end
|
||||
|
||||
append_www_form_urlencoded_string_to (a_string: READABLE_STRING_GENERAL; a_target: STRING_GENERAL)
|
||||
-- The application/x-www-form-urlencoded encoded string for `a_string'.
|
||||
-- character encoding is UTF-8.
|
||||
-- See http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
|
||||
do
|
||||
append_percent_encoded_string_to (a_string, a_target)
|
||||
end
|
||||
|
||||
www_form_urlencoded_string (a_string: READABLE_STRING_GENERAL): STRING_8
|
||||
-- The application/x-www-form-urlencoded encoded string for `a_string'.
|
||||
-- character encoding is UTF-8.
|
||||
-- See http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
|
||||
do
|
||||
create Result.make (a_string.count)
|
||||
append_percent_encoded_string_to (a_string, Result)
|
||||
end
|
||||
|
||||
append_decoded_www_form_urlencoded_string_to (a_string: READABLE_STRING_GENERAL; a_target: STRING_GENERAL)
|
||||
-- The string decoded from application/x-www-form-urlencoded encoded string `a_string'.
|
||||
-- character encoding is UTF-8.
|
||||
-- See http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
|
||||
do
|
||||
append_percent_decoded_string_to (a_string, a_target)
|
||||
end
|
||||
|
||||
decoded_www_form_urlencoded_string (a_string: READABLE_STRING_GENERAL): STRING_32
|
||||
-- The string decoded from application/x-www-form-urlencoded encoded string `a_string'.
|
||||
-- character encoding is UTF-8.
|
||||
-- See http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
|
||||
do
|
||||
create Result.make (a_string.count)
|
||||
append_percent_decoded_string_to (a_string, Result)
|
||||
end
|
||||
|
||||
feature -- Assertion helper
|
||||
|
||||
is_valid_in_uri_string (s: READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- Is `s' composed only of ASCII character?
|
||||
local
|
||||
i,n: INTEGER
|
||||
do
|
||||
from
|
||||
Result := True
|
||||
i := 1
|
||||
n := s.count
|
||||
until
|
||||
not Result or i > n
|
||||
loop
|
||||
if s.code (i) > 0x7F then
|
||||
Result := False
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
is_same_string (s1, s2: detachable READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- `s1' and `s2' have same string content?
|
||||
do
|
||||
if s1 = Void then
|
||||
Result := s2 = Void
|
||||
elseif s2 = Void then
|
||||
Result := False
|
||||
else
|
||||
Result := s1.same_string (s2)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
debug_output: STRING
|
||||
-- String that should be displayed in debugger to represent `Current'.
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
create s.make_empty
|
||||
s.append (string)
|
||||
Result := s
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "Copyright (c) 1984-2013, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="uri" uuid="C83EA64A-F823-4A1C-A38E-138EDB142F52" library_target="uri">
|
||||
<target name="uri">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<cluster name="src" location=".\src\">
|
||||
<cluster name="implementation" location="$|implementation\" hidden="true"/>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
@@ -8,6 +8,9 @@ class
|
||||
|
||||
inherit
|
||||
NETWORK_STREAM_SOCKET
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
create
|
||||
make_server_by_address_and_port,
|
||||
@@ -18,6 +21,13 @@ create {NETWORK_STREAM_SOCKET}
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Create a network stream socket.
|
||||
do
|
||||
Precursor
|
||||
set_reuse_address
|
||||
end
|
||||
|
||||
make_server_by_address_and_port (an_address: INET_ADDRESS; a_port: INTEGER)
|
||||
-- Create server socket on `an_address' and `a_port'.
|
||||
require
|
||||
|
||||
57
doc/wiki/Doc_Getting_Started.mediawiki
Normal file
57
doc/wiki/Doc_Getting_Started.mediawiki
Normal file
@@ -0,0 +1,57 @@
|
||||
Menu :: [[Doc_Getting_Started|Getting Started]] :: [[Doc_Community|Community]]
|
||||
|
||||
= Getting Started =
|
||||
This page will help you to get started with EWF. We will first see how to install EWF and then how to compile and run the venerable Hello World example.
|
||||
|
||||
== Installation ==
|
||||
=== EiffelStudio 7.2 ===
|
||||
EWF is already included in EiffelStudio 7.2: you don't have to do anything in this case! This is the recommanded solution if you are a new developer or are new to Eiffel.
|
||||
|
||||
=== Other EiffelStudio versions ===
|
||||
If you have another version of EiffelStudio than 7.2, you have to
|
||||
|
||||
* dowload EWF
|
||||
* create a directory where you will put your custum Eiffel libraries
|
||||
* extract EWF in the newly created directory
|
||||
* define the environment variable EIFFEL_LIBRARY to point to the newly created directory
|
||||
|
||||
=== Source code ===
|
||||
The source code is available on Github. You can get it by running the command:
|
||||
|
||||
<code>git clone git://github.com/EiffelWebFramework/EWF.git</code>
|
||||
|
||||
== Hello World ==
|
||||
The hello world example is located in the directory $ISE_EIFFEL/contrib/examples/web/ewf/simple. Just double click on the simple.ecf file and select the simple target or if you prefer the command line, run the command:
|
||||
<code>estudio -config simple.ecf -target simple</code>
|
||||
|
||||
Once the project is compiled, we will adapt the root class to point to port number 9090.
|
||||
|
||||
'''Note''': By default, the application listens on port 80, which is often already used by standard webservers (Apache, nginx, ...). Moreover, on Linux, ports below 1024 can only be opened by root.
|
||||
|
||||
To do this, we will redefine the feature initialize as follows:
|
||||
|
||||
|
||||
class
|
||||
APPLICATION
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
-- Initialize current service
|
||||
do
|
||||
set_service_option ("port", 9090)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
After one more compile, you can now launch the application and point your browser to [http://localhost:9090].
|
||||
You should now see a simple page with Hello World.
|
||||
7
doc/wiki/Doc_Index.mediawiki
Normal file
7
doc/wiki/Doc_Index.mediawiki
Normal file
@@ -0,0 +1,7 @@
|
||||
Menu :: [[Doc_Getting_Started|Getting Started]] :: [[Doc_Community|Community]]
|
||||
|
||||
= Eiffel Web Framework =
|
||||
Framework to build web applications in Eiffel
|
||||
|
||||
[ [http://github.com/EiffelWebFramework/EWF/zipball/ Download Current] ]
|
||||
[ [http://github.com/EiffelWebFramework/EWF/zipball/release-0.3 Download v0.3] ]
|
||||
@@ -6,7 +6,7 @@ The official documentation/wiki is located at https://github.com/EiffelWebFramew
|
||||
## Organization ##
|
||||
- Mailing list: please visit and subscribe to the mailing list page [[http://groups.google.com/group/eiffel-web-framework]] 
|
||||
- Most of the topics are discussed on the mailing list (google group).
|
||||
- For time to time we have web meeting, and less frequently physical meetings that occurs usually during other Eiffel related events.
|
||||
- For time to time we have [[web meetings|meetings]], and less frequently [[physical meetings|meetings]] that occurs usually during other Eiffel related events.
|
||||
|
||||
## Documentation ##
|
||||
- to redo
|
||||
|
||||
4
doc/wiki/Meetings.md
Normal file
4
doc/wiki/Meetings.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Previous and future meetings
|
||||
|
||||
* [[Web-meeting: 2012-09-18|Web-meeting-2012-09-18]]
|
||||
* For previous meetings, check the ["meeting" topics](https://groups.google.com/forum/?fromgroups=#!tags/eiffel-web-framework/meeting) on the [forum](http://groups.google.com/group/eiffel-web-framework)
|
||||
@@ -12,3 +12,9 @@ For any entry, please use this template
|
||||
|
||||
----
|
||||
|
||||
## Add support for Swagger
|
||||
* _Suggested by **Olivier**_
|
||||
* _Description_: Build a Swagger Eiffel implementation
|
||||
* _References_: http://swagger.wordnik.com/
|
||||
|
||||
----
|
||||
|
||||
@@ -96,6 +96,7 @@ If you are a student, don't hesitate to pick one, or even suggest a new project,
|
||||
* _Suggested by **Jocelyn**_
|
||||
* _Supervisor_:
|
||||
* _Suitability_: TODO
|
||||
* _Status_: started, and open for contribution, collaboration, please contact Jocelyn.
|
||||
* _Description_: Using EWF, Build a simple CMS (Content Management System) framework and then an example. It should provide common features such as:
|
||||
- user management (register, login, lost password -> send email)
|
||||
- page editing
|
||||
@@ -225,6 +226,13 @@ If you are a student, don't hesitate to pick one, or even suggest a new project,
|
||||
* This should reuse and improve the "http_client" provided by EWF. Eventually also write the EiffelNet implementation to be independant from cURL
|
||||
* **Requirement**: OAuth client eiffel component
|
||||
|
||||
## Build a ESI preprocessor, or proxy
|
||||
* _Suggested by **Jocelyn**_
|
||||
* _Supervisor_:
|
||||
* _Suitability_: TODO
|
||||
* _Description_: TODO
|
||||
* See: http://en.wikipedia.org/wiki/Edge_Side_Includes
|
||||
|
||||
----
|
||||
# Feel free to add new idea below this line
|
||||
----
|
||||
|
||||
14
doc/wiki/Useful-links.md
Normal file
14
doc/wiki/Useful-links.md
Normal file
@@ -0,0 +1,14 @@
|
||||
## Eiffel
|
||||
|
||||
* http://www.scoop.it/t/eiffel-resources
|
||||
* http://www.scoop.it/t/eiffel
|
||||
|
||||
## Hypermedia
|
||||
|
||||
* http://www.scoop.it/t/hyper-media-apis
|
||||
* http://www.scoop.it/t/hypermedia-api
|
||||
|
||||
## ETags
|
||||
|
||||
* http://www.mnot.net/blog/2007/08/07/etags
|
||||
* http://bitworking.org/news/150/REST-Tip-Deep-etags-give-you-more-benefits
|
||||
62
doc/wiki/Web-meeting-2012-09-18.md
Normal file
62
doc/wiki/Web-meeting-2012-09-18.md
Normal file
@@ -0,0 +1,62 @@
|
||||
## Participants
|
||||
|
||||
* Jocelyn Fiat
|
||||
* Berend de Boer
|
||||
* Olivier Ligot
|
||||
* Javier Velilla
|
||||
|
||||
## Information
|
||||
|
||||
### When ?
|
||||
* Tuesday 18th of september, 19:00 - 20:00 UTC/GMT time (see 3rd time in http://www.doodle.com/8v2sekiyebp4dpyh)
|
||||
|
||||
### Where ?
|
||||
Web meeting using webex
|
||||
|
||||
* Short url: http://goo.gl/wBz11
|
||||
* Long url: https://eiffel.webex.com/eiffel/j.php?ED=211265702&UID=0&PW=NZWNiMjBiZWIz&RT=MiMyMA%3D%3D
|
||||
* Related Google group topic: https://groups.google.com/d/topic/eiffel-web-framework/A7ADPAT3nj8/discussion
|
||||
|
||||
## Agenda
|
||||
|
||||
* Current status of EWF
|
||||
* Focus on new design for the router system, and take decision
|
||||
* decide if this replace the previous system,
|
||||
* or if this is provided as another solution (we would then have 2 routers system).
|
||||
* It might be possible to implement the previous uri and uri-template router with the new design, and mark them obsolete, this would avoid breaking existing code, but if no-one ask for it, no need to spend time doing it.
|
||||
* Current activities
|
||||
* Technology forecasting about REST, Hypermedia API, Collection/JSON, HAL, ...
|
||||
* Building a CMS framework inspired by Drupal, and using EWF
|
||||
* Libraries in-progress or draft: OAuth (consumer), Google API, Github API, Template engine, Wikitext parser, CMS (including sub libraries which will be part of EWF, such as session handling, mailer, ...)
|
||||
* Documentation
|
||||
* Remaining issues
|
||||
* Review design in relation to concurrency, and provide example demonstrating concurrency with EWF
|
||||
* Review design to allow easier extension/customization of EWF, such as using its own MIME handlers.
|
||||
* Demo for a CMS built with EWF (inspired by Drupal)
|
||||
* Future tasks
|
||||
* [graphviz-server](https://github.com/EiffelWebFramework/graphviz-server)
|
||||
* Improving Eiffel Web Nino: to support persistent connection, and better concurrency design.
|
||||
* Provide friendly components to generate HTML (DHTML, HTML5, ...), (coders do not want to learn HTML and
|
||||
CSS)
|
||||
* Users feedback, suggestions and requests
|
||||
* ...
|
||||
* Next meeting
|
||||
|
||||
## Materials
|
||||
|
||||
## Minutes
|
||||
* swagger: see if we could generate EWF code from a swagger specification
|
||||
* Jocelyn will publish its attempt to build a CMS with EWF
|
||||
* CMS demo: ... as announced ... some parts look very like drupal.
|
||||
* Jocelyn will publish a few in-progress draft libraries
|
||||
* Javier will focus on graphviz-server and hypermedia API
|
||||
* Berend may send a short note on how he uses EWF (and generate code from description)
|
||||
* Jocelyn will try to find time to complete the thread and SCOOP implementation of Eiffel Web Nino
|
||||
* Olivier will have a closer look at swagger
|
||||
* EWF will adopt the new WSF_ROUTER design as no-one expressed opposition. Olivier said converting his code is not a big task. Same for other users.
|
||||
* The current state of EWF/WSF seems to be ok for users, we can focus on libraries on top of EWF/WSF
|
||||
* We might need an HTML parser, if we want to support HTML as an hypermedia API (maybe we can require XHTML for now)
|
||||
* No high priority to improve Eiffel Web Nino , for now it is mainly used during development.
|
||||
|
||||
* It seems RESTful + Hypermedia API is the top priority for EWF.
|
||||
|
||||
1
draft/application/cms/.gitignore
vendored
1
draft/application/cms/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
_storage_
|
||||
@@ -1,2 +1,2 @@
|
||||
Experimental a simple CMS using EWF.
|
||||
Inspired by Drupal
|
||||
The "cms" component moved.
|
||||
Please visit https://github.com/EiffelWebFramework/cms to follow the project.
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="cms" uuid="0D24AE3C-61DA-4E81-8DCF-90C2E65FB669" library_target="cms">
|
||||
<target name="cms">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="exception_trace" value="true"/>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="encoder" location="..\..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="..\..\..\library\server\wsf_html\wsf_html-safe.ecf" readonly="false"/>
|
||||
<library name="http" location="..\..\..\library\network\protocol\http\http-safe.ecf" readonly="false"/>
|
||||
<library name="openid" location="..\..\..\library\security\openid\consumer\openid-safe.ecf" readonly="false"/>
|
||||
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="uri_template" location="..\..\..\library\text\parser\uri_template\uri_template-safe.ecf"/>
|
||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid-safe.ecf"/>
|
||||
<library name="wsf" location="..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_session" location="..\..\..\library\server\wsf\wsf_session-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="cms" library_target="cms" uuid="0D24AE3C-61DA-4E81-8DCF-90C2E65FB669">
|
||||
<target name="cms">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" syntax="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<setting name="exception_trace" value="true"/>
|
||||
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="encoder" location="..\..\..\library\text\encoder\encoder.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="..\..\..\library\server\wsf_html\wsf_html.ecf" readonly="false"/>
|
||||
<library name="http" location="..\..\..\library\network\protocol\http\http.ecf" readonly="false"/>
|
||||
<library name="openid" location="..\..\..\library\security\openid\consumer\openid.ecf" />
|
||||
<library name="process" location="$ISE_LIBRARY\library\process\process.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="uuid" location="$ISE_LIBRARY\library\uuid\uuid.ecf"/>
|
||||
<library name="uri_template" location="..\..\..\library\text\parser\uri_template\uri_template.ecf"/>
|
||||
<library name="wsf" location="..\..\..\library\server\wsf\wsf.ecf" readonly="false"/>
|
||||
<library name="wsf_session" location="..\..\..\library\server\wsf\wsf_session.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,8 +0,0 @@
|
||||
site.name=EWF Web CMS
|
||||
#site.base_url=/demo
|
||||
site.email=your@email.com
|
||||
root-dir=../www
|
||||
var-dir=var
|
||||
files-dir=files
|
||||
themes-dir=${root-dir}/themes
|
||||
#theme=test
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="demo" uuid="402ED70E-9A85-4501-8730-7B211EB32E6B" library_target="demo">
|
||||
<target name="demo">
|
||||
<root class="WEB_CMS" feature="make_and_launch"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||
</option>
|
||||
<setting name="concurrency" value="none"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="default_nino" location="..\..\..\..\library\server\wsf\default\nino-safe.ecf"/>
|
||||
<library name="http" location="..\..\..\..\library\network\protocol\http\http-safe.ecf" readonly="false"/>
|
||||
<library name="nino" location="..\..\..\..\library\server\ewsgi\connectors\nino\nino-safe.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<library name="wsf_html" location="..\..\..\..\library\server\wsf_html\wsf_html-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="..\..\..\..\library\server\wsf\wsf-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,4 +0,0 @@
|
||||
# For nino connector, use port 9999
|
||||
port=9090
|
||||
|
||||
#verbose=true
|
||||
@@ -1,82 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_MODULE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
DEMO_MODULE
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
redefine
|
||||
links
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_ALTER
|
||||
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
name := "demo"
|
||||
version := "1.0"
|
||||
description := "demo"
|
||||
package := "misc"
|
||||
end
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
do
|
||||
service := a_service
|
||||
a_service.map_uri_template ("/demo/widget{/args}", agent handle_widget_demo (a_service, ?, ?))
|
||||
a_service.map_uri_template ("/demo/date/{arg}", agent handle_date_time_demo (a_service, ?, ?))
|
||||
a_service.map_uri_template ("/demo/format/{arg}", agent handle_format_demo (a_service, ?, ?))
|
||||
end
|
||||
|
||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
-- opts: CMS_API_OPTIONS
|
||||
do
|
||||
create lnk.make ("Demo::widget", "/demo/widget/")
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
|
||||
-- Link indexed by path
|
||||
local
|
||||
lnk: CMS_MODULE_LINK
|
||||
do
|
||||
Result := Precursor
|
||||
create lnk.make ("Date/time demo")
|
||||
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
|
||||
-- Result["/demo/date/{arg}"] := lnk
|
||||
end
|
||||
|
||||
handle_date_time_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ANY_CMS_EXECUTION}.make_with_text (req, res, cms, "<h1>Demo::date/time</h1>")).execute
|
||||
end
|
||||
|
||||
handle_format_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {ANY_CMS_EXECUTION}.make_with_text (req, res, cms, "<h1>Demo::format</h1>")).execute
|
||||
end
|
||||
|
||||
handle_widget_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {DEMO_WIDGET_CMS_EXECUTION}.make (req, res, cms)).execute
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,97 +0,0 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
class
|
||||
DEMO_WIDGET_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
local
|
||||
args: like arguments
|
||||
l_table: like new_table
|
||||
s: STRING
|
||||
do
|
||||
args := arguments
|
||||
if args.is_empty then
|
||||
set_title ("Widgets")
|
||||
set_main_content ("...")
|
||||
else
|
||||
|
||||
end
|
||||
l_table := new_table
|
||||
|
||||
create s.make_empty
|
||||
l_table.append_to_html (theme, s)
|
||||
set_main_content (s)
|
||||
end
|
||||
|
||||
new_table: WSF_WIDGET_AGENT_TABLE [READABLE_STRING_8]
|
||||
local
|
||||
l_table: WSF_WIDGET_AGENT_TABLE [READABLE_STRING_8]
|
||||
do
|
||||
create l_table.make
|
||||
l_table.add_css_style ("width: 85%%; border: solid 1px #999; padding: 2px;")
|
||||
|
||||
l_table.set_column_count (3)
|
||||
l_table.column (1).set_title ("First")
|
||||
l_table.column (2).set_title ("Second")
|
||||
l_table.column (3).set_title ("Third")
|
||||
|
||||
l_table.column (1).add_css_style ("width: 20%%")
|
||||
l_table.column (2).add_css_style ("width: 40px")
|
||||
l_table.column (3).add_css_style ("width: 40px")
|
||||
|
||||
l_table.set_data (<<"foo", "bar", "foobar">>)
|
||||
l_table.set_foot_data (<<"abc", "def">>)
|
||||
l_table.set_compute_item_function (agent (d: READABLE_STRING_8): WSF_WIDGET_TABLE_ROW
|
||||
local
|
||||
i: INTEGER
|
||||
w: WSF_WIDGET_TABLE_ITEM
|
||||
do
|
||||
create Result.make (d.count)
|
||||
if d.is_case_insensitive_equal ("bar") then
|
||||
Result.add_css_style ("background-color: #ccf;")
|
||||
end
|
||||
across
|
||||
d as c
|
||||
loop
|
||||
i := i + 1
|
||||
create w.make_with_text (c.item.out)
|
||||
if i = 1 then
|
||||
w.add_css_style ("background-color: #333; color: white; font-weight: bold;")
|
||||
elseif i > 3 then
|
||||
w.add_css_style ("color: red; border: solid 1px red; padding: 3px;")
|
||||
end
|
||||
Result.force (w)
|
||||
end
|
||||
end)
|
||||
|
||||
Result := l_table
|
||||
end
|
||||
|
||||
arguments: ARRAY [READABLE_STRING_32]
|
||||
-- Path parameters arguments related to {/vars}
|
||||
do
|
||||
if
|
||||
attached {WSF_TABLE} request.path_parameter ("args") as lst and then
|
||||
attached lst.as_array_of_string as arr
|
||||
then
|
||||
Result := arr
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
|
||||
Result.rebase (1)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,33 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {SHUTDOWN_CMS_EXECUTION}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SHUTDOWN_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
local
|
||||
b: STRING
|
||||
do
|
||||
create b.make_empty
|
||||
set_title ("Shutting down the service ...")
|
||||
if has_permission ("admin shutdown") then
|
||||
if attached {WGI_NINO_CONNECTOR} request.wgi_connector as nino then
|
||||
nino.server.shutdown_server
|
||||
end
|
||||
else
|
||||
b.append ("Access denied")
|
||||
end
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,69 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {SHUTDOWN_MODULE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SHUTDOWN_MODULE
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
redefine
|
||||
permissions
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_ALTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
name := "shutdown"
|
||||
version := "1.0"
|
||||
description := "Shutdown the service if this is EWF Nino or FCGI"
|
||||
package := "server"
|
||||
end
|
||||
|
||||
feature {CMS_SERVICE} -- Registration
|
||||
|
||||
service: detachable CMS_SERVICE
|
||||
|
||||
register (a_service: CMS_SERVICE)
|
||||
do
|
||||
a_service.map_uri ("/admin/shutdown/", agent handle_shutdown)
|
||||
|
||||
a_service.add_menu_alter_hook (Current)
|
||||
service := a_service
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
permissions (a_service: CMS_SERVICE): LIST [CMS_PERMISSION]
|
||||
do
|
||||
Result := Precursor (a_service)
|
||||
Result.extend ("shutdown")
|
||||
end
|
||||
|
||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
create lnk.make ("Shutdown", "/admin/shutdown/")
|
||||
lnk.set_permission_arguments (<<"shutdown">>)
|
||||
a_menu_system.management_menu.extend (lnk)
|
||||
end
|
||||
|
||||
handle_shutdown (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
if attached service as l_service then
|
||||
(create {SHUTDOWN_CMS_EXECUTION}.make (req, res, l_service)).execute ;
|
||||
else
|
||||
res.set_status_code ({HTTP_STATUS_CODE}.expectation_failed)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,135 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
This class implements the Demo of WEB CMS service
|
||||
|
||||
]"
|
||||
|
||||
class
|
||||
WEB_CMS
|
||||
|
||||
inherit
|
||||
WSF_DEFAULT_SERVICE
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
local
|
||||
args: ARGUMENTS
|
||||
cfg: detachable STRING
|
||||
i,n: INTEGER
|
||||
do
|
||||
--| Arguments
|
||||
create args
|
||||
from
|
||||
i := 1
|
||||
n := args.argument_count
|
||||
until
|
||||
i > n or cfg /= Void
|
||||
loop
|
||||
if attached args.argument (i) as s then
|
||||
if s.same_string ("--config") or s.same_string ("-c") then
|
||||
if i < n then
|
||||
cfg := args.argument (i + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
if cfg = Void then
|
||||
if file_exists ("cms.ini") then
|
||||
cfg := "cms.ini"
|
||||
end
|
||||
end
|
||||
|
||||
--| EWF settings
|
||||
service_options := create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("ewf.ini")
|
||||
Precursor
|
||||
|
||||
--| CMS initialization
|
||||
launch_cms (cms_setup (cfg))
|
||||
end
|
||||
|
||||
cms_setup (a_cfg_fn: detachable READABLE_STRING_8): CMS_CUSTOM_SETUP
|
||||
do
|
||||
if a_cfg_fn /= Void then
|
||||
create Result.make_from_file (a_cfg_fn)
|
||||
else
|
||||
create Result -- Default
|
||||
end
|
||||
setup_modules (Result)
|
||||
setup_storage (Result)
|
||||
end
|
||||
|
||||
launch_cms (a_setup: CMS_SETUP)
|
||||
local
|
||||
cms: CMS_SERVICE
|
||||
do
|
||||
create cms.make (a_setup)
|
||||
on_launched (cms)
|
||||
cms_service := cms
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
cms_service: CMS_SERVICE
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
cms_service.execute (req, res)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
setup_modules (a_setup: CMS_SETUP)
|
||||
local
|
||||
m: CMS_MODULE
|
||||
do
|
||||
create {DEMO_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.add_module (m)
|
||||
|
||||
create {SHUTDOWN_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.add_module (m)
|
||||
|
||||
create {DEBUG_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.add_module (m)
|
||||
|
||||
create {OPENID_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.add_module (m)
|
||||
end
|
||||
|
||||
setup_storage (a_setup: CMS_SETUP)
|
||||
do
|
||||
|
||||
end
|
||||
|
||||
feature -- Event
|
||||
|
||||
on_launched (cms: CMS_SERVICE)
|
||||
local
|
||||
e: CMS_EMAIL
|
||||
do
|
||||
create e.make (cms.site_email, cms.site_email, "[" + cms.site_name + "] launched...", "The site [" + cms.site_name + "] was launched at " + (create {DATE_TIME}.make_now_utc).out + " UTC.")
|
||||
cms.mailer.safe_process_email (e)
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
file_exists (fn: STRING): BOOLEAN
|
||||
local
|
||||
f: RAW_FILE
|
||||
do
|
||||
create f.make (fn)
|
||||
Result := f.exists and then f.is_readable
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,303 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_CONFIGURATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_CONFIGURATION
|
||||
|
||||
create
|
||||
make,
|
||||
make_from_file
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create options.make (10)
|
||||
analyze
|
||||
end
|
||||
|
||||
make_from_file (a_filename: READABLE_STRING_32)
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
make
|
||||
configuration_location := a_filename
|
||||
import (a_filename)
|
||||
analyze
|
||||
end
|
||||
|
||||
analyze
|
||||
do
|
||||
get_root_location
|
||||
get_var_location
|
||||
get_themes_location
|
||||
get_files_location
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
configuration_location: detachable READABLE_STRING_8
|
||||
|
||||
option (a_name: READABLE_STRING_GENERAL): detachable ANY
|
||||
do
|
||||
Result := options.item (a_name.as_string_8.as_lower)
|
||||
end
|
||||
|
||||
options: HASH_TABLE [STRING, STRING]
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
append_to_string (s: STRING)
|
||||
do
|
||||
s.append ("Options:%N")
|
||||
across
|
||||
options as c
|
||||
loop
|
||||
s.append (c.key)
|
||||
s.append_character ('=')
|
||||
s.append (c.key)
|
||||
s.append_character ('%N')
|
||||
end
|
||||
|
||||
s.append ("Specific:%N")
|
||||
s.append ("root_location=" + root_location + "%N")
|
||||
s.append ("var_location=" + var_location + "%N")
|
||||
s.append ("files_location=" + files_location + "%N")
|
||||
s.append ("themes_location=" + themes_location + "%N")
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_option (a_name: READABLE_STRING_GENERAL; a_value: STRING)
|
||||
do
|
||||
options.force (a_value, a_name.as_string_8)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
var_location: READABLE_STRING_8
|
||||
|
||||
root_location: READABLE_STRING_8
|
||||
|
||||
files_location: STRING
|
||||
|
||||
themes_location: STRING
|
||||
|
||||
theme_name (dft: detachable like theme_name): READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("theme") as s then
|
||||
Result := s
|
||||
elseif dft /= Void then
|
||||
Result := dft
|
||||
else
|
||||
Result := "default"
|
||||
end
|
||||
end
|
||||
|
||||
site_id: READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("site.id") as s then
|
||||
Result := s
|
||||
else
|
||||
Result := "_EWF_CMS_NO_ID_"
|
||||
end
|
||||
end
|
||||
|
||||
site_name (dft: like site_name): READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("site.name") as s then
|
||||
Result := s
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
end
|
||||
|
||||
site_url (dft: like site_url): READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("site.url") as s then
|
||||
Result := s
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
if Result /= Void then
|
||||
if Result.is_empty then
|
||||
-- ok
|
||||
elseif not Result.ends_with ("/") then
|
||||
Result := Result + "/"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
site_script_url (dft: like site_script_url): detachable READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("site.script_url") as s then
|
||||
Result := s
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
if Result /= Void then
|
||||
if Result.is_empty then
|
||||
elseif not Result.ends_with ("/") then
|
||||
Result := Result + "/"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
site_email (dft: like site_email): READABLE_STRING_8
|
||||
do
|
||||
if attached options.item ("site.email") as s then
|
||||
Result := s
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
get_var_location
|
||||
local
|
||||
res: STRING_32
|
||||
do
|
||||
if attached options.item ("var-dir") as s then
|
||||
res := s
|
||||
else
|
||||
res := execution_environment.current_working_directory
|
||||
end
|
||||
if res.ends_with ("/") then
|
||||
res.remove_tail (1)
|
||||
end
|
||||
var_location := res
|
||||
end
|
||||
|
||||
get_root_location
|
||||
local
|
||||
res: STRING_32
|
||||
do
|
||||
if attached options.item ("root-dir") as s then
|
||||
res := s
|
||||
else
|
||||
res := execution_environment.current_working_directory
|
||||
end
|
||||
if res.ends_with ("/") then
|
||||
res.remove_tail (1)
|
||||
end
|
||||
root_location := res
|
||||
end
|
||||
|
||||
get_files_location
|
||||
do
|
||||
if attached options.item ("files-dir") as s then
|
||||
files_location := s
|
||||
else
|
||||
files_location := "files"
|
||||
end
|
||||
end
|
||||
|
||||
get_themes_location
|
||||
local
|
||||
dn: DIRECTORY_NAME
|
||||
do
|
||||
if attached options.item ("themes-dir") as s then
|
||||
themes_location := s
|
||||
else
|
||||
create dn.make_from_string (root_location)
|
||||
dn.extend ("themes")
|
||||
themes_location := dn.string
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
import (a_filename: READABLE_STRING_32)
|
||||
-- Import ini file content
|
||||
local
|
||||
f: PLAIN_TEXT_FILE
|
||||
l,v: STRING_8
|
||||
p: INTEGER
|
||||
do
|
||||
--FIXME: handle unicode filename here.
|
||||
create f.make (a_filename)
|
||||
if f.exists and f.is_readable then
|
||||
f.open_read
|
||||
from
|
||||
f.read_line
|
||||
until
|
||||
f.exhausted
|
||||
loop
|
||||
l := f.last_string
|
||||
l.left_adjust
|
||||
if not l.is_empty then
|
||||
if l[1] = '#' then
|
||||
-- commented line
|
||||
else
|
||||
p := l.index_of ('=', 1)
|
||||
if p > 1 then
|
||||
v := l.substring (p + 1, l.count)
|
||||
l.keep_head (p - 1)
|
||||
v.left_adjust
|
||||
v.right_adjust
|
||||
l.right_adjust
|
||||
|
||||
if l.is_case_insensitive_equal ("@include") then
|
||||
import (resolved_string (v))
|
||||
else
|
||||
set_option (l.as_lower, resolved_string (v))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
f.read_line
|
||||
end
|
||||
f.close
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Environment
|
||||
|
||||
Execution_environment: EXECUTION_ENVIRONMENT
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
resolved_string (s: READABLE_STRING_8): STRING
|
||||
-- Resolved `s' using `options' or else environment variables.
|
||||
local
|
||||
i,n,b,e: INTEGER
|
||||
k: detachable READABLE_STRING_8
|
||||
do
|
||||
from
|
||||
i := 1
|
||||
n := s.count
|
||||
create Result.make (s.count)
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
if i + 1 < n and then s[i] = '$' and then s[i+1] = '{' then
|
||||
b := i + 2
|
||||
e := s.index_of ('}', b) - 1
|
||||
if e > 0 then
|
||||
k := s.substring (b, e)
|
||||
if attached option (k) as v then
|
||||
Result.append (v.out)
|
||||
i := e + 1
|
||||
elseif attached execution_environment.get (k) as v then
|
||||
Result.append (v)
|
||||
i := e + 1
|
||||
else
|
||||
Result.extend (s[i])
|
||||
end
|
||||
else
|
||||
Result.extend (s[i])
|
||||
end
|
||||
else
|
||||
Result.extend (s[i])
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
@@ -1,18 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_CUSTOM_SETUP}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_CUSTOM_SETUP
|
||||
|
||||
inherit
|
||||
CMS_DEFAULT_SETUP
|
||||
|
||||
create
|
||||
default_create,
|
||||
make,
|
||||
make_from_file
|
||||
|
||||
end
|
||||
@@ -1,134 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_DEFAULT_SETUP}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_DEFAULT_SETUP
|
||||
|
||||
inherit
|
||||
CMS_SETUP
|
||||
redefine
|
||||
default_create
|
||||
end
|
||||
|
||||
create
|
||||
default_create,
|
||||
make,
|
||||
make_from_file
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_cfg: CMS_CONFIGURATION)
|
||||
do
|
||||
configuration := a_cfg
|
||||
default_create
|
||||
end
|
||||
|
||||
make_from_file (fn: READABLE_STRING_8)
|
||||
local
|
||||
cfg: CMS_CONFIGURATION
|
||||
do
|
||||
create cfg.make_from_file (fn)
|
||||
make (cfg)
|
||||
end
|
||||
|
||||
default_create
|
||||
do
|
||||
Precursor
|
||||
build_modules
|
||||
build_storage
|
||||
build_session_manager
|
||||
build_auth_engine
|
||||
build_mailer
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
modules: ARRAYED_LIST [CMS_MODULE]
|
||||
|
||||
storage: CMS_STORAGE
|
||||
-- CMS persistent layer
|
||||
|
||||
session_manager: WSF_SESSION_MANAGER
|
||||
-- CMS Session manager
|
||||
|
||||
auth_engine: CMS_AUTH_ENGINE
|
||||
-- CMS Authentication engine
|
||||
|
||||
mailer: CMS_MAILER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
build_modules
|
||||
local
|
||||
m: CMS_MODULE
|
||||
do
|
||||
create modules.make (3)
|
||||
|
||||
-- Core
|
||||
create {USER_MODULE} m.make
|
||||
m.enable
|
||||
modules.extend (m)
|
||||
|
||||
create {ADMIN_MODULE} m.make
|
||||
m.enable
|
||||
modules.extend (m)
|
||||
|
||||
create {NODE_MODULE} m.make
|
||||
m.enable
|
||||
modules.extend (m)
|
||||
end
|
||||
|
||||
build_storage
|
||||
local
|
||||
dn: DIRECTORY_NAME
|
||||
do
|
||||
if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
|
||||
create dn.make_from_string (l_site_var_dir)
|
||||
else
|
||||
create dn.make
|
||||
end
|
||||
dn.extend ("_storage_")
|
||||
create {CMS_SED_STORAGE} storage.make (dn.string)
|
||||
end
|
||||
|
||||
build_session_manager
|
||||
local
|
||||
dn: DIRECTORY_NAME
|
||||
do
|
||||
if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
|
||||
create dn.make_from_string (l_site_var_dir)
|
||||
else
|
||||
create dn.make
|
||||
end
|
||||
dn.extend ("_storage_")
|
||||
dn.extend ("_sessions_")
|
||||
create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.string)
|
||||
end
|
||||
|
||||
build_auth_engine
|
||||
do
|
||||
create {CMS_STORAGE_AUTH_ENGINE} auth_engine.make (storage)
|
||||
end
|
||||
|
||||
build_mailer
|
||||
local
|
||||
ch_mailer: CMS_CHAIN_MAILER
|
||||
st_mailer: CMS_STORAGE_MAILER
|
||||
do
|
||||
create st_mailer.make (storage)
|
||||
create ch_mailer.make (st_mailer)
|
||||
ch_mailer.set_next (create {CMS_SENDMAIL_MAILER})
|
||||
mailer := ch_mailer
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
add_module (m: CMS_MODULE)
|
||||
do
|
||||
modules.force (m)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,715 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
This is the execution of the cms handler request
|
||||
It builds the content to get process to render the output
|
||||
]"
|
||||
|
||||
deferred class
|
||||
CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_COMMON_API
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (req: WSF_REQUEST; res: WSF_RESPONSE; a_service: like service)
|
||||
do
|
||||
status_code := {HTTP_STATUS_CODE}.ok
|
||||
service := a_service
|
||||
request := req
|
||||
response := res
|
||||
create header.make
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
do
|
||||
is_front := service.is_front_page (request)
|
||||
has_js := True -- by default it is true, check cookie to see if this is not supported.
|
||||
if attached request.cookie ("has_js") as c_has_js then
|
||||
has_js := c_has_js.same_string ("0")
|
||||
end
|
||||
get_theme
|
||||
controller := service.session_controller (request)
|
||||
create menu_system.make
|
||||
create blocks.make (3)
|
||||
|
||||
if attached {like message} session_item (pending_messages_session_item_name) as m then
|
||||
message := m
|
||||
end
|
||||
remove_session_item (pending_messages_session_item_name)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
service: CMS_SERVICE
|
||||
request: WSF_REQUEST
|
||||
|
||||
feature {CMS_SESSION_CONTROLER} -- Access: restricted
|
||||
|
||||
response: WSF_RESPONSE
|
||||
|
||||
controller: CMS_SESSION_CONTROLER
|
||||
|
||||
pending_messages_session_item_name: STRING = "cms.pending_messages"
|
||||
-- Session item name to get the pending messages.
|
||||
|
||||
feature -- Access: CMS
|
||||
|
||||
site_name: STRING_32
|
||||
do
|
||||
Result := service.site_name
|
||||
end
|
||||
|
||||
front_page_url: READABLE_STRING_8
|
||||
do
|
||||
Result := url ("/", Void)
|
||||
end
|
||||
|
||||
feature -- Permission
|
||||
|
||||
frozen has_permissions (lst: detachable ITERABLE [READABLE_STRING_8]): BOOLEAN
|
||||
do
|
||||
if lst = Void then
|
||||
Result := True
|
||||
else
|
||||
Result := across lst as c all has_permission (c.item) end
|
||||
end
|
||||
end
|
||||
|
||||
frozen has_permission (s: detachable READABLE_STRING_8): BOOLEAN
|
||||
-- Anonymous or Current `user' has permission for `s'
|
||||
--| `s' could be "create page",
|
||||
local
|
||||
u: detachable CMS_USER
|
||||
do
|
||||
if s = Void then
|
||||
Result := True
|
||||
else
|
||||
if s.same_string ("authenticated") then
|
||||
Result := authenticated
|
||||
else
|
||||
u := user
|
||||
if u /= Void and then u.is_admin then
|
||||
Result := True
|
||||
else
|
||||
Result := service.user_has_permission (u, s)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status
|
||||
|
||||
is_front: BOOLEAN
|
||||
|
||||
has_js: BOOLEAN
|
||||
-- Client has javascript enabled?
|
||||
-- FIXME: not yet implemented
|
||||
|
||||
is_mobile: BOOLEAN
|
||||
-- Is Client on mobile device?
|
||||
-- FIXME: not yet implemented
|
||||
|
||||
feature -- Theme
|
||||
|
||||
theme: CMS_THEME
|
||||
|
||||
get_theme
|
||||
do
|
||||
create {DEFAULT_CMS_THEME} theme.make (service)
|
||||
end
|
||||
|
||||
feature -- Access: User
|
||||
|
||||
authenticated: BOOLEAN
|
||||
do
|
||||
Result := user /= Void
|
||||
end
|
||||
|
||||
user: detachable CMS_USER
|
||||
do
|
||||
if attached {CMS_USER} session_item ("user") as u then
|
||||
Result := u
|
||||
end
|
||||
end
|
||||
|
||||
last_user_access_date: detachable DATE_TIME
|
||||
do
|
||||
if attached {DATE_TIME} session_item ("last_access") as dt then
|
||||
Result := dt
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Element change: user
|
||||
|
||||
login (u: attached like user; req: WSF_REQUEST)
|
||||
do
|
||||
controller.start_session (req)
|
||||
u.set_last_login_date_now
|
||||
storage.save_user (u)
|
||||
set_user (u)
|
||||
init_last_user_access_date
|
||||
log ("user", "user %"" + u.name + "%" signed in.", 0, user_local_link (u))
|
||||
end
|
||||
|
||||
logout (req: WSF_REQUEST)
|
||||
require
|
||||
authenticated
|
||||
do
|
||||
if attached user as u then
|
||||
log ("user", "user %"" + u.name + "%" signed out.", 0, user_local_link (u))
|
||||
end
|
||||
set_user (Void)
|
||||
controller.start_session (req)
|
||||
end
|
||||
|
||||
feature -- Logging
|
||||
|
||||
log (a_category: READABLE_STRING_8; a_message: READABLE_STRING_8; a_level: INTEGER; a_link: detachable CMS_LINK)
|
||||
local
|
||||
l_log: CMS_LOG
|
||||
do
|
||||
create l_log.make (a_category, a_message, a_level, Void)
|
||||
if a_link /= Void then
|
||||
l_log.set_link (a_link)
|
||||
end
|
||||
l_log.set_info (request.http_user_agent)
|
||||
service.storage.save_log (l_log)
|
||||
end
|
||||
|
||||
feature -- Menu
|
||||
|
||||
menu_system: CMS_MENU_SYSTEM
|
||||
|
||||
main_menu: CMS_MENU
|
||||
do
|
||||
Result := menu_system.main_menu
|
||||
end
|
||||
|
||||
management_menu: CMS_MENU
|
||||
do
|
||||
Result := menu_system.management_menu
|
||||
end
|
||||
|
||||
navigation_menu: CMS_MENU
|
||||
do
|
||||
Result := menu_system.navigation_menu
|
||||
end
|
||||
|
||||
user_menu: CMS_MENU
|
||||
do
|
||||
Result := menu_system.user_menu
|
||||
end
|
||||
|
||||
primary_tabs: CMS_MENU
|
||||
do
|
||||
Result := menu_system.primary_tabs
|
||||
end
|
||||
|
||||
feature -- Menu: change
|
||||
|
||||
add_to_main_menu (lnk: CMS_LINK)
|
||||
do
|
||||
if attached {CMS_LOCAL_LINK} lnk as l_local then
|
||||
l_local.get_is_active (request)
|
||||
end
|
||||
main_menu.extend (lnk)
|
||||
end
|
||||
|
||||
add_to_menu (lnk: CMS_LINK; m: CMS_MENU)
|
||||
do
|
||||
if attached {CMS_LOCAL_LINK} lnk as l_local then
|
||||
l_local.get_is_active (request)
|
||||
end
|
||||
m.extend (lnk)
|
||||
end
|
||||
|
||||
feature -- Message
|
||||
|
||||
add_message (a_msg: READABLE_STRING_8; a_category: detachable READABLE_STRING_8)
|
||||
local
|
||||
m: like message
|
||||
do
|
||||
m := message
|
||||
if m = Void then
|
||||
create m.make (a_msg.count + 9)
|
||||
message := m
|
||||
end
|
||||
if a_category /= Void then
|
||||
m.append ("<li class=%""+ a_category +"%">")
|
||||
else
|
||||
m.append ("<li>")
|
||||
end
|
||||
m.append (a_msg + "</li>")
|
||||
end
|
||||
|
||||
add_notice_message (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
add_message (a_msg, "notice")
|
||||
end
|
||||
|
||||
add_warning_message (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
add_message (a_msg, "warning")
|
||||
end
|
||||
|
||||
add_error_message (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
add_message (a_msg, "error")
|
||||
end
|
||||
|
||||
add_success_message (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
add_message (a_msg, "success")
|
||||
end
|
||||
|
||||
report_form_errors (fd: WSF_FORM_DATA)
|
||||
require
|
||||
has_error: not fd.is_valid
|
||||
do
|
||||
if attached fd.errors as errs then
|
||||
across
|
||||
errs as err
|
||||
loop
|
||||
if attached err.item as e then
|
||||
if attached e.field as l_field then
|
||||
if attached e.message as e_msg then
|
||||
add_error_message (e_msg) --"Field [" + l_field.name + "] is invalid. " + e_msg)
|
||||
else
|
||||
add_error_message ("Field [" + l_field.name + "] is invalid.")
|
||||
end
|
||||
elseif attached e.message as e_msg then
|
||||
add_error_message (e_msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
message: detachable STRING_8
|
||||
|
||||
feature -- Blocks
|
||||
|
||||
formats: CMS_FORMATS
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
blocks: ARRAYED_LIST [TUPLE [block: CMS_BLOCK; name: READABLE_STRING_8; region: READABLE_STRING_8]]
|
||||
|
||||
add_block (b: CMS_BLOCK; a_region: detachable READABLE_STRING_8)
|
||||
do
|
||||
if a_region /= Void then
|
||||
blocks.extend ([b, b.name, a_region])
|
||||
elseif attached block_region (b) as l_region then
|
||||
blocks.extend ([b, b.name, l_region])
|
||||
end
|
||||
end
|
||||
|
||||
block_region (b: CMS_BLOCK): detachable READABLE_STRING_8
|
||||
local
|
||||
l_name: READABLE_STRING_8
|
||||
do
|
||||
l_name := b.name
|
||||
if l_name.starts_with ("footer") then
|
||||
Result := "footer"
|
||||
elseif l_name.starts_with ("management") then
|
||||
Result := "first_sidebar"
|
||||
elseif l_name.starts_with ("navigation") then
|
||||
Result := "first_sidebar"
|
||||
elseif l_name.starts_with ("user") then
|
||||
Result := "first_sidebar"
|
||||
else
|
||||
Result := "first_sidebar"
|
||||
end
|
||||
-- FIXME: let the user choose ...
|
||||
end
|
||||
|
||||
get_blocks
|
||||
local
|
||||
b: CMS_CONTENT_BLOCK
|
||||
s: STRING_8
|
||||
m: CMS_MENU
|
||||
do
|
||||
m := management_menu
|
||||
if not m.is_empty then
|
||||
add_block (create {CMS_MENU_BLOCK}.make (m), Void)
|
||||
end
|
||||
|
||||
m := navigation_menu
|
||||
if not m.is_empty then
|
||||
add_block (create {CMS_MENU_BLOCK}.make (m), Void)
|
||||
end
|
||||
|
||||
m := user_menu
|
||||
if not m.is_empty then
|
||||
add_block (create {CMS_MENU_BLOCK}.make (m), Void)
|
||||
end
|
||||
|
||||
-- create s.make_empty
|
||||
-- s.append ("This site demonstrates a first implementation of CMS using EWF.%N")
|
||||
-- create b.make ("about", "About", s, formats.plain_text)
|
||||
-- add_block (b, "second_sidebar")
|
||||
|
||||
create s.make_empty
|
||||
s.append ("Made with <a href=%"http://www.eiffel.com/%">EWF</a>")
|
||||
create b.make ("made_with", Void, s, formats.full_html)
|
||||
add_block (b, "footer")
|
||||
|
||||
service.hook_block_view (Current)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
status_code: INTEGER
|
||||
|
||||
header: WSF_HEADER
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
-- HTML>head>title value
|
||||
|
||||
page_title: detachable READABLE_STRING_32
|
||||
-- Page title
|
||||
|
||||
additional_page_head_lines: detachable LIST [READABLE_STRING_8]
|
||||
-- HTML>head>...extra lines
|
||||
|
||||
main_content: detachable STRING_8
|
||||
|
||||
redirection: detachable READABLE_STRING_8
|
||||
|
||||
feature -- Generation
|
||||
|
||||
prepare_menu_system (a_menu_system: CMS_MENU_SYSTEM)
|
||||
do
|
||||
across
|
||||
a_menu_system as c
|
||||
loop
|
||||
prepare_links (c.item)
|
||||
end
|
||||
end
|
||||
|
||||
prepare_links (a_menu: CMS_LINK_COMPOSITE)
|
||||
local
|
||||
to_remove: ARRAYED_LIST [CMS_LINK]
|
||||
do
|
||||
create to_remove.make (0)
|
||||
across
|
||||
a_menu as c
|
||||
loop
|
||||
if attached {CMS_LOCAL_LINK} c.item as lm then
|
||||
if attached lm.permission_arguments as perms and then not has_permissions (perms) then
|
||||
to_remove.force (lm)
|
||||
else
|
||||
-- if lm.permission_arguments is Void , this is permitted
|
||||
lm.get_is_active (request)
|
||||
if attached {CMS_LINK_COMPOSITE} lm as comp then
|
||||
prepare_links (comp)
|
||||
end
|
||||
end
|
||||
elseif attached {CMS_LINK_COMPOSITE} c.item as comp then
|
||||
prepare_links (comp)
|
||||
end
|
||||
end
|
||||
across
|
||||
to_remove as c
|
||||
loop
|
||||
a_menu.remove (c.item)
|
||||
end
|
||||
end
|
||||
|
||||
prepare (page: CMS_HTML_PAGE)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
if attached additional_page_head_lines as l_head_lines then
|
||||
across
|
||||
l_head_lines as hl
|
||||
loop
|
||||
page.head_lines.force (hl.item)
|
||||
end
|
||||
end
|
||||
|
||||
add_to_main_menu (create {CMS_LOCAL_LINK}.make ("Home", "/"))
|
||||
|
||||
service.call_menu_alter_hooks (menu_system, Current)
|
||||
prepare_menu_system (menu_system)
|
||||
|
||||
get_blocks
|
||||
|
||||
if attached title as l_title then
|
||||
page.set_title (l_title)
|
||||
else
|
||||
page.set_title ("CMS::" + request.path_info)
|
||||
end
|
||||
|
||||
page.add_to_header_region (top_header_region)
|
||||
page.add_to_header_region (header_region)
|
||||
if attached message as m and then not m.is_empty then
|
||||
page.add_to_content_region ("<div id=%"message%">" + m + "</div>")
|
||||
end
|
||||
page.add_to_content_region ("<a id=%"main-content%"></a>%N")
|
||||
if attached page_title as l_page_title then
|
||||
page.add_to_content_region ("<h1 id=%"page-title%" class=%"title%">"+ l_page_title +"</h1>%N")
|
||||
end
|
||||
if attached primary_tabs as tabs_menu and then not tabs_menu.is_empty then
|
||||
page.add_to_content_region (theme.menu_html (tabs_menu, True))
|
||||
end
|
||||
page.add_to_content_region (content_region)
|
||||
|
||||
-- blocks
|
||||
across
|
||||
blocks as c
|
||||
loop
|
||||
if attached c.item as b_info then
|
||||
create s.make_from_string ("<div class=%"block%" id=%"" + b_info.name + "%">")
|
||||
if attached b_info.block.title as l_title then
|
||||
s.append ("<div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
end
|
||||
s.append ("<div class=%"inside%">")
|
||||
s.append (b_info.block.to_html (theme))
|
||||
s.append ("</div>")
|
||||
s.append ("</div>")
|
||||
page.add_to_region (s, b_info.region)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
logo_location: STRING
|
||||
do
|
||||
Result := url ("/theme/logo.png", Void)
|
||||
end
|
||||
|
||||
top_header_region: STRING_8
|
||||
do
|
||||
Result := "<a href=%""+ url ("/", Void) +"%"><img id=%"logo%" src=%"" + logo_location + "%"/></a><div id=%"title%">" + html_encoded (site_name) + "</div>"
|
||||
Result.append ("<div id=%"menu-bar%">")
|
||||
Result.append (theme.menu_html (main_menu, True))
|
||||
Result.append ("</div>")
|
||||
end
|
||||
|
||||
header_region: STRING_8
|
||||
do
|
||||
Result := ""
|
||||
end
|
||||
|
||||
content_region: STRING_8
|
||||
do
|
||||
if attached main_content as l_content then
|
||||
Result := l_content
|
||||
else
|
||||
Result := ""
|
||||
debug
|
||||
Result := "No Content"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Head customization
|
||||
|
||||
add_additional_head_line (s: READABLE_STRING_8; a_allow_duplication: BOOLEAN)
|
||||
local
|
||||
lst: like additional_page_head_lines
|
||||
do
|
||||
lst := additional_page_head_lines
|
||||
if lst = Void then
|
||||
create {ARRAYED_LIST [like additional_page_head_lines.item]} lst.make (1)
|
||||
additional_page_head_lines := lst
|
||||
end
|
||||
if a_allow_duplication or else across lst as c all not c.item.same_string (s) end then
|
||||
lst.extend (s)
|
||||
end
|
||||
end
|
||||
|
||||
add_style (a_href: STRING; a_media: detachable STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<link rel=%"stylesheet%" href=%""+ a_href + "%" type=%"text/css%""
|
||||
if a_media /= Void then
|
||||
s.append (" media=%""+ a_media + "%"")
|
||||
end
|
||||
s.append ("/>")
|
||||
add_additional_head_line (s, False)
|
||||
end
|
||||
|
||||
add_javascript_url (a_src: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%" src=%"" + a_src + "%"></script>"
|
||||
add_additional_head_line (s, False)
|
||||
end
|
||||
|
||||
add_javascript_content (a_script: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%">%N" + a_script + "%N</script>"
|
||||
add_additional_head_line (s, True)
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_title (t: like title)
|
||||
do
|
||||
title := t
|
||||
set_page_title (t)
|
||||
end
|
||||
|
||||
set_page_title (t: like page_title)
|
||||
do
|
||||
page_title := t
|
||||
end
|
||||
|
||||
set_main_content (s: like main_content)
|
||||
do
|
||||
main_content := s
|
||||
end
|
||||
|
||||
set_redirection (a_url: like redirection)
|
||||
do
|
||||
if a_url /= Void and then a_url.same_string (request.path_info) and request.is_get_request_method then
|
||||
redirection := Void
|
||||
else
|
||||
redirection := a_url
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute
|
||||
do
|
||||
begin
|
||||
process
|
||||
terminate
|
||||
end
|
||||
|
||||
feature {NONE} -- Execution
|
||||
|
||||
begin
|
||||
do
|
||||
end
|
||||
|
||||
process
|
||||
deferred
|
||||
end
|
||||
|
||||
frozen terminate
|
||||
local
|
||||
cms_page: CMS_HTML_PAGE
|
||||
page: CMS_HTML_PAGE_RESPONSE
|
||||
do
|
||||
create cms_page.make
|
||||
prepare (cms_page)
|
||||
|
||||
create page.make (theme.page_html (cms_page))
|
||||
if attached redirection as l_redirection then
|
||||
if attached message as m then
|
||||
set_session_item ("cms.pending_messages", m)
|
||||
end
|
||||
page.set_status_code ({HTTP_STATUS_CODE}.found)
|
||||
page.header.put_location (l_redirection)
|
||||
else
|
||||
page.set_status_code (status_code)
|
||||
end
|
||||
|
||||
controller.session_commit (page, Current)
|
||||
response.send (page)
|
||||
on_terminated
|
||||
end
|
||||
|
||||
on_terminated
|
||||
do
|
||||
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
set_user (u: like user)
|
||||
do
|
||||
set_session_item ("user", u)
|
||||
end
|
||||
|
||||
init_last_user_access_date
|
||||
do
|
||||
set_session_item ("last_access", (create {DATE_TIME}.make_now_utc))
|
||||
end
|
||||
|
||||
feature -- Access: Session
|
||||
|
||||
session_item (k: READABLE_STRING_GENERAL): detachable ANY
|
||||
do
|
||||
Result := controller.session.item (k)
|
||||
end
|
||||
|
||||
set_session_item (k: READABLE_STRING_GENERAL; v: detachable ANY)
|
||||
do
|
||||
controller.session.remember (v, k)
|
||||
end
|
||||
|
||||
remove_session_item (k: READABLE_STRING_GENERAL)
|
||||
do
|
||||
controller.session.forget (k)
|
||||
end
|
||||
|
||||
feature -- Storage
|
||||
|
||||
storage: CMS_STORAGE
|
||||
do
|
||||
Result := service.storage
|
||||
end
|
||||
|
||||
feature -- Helper: output
|
||||
|
||||
user_local_link (u: CMS_USER): CMS_LINK
|
||||
do
|
||||
create {CMS_LOCAL_LINK} Result.make (u.name, user_url (u))
|
||||
end
|
||||
|
||||
node_local_link (n: CMS_NODE): CMS_LINK
|
||||
do
|
||||
create {CMS_LOCAL_LINK} Result.make (n.title, node_url (n))
|
||||
end
|
||||
|
||||
truncated_string (s: READABLE_STRING_8; nb: INTEGER; a_ellipsis: detachable READABLE_STRING_8): STRING_8
|
||||
-- Truncated string `s' to `nb' character
|
||||
require
|
||||
a_ellipsis /= Void implies a_ellipsis.count < nb
|
||||
local
|
||||
f: CMS_NO_HTML_FILTER
|
||||
do
|
||||
if s.count <= nb then
|
||||
Result := s.string
|
||||
else
|
||||
create f
|
||||
create Result.make_from_string (s)
|
||||
f.filter (Result)
|
||||
if Result.count > nb then
|
||||
if a_ellipsis /= Void and then not a_ellipsis.is_empty then
|
||||
Result.keep_head (nb - a_ellipsis.count)
|
||||
Result.append (a_ellipsis)
|
||||
else
|
||||
Result.keep_head (nb - 3)
|
||||
Result.append ("...")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Helper: request
|
||||
|
||||
non_empty_string_path_parameter (a_name: READABLE_STRING_GENERAL): detachable STRING
|
||||
do
|
||||
if
|
||||
attached {WSF_STRING} request.path_parameter (a_name) as p and then
|
||||
not p.is_empty
|
||||
then
|
||||
Result := p.value
|
||||
end
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,77 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HTML_PAGE_RESPONSE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_HTML_PAGE_RESPONSE
|
||||
|
||||
inherit
|
||||
WSF_RESPONSE_MESSAGE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_html: like html)
|
||||
do
|
||||
html := a_html
|
||||
status_code := {HTTP_STATUS_CODE}.ok
|
||||
create header.make
|
||||
header.put_content_type_text_html
|
||||
end
|
||||
|
||||
feature -- Status
|
||||
|
||||
status_code: INTEGER
|
||||
|
||||
feature -- Header
|
||||
|
||||
header: HTTP_HEADER
|
||||
|
||||
feature -- Html access
|
||||
|
||||
html: STRING
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_status_code (c: like status_code)
|
||||
do
|
||||
status_code := c
|
||||
end
|
||||
|
||||
feature {WSF_RESPONSE} -- Output
|
||||
|
||||
send_to (res: WSF_RESPONSE)
|
||||
local
|
||||
h: like header
|
||||
s: STRING_8
|
||||
do
|
||||
h := header
|
||||
res.set_status_code (status_code)
|
||||
s := html
|
||||
|
||||
if not h.has_content_length then
|
||||
h.put_content_length (s.count)
|
||||
end
|
||||
if not h.has_content_type then
|
||||
h.put_content_type_text_html
|
||||
end
|
||||
res.put_header_text (h.string)
|
||||
res.put_string (s)
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
|
||||
@@ -1,452 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
This class implements the CMS service
|
||||
|
||||
It could be used to implement the main EWF service, or
|
||||
even for a specific handler.
|
||||
]"
|
||||
|
||||
class
|
||||
CMS_SERVICE
|
||||
|
||||
inherit
|
||||
WSF_SERVICE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_setup: CMS_SETUP)
|
||||
local
|
||||
cfg: detachable CMS_CONFIGURATION
|
||||
do
|
||||
cfg := a_setup.configuration
|
||||
if cfg = Void then
|
||||
create cfg.make
|
||||
end
|
||||
|
||||
configuration := cfg
|
||||
base_url := a_setup.base_url
|
||||
|
||||
site_id := cfg.site_id
|
||||
site_url := cfg.site_url ("")
|
||||
site_name := cfg.site_name ("EWF::CMS")
|
||||
site_email := cfg.site_email ("webmaster")
|
||||
site_dir := cfg.root_location
|
||||
site_var_dir := cfg.var_location
|
||||
files_location := cfg.files_location
|
||||
themes_location := cfg.themes_location
|
||||
theme_name := cfg.theme_name ("default")
|
||||
|
||||
set_script_url (cfg.site_script_url (Void)) -- Temporary value
|
||||
|
||||
compute_theme_resource_location
|
||||
|
||||
create content_types.make (3)
|
||||
|
||||
modules := a_setup.modules
|
||||
storage := a_setup.storage
|
||||
session_manager := a_setup.session_manager
|
||||
auth_engine := a_setup.auth_engine
|
||||
mailer := a_setup.mailer
|
||||
|
||||
initialize_storage
|
||||
initialize_auth_engine
|
||||
initialize_session_manager
|
||||
initialize_mailer
|
||||
initialize_router
|
||||
initialize_modules
|
||||
end
|
||||
|
||||
initialize_session_manager
|
||||
-- local
|
||||
-- dn: DIRECTORY_NAME
|
||||
do
|
||||
-- create dn.make_from_string (site_var_dir)
|
||||
-- dn.extend ("_storage_")
|
||||
-- dn.extend ("_sessions_")
|
||||
-- create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.string)
|
||||
end
|
||||
|
||||
initialize_storage
|
||||
do
|
||||
if not storage.has_user then
|
||||
initialize_users
|
||||
end
|
||||
end
|
||||
|
||||
initialize_users
|
||||
require
|
||||
has_no_user: not storage.has_user
|
||||
local
|
||||
u: CMS_USER
|
||||
ur: CMS_USER_ROLE
|
||||
do
|
||||
create u.make_new ("admin")
|
||||
u.set_password ("istrator")
|
||||
storage.save_user (u)
|
||||
|
||||
create ur.make_with_id (1, "anonymous")
|
||||
storage.save_user_role (ur)
|
||||
create ur.make_with_id (2, "authenticated")
|
||||
ur.add_permission ("create page")
|
||||
ur.add_permission ("edit page")
|
||||
storage.save_user_role (ur)
|
||||
end
|
||||
|
||||
initialize_mailer
|
||||
local
|
||||
-- ch_mailer: CMS_CHAIN_MAILER
|
||||
-- st_mailer: CMS_STORAGE_MAILER
|
||||
do
|
||||
-- create st_mailer.make (storage)
|
||||
-- create ch_mailer.make (st_mailer)
|
||||
-- ch_mailer.set_next (create {CMS_SENDMAIL_MAILER})
|
||||
-- mailer := ch_mailer
|
||||
end
|
||||
|
||||
initialize_router
|
||||
local
|
||||
-- h: CMS_HANDLER
|
||||
file_hdl: CMS_FILE_SYSTEM_HANDLER
|
||||
dn: DIRECTORY_NAME
|
||||
do
|
||||
create router.make (10)
|
||||
router.set_base_url (base_url)
|
||||
|
||||
router.map (create {WSF_URI_MAPPING}.make ("/", create {CMS_HANDLER}.make (agent handle_home)))
|
||||
router.map (create {WSF_URI_MAPPING}.make ("/favicon.ico", create {CMS_HANDLER}.make (agent handle_favicon)))
|
||||
|
||||
create file_hdl.make (files_location)
|
||||
file_hdl.disable_index
|
||||
file_hdl.set_max_age (8*60*60)
|
||||
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/files/", file_hdl))
|
||||
|
||||
create dn.make_from_string (theme_resource_location)
|
||||
create file_hdl.make (theme_resource_location)
|
||||
file_hdl.set_max_age (8*60*60)
|
||||
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/theme/", file_hdl))
|
||||
end
|
||||
|
||||
initialize_modules
|
||||
do
|
||||
across
|
||||
modules as m
|
||||
loop
|
||||
if m.item.is_enabled then
|
||||
m.item.register (Current)
|
||||
if attached {CMS_HOOK_AUTO_REGISTER} m.item as h_auto then
|
||||
h_auto.hook_auto_register (Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
initialize_auth_engine
|
||||
do
|
||||
-- create {CMS_STORAGE_AUTH_ENGINE} auth_engine.make (storage)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
configuration: CMS_CONFIGURATION
|
||||
|
||||
auth_engine: CMS_AUTH_ENGINE
|
||||
|
||||
modules: LIST [CMS_MODULE]
|
||||
|
||||
feature -- Hook: menu_alter
|
||||
|
||||
add_menu_alter_hook (h: like menu_alter_hooks.item)
|
||||
local
|
||||
lst: like menu_alter_hooks
|
||||
do
|
||||
lst := menu_alter_hooks
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
menu_alter_hooks := lst
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
menu_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_MENU_ALTER]
|
||||
|
||||
call_menu_alter_hooks (m: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
|
||||
do
|
||||
if attached menu_alter_hooks as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
c.item.menu_alter (m, a_execution)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: form_alter
|
||||
|
||||
add_form_alter_hook (h: like form_alter_hooks.item)
|
||||
local
|
||||
lst: like form_alter_hooks
|
||||
do
|
||||
lst := form_alter_hooks
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
form_alter_hooks := lst
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
form_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_FORM_ALTER]
|
||||
|
||||
call_form_alter_hooks (f: CMS_FORM; a_form_data: detachable WSF_FORM_DATA; a_execution: CMS_EXECUTION)
|
||||
do
|
||||
if attached form_alter_hooks as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
c.item.form_alter (f, a_form_data, a_execution)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: block
|
||||
|
||||
add_block_hook (h: like block_hooks.item)
|
||||
local
|
||||
lst: like block_hooks
|
||||
do
|
||||
lst := block_hooks
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
block_hooks := lst
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
block_hooks: detachable ARRAYED_LIST [CMS_HOOK_BLOCK]
|
||||
|
||||
hook_block_view (a_execution: CMS_EXECUTION)
|
||||
do
|
||||
if attached block_hooks as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
across
|
||||
c.item.block_list as blst
|
||||
loop
|
||||
c.item.get_block_view (blst.item, a_execution)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Router
|
||||
|
||||
site_id: READABLE_STRING_8
|
||||
|
||||
site_name: READABLE_STRING_32
|
||||
|
||||
site_email: READABLE_STRING_8
|
||||
|
||||
site_url: READABLE_STRING_8
|
||||
|
||||
site_dir: READABLE_STRING_8
|
||||
|
||||
site_var_dir: READABLE_STRING_8
|
||||
|
||||
files_location: READABLE_STRING_8
|
||||
|
||||
themes_location: READABLE_STRING_8
|
||||
|
||||
compute_theme_resource_location
|
||||
local
|
||||
dn: DIRECTORY_NAME
|
||||
do
|
||||
create dn.make_from_string (themes_location)
|
||||
dn.extend (theme_name)
|
||||
dn.extend ("res")
|
||||
theme_resource_location := dn.string
|
||||
end
|
||||
|
||||
theme_resource_location: READABLE_STRING_8
|
||||
|
||||
theme_name: READABLE_STRING_32
|
||||
|
||||
router: WSF_ROUTER
|
||||
|
||||
map_uri_template (tpl: STRING; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
|
||||
do
|
||||
router.map (create {WSF_URI_TEMPLATE_MAPPING}.make_from_template (tpl, create {CMS_HANDLER}.make (proc)))
|
||||
end
|
||||
|
||||
map_uri (a_uri: STRING; proc: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]])
|
||||
do
|
||||
router.map (create {WSF_URI_MAPPING}.make (a_uri, create {CMS_HANDLER}.make (proc)))
|
||||
end
|
||||
|
||||
feature -- URL related
|
||||
|
||||
front_path: STRING
|
||||
do
|
||||
if attached base_url as l_base_url then
|
||||
Result := l_base_url + "/"
|
||||
else
|
||||
Result := "/"
|
||||
end
|
||||
end
|
||||
|
||||
urls_set: BOOLEAN
|
||||
|
||||
initialize_urls (req: WSF_REQUEST)
|
||||
local
|
||||
u: like base_url
|
||||
do
|
||||
if not urls_set then
|
||||
u := base_url
|
||||
if u = Void then
|
||||
u := ""
|
||||
end
|
||||
urls_set := True
|
||||
if site_url.is_empty then
|
||||
site_url := req.absolute_script_url (u)
|
||||
end
|
||||
set_script_url (req.script_url (u))
|
||||
end
|
||||
end
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
-- Base url (related to the script path).
|
||||
|
||||
script_url: detachable READABLE_STRING_8
|
||||
|
||||
set_script_url (a_url: like script_url)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
if a_url = Void then
|
||||
script_url := Void
|
||||
elseif not a_url.is_empty then
|
||||
if a_url.ends_with ("/") then
|
||||
create s.make_from_string (a_url)
|
||||
else
|
||||
create s.make (a_url.count + 1)
|
||||
s.append (a_url)
|
||||
s.append_character ('/')
|
||||
end
|
||||
script_url := s
|
||||
end
|
||||
ensure
|
||||
attached script_url as l_url implies l_url.ends_with ("/")
|
||||
end
|
||||
|
||||
feature -- Report
|
||||
|
||||
is_front_page (req: WSF_REQUEST): BOOLEAN
|
||||
do
|
||||
Result := req.path_info.same_string (front_path)
|
||||
end
|
||||
|
||||
feature {CMS_EXECUTION, CMS_MODULE} -- Security report
|
||||
|
||||
user_has_permission (u: detachable CMS_USER; s: detachable READABLE_STRING_8): BOOLEAN
|
||||
-- Anonymous or user `u' has permission for `s' ?
|
||||
--| `s' could be "create page",
|
||||
do
|
||||
Result := storage.user_has_permission (u, s)
|
||||
end
|
||||
|
||||
feature -- Storage
|
||||
|
||||
session_controller (req: WSF_REQUEST): CMS_SESSION_CONTROLER
|
||||
-- New session controller for request `req'
|
||||
do
|
||||
create Result.make (req, session_manager, site_id)
|
||||
end
|
||||
|
||||
session_manager: WSF_SESSION_MANAGER
|
||||
-- CMS Session manager
|
||||
|
||||
storage: CMS_STORAGE
|
||||
|
||||
feature -- Logging
|
||||
|
||||
log (a_category: READABLE_STRING_8; a_message: READABLE_STRING_8; a_level: INTEGER; a_link: detachable CMS_LINK)
|
||||
local
|
||||
l_log: CMS_LOG
|
||||
do
|
||||
create l_log.make (a_category, a_message, a_level, Void)
|
||||
if a_link /= Void then
|
||||
l_log.set_link (a_link)
|
||||
end
|
||||
storage.save_log (l_log)
|
||||
end
|
||||
|
||||
feature -- Content type
|
||||
|
||||
content_types: ARRAYED_LIST [CMS_CONTENT_TYPE]
|
||||
-- Available content types
|
||||
|
||||
add_content_type (a_type: CMS_CONTENT_TYPE)
|
||||
do
|
||||
content_types.force (a_type)
|
||||
end
|
||||
|
||||
content_type (a_name: READABLE_STRING_8): detachable CMS_CONTENT_TYPE
|
||||
do
|
||||
across
|
||||
content_types as t
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
if t.item.name.same_string (a_name) then
|
||||
Result := t.item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Notification
|
||||
|
||||
mailer: CMS_MAILER
|
||||
|
||||
feature -- Core Execution
|
||||
|
||||
handle_favicon (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
fres: WSF_FILE_RESPONSE
|
||||
fn: FILE_NAME
|
||||
do
|
||||
create fn.make_from_string (theme_resource_location)
|
||||
fn.set_file_name ("favicon.ico")
|
||||
create fres.make (fn.string)
|
||||
fres.set_expires_in_seconds (7 * 24 * 60 * 60) -- 7 jours
|
||||
res.send (fres)
|
||||
end
|
||||
|
||||
handle_home (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
(create {HOME_CMS_EXECUTION}.make (req, res, Current)).execute
|
||||
end
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Default request handler if no other are relevant
|
||||
local
|
||||
e: CMS_EXECUTION
|
||||
sess: WSF_ROUTER_SESSION
|
||||
do
|
||||
initialize_urls (req)
|
||||
create sess
|
||||
router.dispatch (req, res, sess)
|
||||
if not sess.dispatched then
|
||||
create {NOT_FOUND_CMS_EXECUTION} e.make (req, res, Current)
|
||||
e.execute
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,55 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_SETUP}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_SETUP
|
||||
|
||||
feature -- Access
|
||||
|
||||
configuration: detachable CMS_CONFIGURATION
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
|
||||
modules: LIST [CMS_MODULE]
|
||||
deferred
|
||||
end
|
||||
|
||||
storage: CMS_STORAGE
|
||||
-- CMS persistent layer
|
||||
deferred
|
||||
end
|
||||
|
||||
session_manager: WSF_SESSION_MANAGER
|
||||
-- CMS Session manager
|
||||
deferred
|
||||
end
|
||||
|
||||
auth_engine: CMS_AUTH_ENGINE
|
||||
-- CMS Authentication engine
|
||||
deferred
|
||||
end
|
||||
|
||||
mailer: CMS_MAILER
|
||||
-- CMS email engine
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_base_url (a_base_url: like base_url)
|
||||
do
|
||||
if a_base_url /= Void and then not a_base_url.is_empty then
|
||||
base_url := a_base_url
|
||||
else
|
||||
base_url := Void
|
||||
end
|
||||
end
|
||||
|
||||
add_module (m: CMS_MODULE)
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,81 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HTML_TEMPLATE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
DEFAULT_CMS_HTML_TEMPLATE
|
||||
|
||||
inherit
|
||||
CMS_HTML_TEMPLATE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (t: DEFAULT_CMS_THEME)
|
||||
do
|
||||
theme := t
|
||||
create variables.make (0)
|
||||
end
|
||||
|
||||
variables: HASH_TABLE [detachable ANY, STRING]
|
||||
|
||||
feature -- Access
|
||||
|
||||
register (v: STRING_8; k: STRING_8)
|
||||
do
|
||||
variables.force (v, k)
|
||||
end
|
||||
|
||||
theme: DEFAULT_CMS_THEME
|
||||
|
||||
prepare (page: CMS_HTML_PAGE)
|
||||
do
|
||||
variables.make (10)
|
||||
if attached page.title as l_title then
|
||||
variables.force (l_title, "title")
|
||||
variables.force (l_title, "head_title")
|
||||
else
|
||||
variables.force ("", "title")
|
||||
variables.force ("", "head_title")
|
||||
end
|
||||
|
||||
variables.force (page.language, "language")
|
||||
variables.force (page.head_lines_to_string, "head_lines")
|
||||
end
|
||||
|
||||
to_html (page: CMS_HTML_PAGE): STRING
|
||||
do
|
||||
-- Process html generation
|
||||
create Result.make_from_string (template)
|
||||
apply_template_engine (Result)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
template: STRING
|
||||
once
|
||||
Result := "[
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$language" lang="$language" version="XHTML+RDFa 1.0" dir="ltr">
|
||||
<head>
|
||||
$head
|
||||
<title>$head_title</title>
|
||||
$styles
|
||||
$scripts
|
||||
$head_lines
|
||||
</head>
|
||||
<body class="$body_classes" $body_attributes>
|
||||
$page_top
|
||||
$page
|
||||
$page_bottom
|
||||
</body>
|
||||
</html>
|
||||
]"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,84 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_PAGE_TEMPLATE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
DEFAULT_CMS_PAGE_TEMPLATE
|
||||
|
||||
inherit
|
||||
CMS_PAGE_TEMPLATE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (t: DEFAULT_CMS_THEME)
|
||||
do
|
||||
theme := t
|
||||
create variables.make (0)
|
||||
end
|
||||
|
||||
variables: HASH_TABLE [detachable ANY, STRING]
|
||||
|
||||
feature -- Access
|
||||
|
||||
theme: DEFAULT_CMS_THEME
|
||||
|
||||
prepare (page: CMS_HTML_PAGE)
|
||||
do
|
||||
variables.make (10)
|
||||
|
||||
if attached page.title as l_title then
|
||||
variables.force (l_title, "title")
|
||||
else
|
||||
variables.force ("", "title")
|
||||
end
|
||||
across
|
||||
theme.regions as r
|
||||
loop
|
||||
variables.force (page.region (r.item), r.item)
|
||||
end
|
||||
end
|
||||
|
||||
to_html (page: CMS_HTML_PAGE): STRING
|
||||
do
|
||||
-- Process html generation
|
||||
create Result.make_from_string (template)
|
||||
apply_template_engine (Result)
|
||||
end
|
||||
|
||||
feature -- Registration
|
||||
|
||||
register (v: STRING_8; k: STRING_8)
|
||||
do
|
||||
variables.force (v, k)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
template: STRING
|
||||
once
|
||||
Result := "[
|
||||
<div id="page-wrapper">
|
||||
<div id="page">
|
||||
<div id="header">
|
||||
$header
|
||||
</div>
|
||||
<div id="main-wrapper">
|
||||
<div id="main">
|
||||
<div id="first_sidebar" class="sidebar $first_sidebar_css_class">$first_sidebar</div>
|
||||
<div id="content" class="$content_css_class">$content</div>
|
||||
<div id="second_sidebar" class="sidebar $second_sidebar_css_class">$second_sidebar</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">$footer</div>
|
||||
</div>
|
||||
</div>
|
||||
]"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,85 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_THEME}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
DEFAULT_CMS_THEME
|
||||
|
||||
inherit
|
||||
CMS_THEME
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_service: like service)
|
||||
do
|
||||
service := a_service
|
||||
end
|
||||
|
||||
service: CMS_SERVICE
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING = "CMS"
|
||||
|
||||
regions: ARRAY [STRING]
|
||||
once
|
||||
Result := <<"header", "content", "footer", "first_sidebar", "second_sidebar">>
|
||||
end
|
||||
|
||||
html_template: DEFAULT_CMS_HTML_TEMPLATE
|
||||
local
|
||||
tpl: like internal_html_template
|
||||
do
|
||||
tpl := internal_html_template
|
||||
if tpl = Void then
|
||||
create tpl.make (Current)
|
||||
internal_html_template := tpl
|
||||
end
|
||||
Result := tpl
|
||||
end
|
||||
|
||||
page_template: DEFAULT_CMS_PAGE_TEMPLATE
|
||||
local
|
||||
tpl: like internal_page_template
|
||||
do
|
||||
tpl := internal_page_template
|
||||
if tpl = Void then
|
||||
create tpl.make (Current)
|
||||
internal_page_template := tpl
|
||||
end
|
||||
Result := tpl
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
prepare (page: CMS_HTML_PAGE)
|
||||
do
|
||||
page.add_style (url ("/theme/style.css", Void), Void)
|
||||
end
|
||||
|
||||
page_html (page: CMS_HTML_PAGE): STRING_8
|
||||
local
|
||||
l_content: STRING_8
|
||||
do
|
||||
prepare (page)
|
||||
page_template.prepare (page)
|
||||
l_content := page_template.to_html (page)
|
||||
html_template.prepare (page)
|
||||
html_template.register (l_content, "page")
|
||||
Result := html_template.to_html (page)
|
||||
end
|
||||
|
||||
feature {NONE} -- Internal
|
||||
|
||||
internal_page_template: detachable like page_template
|
||||
|
||||
internal_html_template: detachable like html_template
|
||||
|
||||
invariant
|
||||
attached internal_page_template as inv_p implies inv_p.theme = Current
|
||||
end
|
||||
@@ -1,43 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORM}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FORM
|
||||
|
||||
inherit
|
||||
WSF_FORM
|
||||
rename
|
||||
process as process_form
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Basic operation
|
||||
|
||||
prepare (a_execution: CMS_EXECUTION)
|
||||
do
|
||||
a_execution.service.call_form_alter_hooks (Current, Void, a_execution)
|
||||
end
|
||||
|
||||
process (a_execution: CMS_EXECUTION)
|
||||
do
|
||||
process_form (a_execution.request, agent on_prepared (a_execution, ?), agent on_processed (a_execution, ?))
|
||||
end
|
||||
|
||||
on_prepared (a_execution: CMS_EXECUTION; fd: WSF_FORM_DATA)
|
||||
do
|
||||
a_execution.service.call_form_alter_hooks (Current, fd, a_execution)
|
||||
end
|
||||
|
||||
on_processed (a_execution: CMS_EXECUTION; fd: WSF_FORM_DATA)
|
||||
do
|
||||
if not fd.is_valid or fd.has_error then
|
||||
a_execution.report_form_errors (fd)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,61 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
This class implements the web service
|
||||
|
||||
It inherits from WSF_DEFAULT_SERVICE to get default EWF connector ready
|
||||
And from WSF_URI_TEMPLATE_ROUTED_SERVICE to use the router service
|
||||
|
||||
`initialize' can be redefine to provide custom options if needed.
|
||||
]"
|
||||
|
||||
class
|
||||
ANY_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_text
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_with_text (req: WSF_REQUEST; res: WSF_RESPONSE; h: like service; t: like text)
|
||||
do
|
||||
make (req, res, h)
|
||||
text := t
|
||||
end
|
||||
|
||||
text: detachable STRING
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
-- Computed response message.
|
||||
local
|
||||
b: STRING_8
|
||||
s: STRING
|
||||
do
|
||||
if attached main_content as m then
|
||||
-- ok
|
||||
elseif attached text as t then
|
||||
create b.make_empty
|
||||
s := request.path_info
|
||||
if attached service.script_url as l_script_url then
|
||||
if s.starts_with (l_script_url) then
|
||||
s.remove_head (l_script_url.count)
|
||||
if s.starts_with ("/") then
|
||||
s.remove_head (1)
|
||||
end
|
||||
end
|
||||
end
|
||||
set_title (s)
|
||||
b.append (t)
|
||||
set_main_content (b)
|
||||
else
|
||||
set_title ("...")
|
||||
set_main_content ("")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,16 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FILE_SYSTEM_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_FILE_SYSTEM_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_FILE_SYSTEM_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
end
|
||||
@@ -1,64 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_URI_HANDLER
|
||||
rename
|
||||
execute as execute_uri
|
||||
undefine
|
||||
new_mapping
|
||||
end
|
||||
|
||||
WSF_URI_TEMPLATE_HANDLER
|
||||
rename
|
||||
execute as execute_uri_template
|
||||
end
|
||||
|
||||
WSF_STARTS_WITH_HANDLER
|
||||
rename
|
||||
execute as execute_starts_with
|
||||
undefine
|
||||
new_mapping
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (e: like action)
|
||||
do
|
||||
action := e
|
||||
end
|
||||
|
||||
action: PROCEDURE [ANY, TUPLE [req: WSF_REQUEST; res: WSF_RESPONSE]]
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
action.call ([req, res])
|
||||
end
|
||||
|
||||
execute_uri (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
execute (req, res)
|
||||
end
|
||||
|
||||
execute_uri_template (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
execute_uri (req, res)
|
||||
end
|
||||
|
||||
execute_starts_with (a_start_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
do
|
||||
execute_uri (req, res)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,52 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
]"
|
||||
|
||||
class
|
||||
HOME_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
-- Computed response message.
|
||||
local
|
||||
-- l_url: READABLE_STRING_8
|
||||
b: STRING_8
|
||||
do
|
||||
set_title ("Home")
|
||||
set_page_title (Void)
|
||||
create b.make_empty
|
||||
if attached service.storage.recent_nodes (1, 10) as l_nodes then
|
||||
across
|
||||
l_nodes as c
|
||||
loop
|
||||
b.append ("<div class=%"node-wrapper%">")
|
||||
b.append (c.item.to_html (theme))
|
||||
b.append ("</div>%N")
|
||||
end
|
||||
end
|
||||
|
||||
-- b.append ("<ul>%N")
|
||||
-- l_url := url ("/", Void)
|
||||
-- b.append ("<li><a href=%"" + l_url + "%">Home</a></li>%N")
|
||||
-- l_url := url ("/info/", Void)
|
||||
-- b.append ("<li><a href=%"" + l_url + "%">EWF Info</a></li>%N")
|
||||
|
||||
-- b.append ("</ul>%N")
|
||||
|
||||
debug ("cms")
|
||||
if attached controller.session as sess then
|
||||
b.append ("<div>Session#" + sess.uuid + "</div>%N")
|
||||
end
|
||||
end
|
||||
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,34 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
This class implements the web service
|
||||
|
||||
It inherits from WSF_DEFAULT_SERVICE to get default EWF connector ready
|
||||
And from WSF_URI_TEMPLATE_ROUTED_SERVICE to use the router service
|
||||
|
||||
`initialize' can be redefine to provide custom options if needed.
|
||||
]"
|
||||
|
||||
class
|
||||
NOT_FOUND_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
-- Computed response message.
|
||||
local
|
||||
b: STRING_8
|
||||
do
|
||||
status_code := {HTTP_STATUS_CODE}.not_found
|
||||
create b.make_empty
|
||||
set_title ("Page Not Found")
|
||||
b.append ("<em>The requested page could not be found.</em>%N")
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,47 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
]"
|
||||
|
||||
class
|
||||
THEME_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
-- Computed response message.
|
||||
local
|
||||
-- l_url: READABLE_STRING_8
|
||||
b: STRING_8
|
||||
do
|
||||
set_title ("Home")
|
||||
create b.make_empty
|
||||
|
||||
b.append ("<h1>Home</h1>%N")
|
||||
if attached service.storage.recent_nodes (1, 10) as l_nodes then
|
||||
across
|
||||
l_nodes as c
|
||||
loop
|
||||
b.append ("<div class=%"node-wrapper%">")
|
||||
b.append (c.item.to_html (theme))
|
||||
b.append ("</div>%N")
|
||||
end
|
||||
end
|
||||
|
||||
-- b.append ("<ul>%N")
|
||||
-- l_url := url ("/", Void)
|
||||
-- b.append ("<li><a href=%"" + l_url + "%">Home</a></li>%N")
|
||||
-- l_url := url ("/info/", Void)
|
||||
-- b.append ("<li><a href=%"" + l_url + "%">EWF Info</a></li>%N")
|
||||
|
||||
-- b.append ("</ul>%N")
|
||||
|
||||
set_main_content (b)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,10 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HOOK}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_HOOK
|
||||
|
||||
end
|
||||
@@ -1,33 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Summary description for {CMS_HOOK_AUTO_REGISTER}.
|
||||
When inheriting from this class, the declared hooks are automatically
|
||||
registered, otherwise, each descendant has to add it to the cms service
|
||||
itself.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
inherit
|
||||
CMS_HOOK
|
||||
|
||||
feature -- Hook
|
||||
|
||||
hook_auto_register (a_service: CMS_SERVICE)
|
||||
do
|
||||
if attached {CMS_HOOK_MENU_ALTER} Current as h_menu_alter then
|
||||
a_service.add_menu_alter_hook (h_menu_alter)
|
||||
end
|
||||
if attached {CMS_HOOK_BLOCK} Current as h_block then
|
||||
a_service.add_block_hook (h_block)
|
||||
end
|
||||
if attached {CMS_HOOK_FORM_ALTER} Current as h_block then
|
||||
a_service.add_form_alter_hook (h_block)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,23 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HOOK_BLOCK}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_HOOK_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_HOOK
|
||||
|
||||
feature -- Hook
|
||||
|
||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
deferred
|
||||
end
|
||||
|
||||
get_block_view (a_block_id: detachable READABLE_STRING_8; a_execution: CMS_EXECUTION)
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,19 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HOOK_FORM_ALTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_HOOK_FORM_ALTER
|
||||
|
||||
inherit
|
||||
CMS_HOOK
|
||||
|
||||
feature -- Hook
|
||||
|
||||
form_alter (a_form: CMS_FORM; a_form_data: detachable WSF_FORM_DATA; a_execution: CMS_EXECUTION)
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,19 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HOOK_MENU_ALTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_HOOK_MENU_ALTER
|
||||
|
||||
inherit
|
||||
CMS_HOOK
|
||||
|
||||
feature -- Hook
|
||||
|
||||
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,26 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_API_OPTIONS}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_API_OPTIONS
|
||||
|
||||
inherit
|
||||
WSF_API_OPTIONS
|
||||
|
||||
create
|
||||
make,
|
||||
make_from_manifest
|
||||
|
||||
convert
|
||||
make_from_manifest ({ ARRAY [TUPLE [key: STRING; value: detachable ANY]],
|
||||
ARRAY [TUPLE [STRING_8, ARRAY [TUPLE [STRING_8, STRING_32]]]],
|
||||
ARRAY [TUPLE [STRING_8, ARRAY [TUPLE [STRING_8, STRING_8]]]]
|
||||
})
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
|
||||
end
|
||||
@@ -1,102 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_CMS_COMMON_API}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_COMMON_API
|
||||
|
||||
inherit
|
||||
WSF_API_UTILITIES
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
service: CMS_SERVICE
|
||||
deferred
|
||||
end
|
||||
|
||||
site_url: READABLE_STRING_8
|
||||
do
|
||||
Result := service.site_url
|
||||
end
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
-- Base url if any.
|
||||
do
|
||||
Result := service.script_url
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
user_link (u: CMS_USER): like link
|
||||
do
|
||||
Result := link (u.name, "/user/" + u.id.out, Void)
|
||||
end
|
||||
|
||||
node_link (n: CMS_NODE): like link
|
||||
do
|
||||
Result := link (n.title, "/node/" + n.id.out, Void)
|
||||
end
|
||||
|
||||
user_url (u: CMS_USER): like url
|
||||
do
|
||||
Result := url ("/user/" + u.id.out, Void)
|
||||
end
|
||||
|
||||
node_url (n: CMS_NODE): like url
|
||||
do
|
||||
Result := url ("/node/" + n.id.out, Void)
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
is_empty (s: detachable READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- Is `s' is Void or empty ?
|
||||
do
|
||||
Result := s = Void or else s.is_empty
|
||||
end
|
||||
|
||||
unix_timestamp (dt: DATE_TIME): INTEGER_64
|
||||
do
|
||||
Result := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp (dt)
|
||||
end
|
||||
|
||||
unix_timestamp_to_date_time (t: INTEGER_64): DATE_TIME
|
||||
do
|
||||
Result := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp_to_date_time (t)
|
||||
end
|
||||
|
||||
string_unix_timestamp_to_date_time (s: READABLE_STRING_8): DATE_TIME
|
||||
do
|
||||
if s.is_integer_64 then
|
||||
Result := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp_to_date_time (s.to_integer_64)
|
||||
else
|
||||
Result := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp_to_date_time (0)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
options_boolean (opts: HASH_TABLE [detachable ANY, STRING]; k: STRING; dft: BOOLEAN): BOOLEAN
|
||||
do
|
||||
if attached {BOOLEAN} opts.item (k) as h then
|
||||
Result := h
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
end
|
||||
|
||||
options_string (opts: HASH_TABLE [detachable ANY, STRING]; k: STRING): detachable STRING
|
||||
do
|
||||
if attached {STRING} opts.item (k) as s then
|
||||
Result := s
|
||||
end
|
||||
end
|
||||
|
||||
-- html_encoder: HTML_ENCODER
|
||||
-- once ("thread")
|
||||
-- create Result
|
||||
-- end
|
||||
|
||||
end
|
||||
@@ -1,25 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_URL_API_OPTIONS}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_URL_API_OPTIONS
|
||||
|
||||
inherit
|
||||
CMS_API_OPTIONS
|
||||
|
||||
create
|
||||
make,
|
||||
make_absolute
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_absolute
|
||||
do
|
||||
make (1)
|
||||
force (True, "absolute")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,16 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_AUTH_ENGINE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_AUTH_ENGINE
|
||||
|
||||
feature -- Status
|
||||
|
||||
valid_credential (u,p: READABLE_STRING_32): BOOLEAN
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,32 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_STORAGE_AUTH_ENGINE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_STORAGE_AUTH_ENGINE
|
||||
|
||||
inherit
|
||||
CMS_AUTH_ENGINE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_storage: like storage)
|
||||
do
|
||||
storage := a_storage
|
||||
end
|
||||
|
||||
storage: CMS_STORAGE
|
||||
|
||||
feature -- Status
|
||||
|
||||
valid_credential (u,p: READABLE_STRING_32): BOOLEAN
|
||||
do
|
||||
Result := storage.is_valid_credential (u, p)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,225 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HTML_PAGE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_HTML_PAGE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create regions.make (5)
|
||||
language := "en"
|
||||
|
||||
status_code := {HTTP_STATUS_CODE}.ok
|
||||
create header.make
|
||||
create {ARRAYED_LIST [STRING]} head_lines.make (5)
|
||||
header.put_content_type_text_html
|
||||
end
|
||||
|
||||
feature -- Status
|
||||
|
||||
status_code: INTEGER
|
||||
|
||||
feature -- Header
|
||||
|
||||
header: HTTP_HEADER
|
||||
|
||||
feature -- Region
|
||||
|
||||
regions: HASH_TABLE [STRING_8, STRING_8]
|
||||
-- header
|
||||
-- content
|
||||
-- footer
|
||||
-- could have sidebar first, sidebar second, ...
|
||||
|
||||
region (n: STRING_8): STRING_8
|
||||
do
|
||||
if attached regions.item (n) as r then
|
||||
Result := r
|
||||
else
|
||||
Result := ""
|
||||
debug
|
||||
Result := "{{" + n + "}}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
html_head: STRING_8
|
||||
local
|
||||
t: like title
|
||||
lines: like head_lines
|
||||
do
|
||||
t := title
|
||||
lines := head_lines
|
||||
if t /= Void or else lines.count > 0 then
|
||||
create Result.make (50)
|
||||
if t /= Void then
|
||||
Result.append ("<title>" + t + "</title>%N")
|
||||
end
|
||||
Result.append_character ('%N')
|
||||
across
|
||||
lines as l
|
||||
loop
|
||||
Result.append (l.item)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
|
||||
header_region: STRING_8
|
||||
do
|
||||
Result := region ("header")
|
||||
end
|
||||
|
||||
content_region: STRING_8
|
||||
do
|
||||
Result := region ("content")
|
||||
end
|
||||
|
||||
footer_region: STRING_8
|
||||
do
|
||||
Result := region ("content")
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
add_to_region (s: STRING; k: STRING)
|
||||
local
|
||||
r: detachable STRING
|
||||
do
|
||||
r := regions.item (k)
|
||||
if r = Void then
|
||||
create r.make_from_string (s)
|
||||
set_region (r, k)
|
||||
else
|
||||
r.append (s)
|
||||
end
|
||||
end
|
||||
|
||||
add_to_header_region (s: STRING)
|
||||
do
|
||||
add_to_region (s, "header")
|
||||
end
|
||||
|
||||
add_to_content_region (s: STRING)
|
||||
do
|
||||
add_to_region (s, "content")
|
||||
end
|
||||
|
||||
add_to_footer_region (s: STRING)
|
||||
do
|
||||
add_to_region (s, "footer")
|
||||
end
|
||||
|
||||
set_region (s: STRING; k: STRING)
|
||||
do
|
||||
regions.force (s, k)
|
||||
end
|
||||
|
||||
-- set_header_region (s: STRING)
|
||||
-- do
|
||||
-- set_region (s, "header")
|
||||
-- end
|
||||
|
||||
-- set_content_region (s: STRING)
|
||||
-- do
|
||||
-- set_region (s, "content")
|
||||
-- end
|
||||
|
||||
-- set_footer_region (s: STRING)
|
||||
-- do
|
||||
-- set_region (s, "footer")
|
||||
-- end
|
||||
|
||||
feature -- Access
|
||||
|
||||
title: detachable STRING
|
||||
|
||||
language: STRING
|
||||
|
||||
head_lines: LIST [STRING]
|
||||
|
||||
head_lines_to_string: STRING
|
||||
do
|
||||
create Result.make_empty
|
||||
across
|
||||
head_lines as h
|
||||
loop
|
||||
Result.append (h.item)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
end
|
||||
|
||||
-- variables: HASH_TABLE [detachable ANY, STRING_8]
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_status_code (c: like status_code)
|
||||
do
|
||||
status_code := c
|
||||
end
|
||||
|
||||
set_language (s: like language)
|
||||
do
|
||||
language := s
|
||||
end
|
||||
|
||||
set_title (s: like title)
|
||||
do
|
||||
title := s
|
||||
end
|
||||
|
||||
add_meta_name_content (a_name: STRING; a_content: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<meta name=%"" + a_name + "%" content=%"" + a_content + "%" />"
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
add_meta_http_equiv (a_http_equiv: STRING; a_content: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<meta http-equiv=%"" + a_http_equiv + "%" content=%"" + a_content + "%" />"
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
add_style (a_href: STRING; a_media: detachable STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<link rel=%"stylesheet%" href=%""+ a_href + "%" type=%"text/css%""
|
||||
if a_media /= Void then
|
||||
s.append (" media=%""+ a_media + "%"")
|
||||
end
|
||||
s.append ("/>")
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
add_javascript_url (a_src: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%" src=%"" + a_src + "%"></script>"
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
add_javascript_content (a_script: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%">%N" + a_script + "%N</script>"
|
||||
head_lines.extend (s)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,139 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Summary description for CMS_SESSION_CONTROLER.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_SESSION_CONTROLER
|
||||
|
||||
inherit
|
||||
ANY
|
||||
|
||||
WSF_SESSION_FACTORY [WSF_SESSION]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make (req: WSF_REQUEST; a_mngr: like session_manager; a_site_id: READABLE_STRING_8)
|
||||
do
|
||||
site_id := a_site_id
|
||||
session_manager := a_mngr
|
||||
initialize
|
||||
create discarded_sessions.make
|
||||
get_session (req)
|
||||
end
|
||||
|
||||
initialize
|
||||
do
|
||||
session_id_name := "_EWF_CMS_SESSID__" + site_id
|
||||
end
|
||||
|
||||
feature -- Session access
|
||||
|
||||
site_id: READABLE_STRING_8
|
||||
-- Associated CMS site id.
|
||||
|
||||
session: WSF_SESSION
|
||||
|
||||
has_pending_session: BOOLEAN
|
||||
|
||||
discarded_sessions: LINKED_LIST [like session]
|
||||
|
||||
feature -- Session operation
|
||||
|
||||
session_commit (page: CMS_HTML_PAGE_RESPONSE; e: CMS_EXECUTION)
|
||||
do
|
||||
if has_pending_session then
|
||||
session.apply_to (page.header, e.request, e.request.script_url ("/"))
|
||||
end
|
||||
session.commit
|
||||
end
|
||||
|
||||
apply_sessions_to (h: HTTP_HEADER; req: WSF_REQUEST; a_path: detachable READABLE_STRING_8)
|
||||
do
|
||||
session.apply_to (h, req, a_path)
|
||||
across
|
||||
discarded_sessions as c
|
||||
loop
|
||||
c.item.apply_to (h, req, a_path)
|
||||
end
|
||||
end
|
||||
|
||||
start_session (req: WSF_REQUEST)
|
||||
-- Start a new session
|
||||
local
|
||||
s: like session
|
||||
do
|
||||
close_session (req)
|
||||
s := new_session (req, False, session_manager)
|
||||
req.set_execution_variable (session_request_variable_name, s)
|
||||
session := s
|
||||
if s.is_pending then
|
||||
has_pending_session := True
|
||||
end
|
||||
ensure
|
||||
session_attached: session /= Void
|
||||
end
|
||||
|
||||
get_session (req: WSF_REQUEST)
|
||||
-- Get existing session, or start a new one
|
||||
local
|
||||
s: like session
|
||||
do
|
||||
if attached {like session} req.execution_variable (session_request_variable_name) as r_session then
|
||||
session := r_session
|
||||
else
|
||||
s := new_session (req, True, session_manager)
|
||||
-- create {CMS_SESSION} s.make (req, "_EWF_CMS_SESSID")
|
||||
if s.is_pending then
|
||||
has_pending_session := True
|
||||
end
|
||||
session := s
|
||||
req.set_execution_variable (session_request_variable_name, s)
|
||||
end
|
||||
if session.expired then
|
||||
start_session (req)
|
||||
end
|
||||
end
|
||||
|
||||
close_session (req: WSF_REQUEST)
|
||||
-- Close `session' if any
|
||||
do
|
||||
if session.is_pending then
|
||||
has_pending_session := has_pending_session or not discarded_sessions.is_empty
|
||||
else
|
||||
has_pending_session := True
|
||||
discarded_sessions.extend (session)
|
||||
end
|
||||
session.destroy
|
||||
end
|
||||
|
||||
feature -- Session internal
|
||||
|
||||
session_manager: WSF_SESSION_MANAGER
|
||||
|
||||
new_session (req: WSF_REQUEST; a_reuse: BOOLEAN; m: WSF_SESSION_MANAGER): like session
|
||||
local
|
||||
s: CMS_SESSION
|
||||
dt: DATE_TIME
|
||||
do
|
||||
if a_reuse then
|
||||
create s.make (req, session_id_name, m)
|
||||
else
|
||||
create s.make_new (session_id_name, m)
|
||||
create dt.make_now_utc
|
||||
dt.day_add (31)
|
||||
s.set_expiration (dt)
|
||||
end
|
||||
Result := s
|
||||
end
|
||||
|
||||
session_request_variable_name: STRING = "_EWF_CMS_SESSION_"
|
||||
|
||||
session_id_name: READABLE_STRING_8
|
||||
|
||||
end
|
||||
@@ -1,195 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_USER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_USER
|
||||
|
||||
inherit
|
||||
DEBUG_OUTPUT
|
||||
|
||||
create
|
||||
make_new,
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_id: like id; n: like name; dt: like creation_date)
|
||||
require
|
||||
a_id > 0
|
||||
do
|
||||
id := a_id
|
||||
creation_date := dt
|
||||
name := n
|
||||
ensure
|
||||
valid_password: password = Void
|
||||
end
|
||||
|
||||
make_new (n: like name)
|
||||
do
|
||||
name := n
|
||||
create creation_date.make_now_utc
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
is_admin: BOOLEAN
|
||||
do
|
||||
Result := id = 1
|
||||
end
|
||||
|
||||
id: INTEGER
|
||||
|
||||
name: STRING_8
|
||||
|
||||
password: detachable READABLE_STRING_32
|
||||
|
||||
email: detachable READABLE_STRING_8
|
||||
|
||||
profile: detachable CMS_USER_PROFILE
|
||||
|
||||
creation_date: DATE_TIME
|
||||
|
||||
last_login_date: detachable DATE_TIME
|
||||
|
||||
data: detachable HASH_TABLE [detachable ANY, STRING]
|
||||
|
||||
data_item (k: STRING): detachable ANY
|
||||
do
|
||||
if attached data as l_data then
|
||||
Result := l_data.item (k)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Permission
|
||||
|
||||
roles: detachable LIST [INTEGER]
|
||||
-- Associated roles
|
||||
-- Note: does not include "authenticated" and "anonymous".
|
||||
|
||||
has_role (r: CMS_USER_ROLE): BOOLEAN
|
||||
do
|
||||
Result := attached roles as lst and then lst.has (r.id)
|
||||
end
|
||||
|
||||
clear_roles
|
||||
do
|
||||
roles := Void
|
||||
end
|
||||
|
||||
add_role_by_id (r_id: INTEGER)
|
||||
local
|
||||
lst: like roles
|
||||
do
|
||||
lst := roles
|
||||
if r_id <= 2 then -- Anonymous=1 and Authenticated=2
|
||||
lst := roles
|
||||
if lst /= Void and then lst.is_empty then
|
||||
clear_roles
|
||||
end
|
||||
else
|
||||
if lst = Void then
|
||||
create {ARRAYED_SET [INTEGER]} lst.make (1)
|
||||
roles := lst
|
||||
end
|
||||
lst.force (r_id)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
has_id: BOOLEAN
|
||||
do
|
||||
Result := id > 0
|
||||
end
|
||||
|
||||
has_email: BOOLEAN
|
||||
do
|
||||
Result := attached email as e and then not e.is_empty
|
||||
end
|
||||
|
||||
debug_output: STRING
|
||||
do
|
||||
Result := name
|
||||
end
|
||||
|
||||
same_as (u: detachable CMS_USER): BOOLEAN
|
||||
do
|
||||
Result := u /= Void and then id = u.id
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_id (a_id: like id)
|
||||
do
|
||||
id := a_id
|
||||
end
|
||||
|
||||
set_password (p: like password)
|
||||
do
|
||||
password := p
|
||||
end
|
||||
|
||||
set_email (m: like email)
|
||||
do
|
||||
email := m
|
||||
end
|
||||
|
||||
set_profile (prof: like profile)
|
||||
do
|
||||
profile := prof
|
||||
end
|
||||
|
||||
set_data_item (k: READABLE_STRING_8; d: like data_item)
|
||||
local
|
||||
l_data: like data
|
||||
do
|
||||
l_data := data
|
||||
if l_data = Void then
|
||||
create l_data.make (1)
|
||||
data := l_data
|
||||
end
|
||||
l_data.force (d, k)
|
||||
end
|
||||
|
||||
remove_data_item (k: READABLE_STRING_8)
|
||||
do
|
||||
if attached data as l_data then
|
||||
l_data.remove (k)
|
||||
end
|
||||
end
|
||||
|
||||
set_profile_item (k: READABLE_STRING_8; v: READABLE_STRING_8)
|
||||
local
|
||||
prof: like profile
|
||||
do
|
||||
prof := profile
|
||||
if prof = Void then
|
||||
create prof.make
|
||||
profile := prof
|
||||
end
|
||||
prof.force (v, k)
|
||||
end
|
||||
|
||||
set_last_login_date (dt: like last_login_date)
|
||||
do
|
||||
last_login_date := dt
|
||||
end
|
||||
|
||||
set_last_login_date_now
|
||||
do
|
||||
set_last_login_date (create {DATE_TIME}.make_now_utc)
|
||||
end
|
||||
|
||||
feature {CMS_STORAGE} -- Security
|
||||
|
||||
encoded_password: detachable READABLE_STRING_8
|
||||
|
||||
set_encoded_password (p: like encoded_password)
|
||||
do
|
||||
encoded_password := p
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,51 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_USER_PROFILE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_USER_PROFILE
|
||||
|
||||
inherit
|
||||
TABLE_ITERABLE [READABLE_STRING_8, READABLE_STRING_8]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create items.make (0)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
item (k: READABLE_STRING_8): detachable READABLE_STRING_8
|
||||
do
|
||||
Result := items.item (k.as_string_8)
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
force (v: READABLE_STRING_8; k: READABLE_STRING_8)
|
||||
do
|
||||
items.force (v, k.as_string_8)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_8]
|
||||
-- Fresh cursor associated with current structure
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
items: HASH_TABLE [READABLE_STRING_8, STRING_8]
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,85 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_USER_ROLE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_USER_ROLE
|
||||
|
||||
inherit
|
||||
ANY
|
||||
redefine
|
||||
is_equal
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_id
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_with_id (a_id: like id; a_name: like name)
|
||||
do
|
||||
id := a_id
|
||||
make (a_name)
|
||||
end
|
||||
|
||||
make (a_name: like name)
|
||||
do
|
||||
name := a_name
|
||||
create {ARRAYED_LIST [READABLE_STRING_8]} permissions.make (0)
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
has_id: BOOLEAN
|
||||
do
|
||||
Result := id > 0
|
||||
end
|
||||
|
||||
has_permission (p: READABLE_STRING_8): BOOLEAN
|
||||
do
|
||||
Result := across permissions as c some c.item.is_case_insensitive_equal (p) end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
id: INTEGER
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
|
||||
feature -- Comparison
|
||||
|
||||
same_user_role (r: CMS_USER_ROLE): BOOLEAN
|
||||
do
|
||||
Result := r.id = id
|
||||
end
|
||||
|
||||
is_equal (other: like Current): BOOLEAN
|
||||
-- Is `other' attached to an object considered
|
||||
-- equal to current object?
|
||||
do
|
||||
Result := id = other.id
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_id (a_id: like id)
|
||||
do
|
||||
id := a_id
|
||||
end
|
||||
|
||||
set_name (a_name: like name)
|
||||
do
|
||||
name := a_name
|
||||
end
|
||||
|
||||
add_permission (n: READABLE_STRING_8)
|
||||
do
|
||||
permissions.force (n)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,32 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_BLOCK}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_BLOCK
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
deferred
|
||||
end
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- status report
|
||||
|
||||
is_enabled: BOOLEAN
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
deferred
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,46 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_CONTENT_BLOCK}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_CONTENT_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_BLOCK
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_name: like name; a_title: like title; a_body: like body; a_format: like format)
|
||||
do
|
||||
is_enabled := True
|
||||
name := a_name
|
||||
title := a_title
|
||||
body := a_body
|
||||
format := a_format
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
|
||||
body: READABLE_STRING_8
|
||||
|
||||
format: CMS_FORMAT
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
Result := format.to_html (body)
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,60 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_CONTENT_TYPE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_CONTENT_TYPE
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
-- Internal name
|
||||
deferred
|
||||
end
|
||||
|
||||
title: READABLE_STRING_8
|
||||
deferred
|
||||
end
|
||||
|
||||
description: detachable READABLE_STRING_8
|
||||
-- Optional description
|
||||
deferred
|
||||
end
|
||||
|
||||
available_formats: LIST [CMS_FORMAT]
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Factory
|
||||
|
||||
fill_edit_form (f: CMS_FORM; a_node: detachable CMS_NODE)
|
||||
-- Fill the edit form `f'
|
||||
deferred
|
||||
end
|
||||
|
||||
change_node (a_execution: CMS_EXECUTION; a_form_data: WSF_FORM_DATA; a_node: like new_node)
|
||||
-- Apply data from `a_form_data' to a_node
|
||||
require
|
||||
a_node.has_id
|
||||
deferred
|
||||
end
|
||||
|
||||
new_node (a_execution: CMS_EXECUTION; a_form_data: WSF_FORM_DATA; a_node: detachable like new_node): CMS_NODE
|
||||
-- New content created with `a_form_data'
|
||||
deferred
|
||||
ensure
|
||||
a_node /= Void implies a_node = Result
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: helper
|
||||
|
||||
formats: CMS_FORMATS
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,45 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_MENU_BLOCK}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_MENU_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_BLOCK
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_menu: like menu)
|
||||
do
|
||||
is_enabled := True
|
||||
menu := a_menu
|
||||
name := a_menu.name
|
||||
title := a_menu.title
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
menu: CMS_MENU
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
|
||||
is_horizontal: BOOLEAN
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
Result := a_theme.menu_html (menu, is_horizontal)
|
||||
end
|
||||
|
||||
invariant
|
||||
|
||||
end
|
||||
@@ -1,101 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_CMS_NODE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_NODE
|
||||
|
||||
feature -- Access
|
||||
|
||||
id: INTEGER
|
||||
-- Unique identifier of Current.
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
-- Associated title (optional).
|
||||
deferred
|
||||
end
|
||||
|
||||
body: detachable READABLE_STRING_8
|
||||
-- Body of Current.
|
||||
deferred
|
||||
end
|
||||
|
||||
format: CMS_FORMAT
|
||||
-- Format associated with `body'
|
||||
deferred
|
||||
end
|
||||
|
||||
content_type_name: STRING
|
||||
-- Associated content type name
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- status report
|
||||
|
||||
has_id: BOOLEAN
|
||||
do
|
||||
Result := id > 0
|
||||
end
|
||||
|
||||
feature -- Access: status
|
||||
|
||||
author: detachable CMS_USER
|
||||
|
||||
creation_date: DATE_TIME
|
||||
|
||||
modification_date: DATE_TIME
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_id (a_id: like id)
|
||||
require
|
||||
not has_id
|
||||
do
|
||||
id := a_id
|
||||
end
|
||||
|
||||
set_author (u: like author)
|
||||
do
|
||||
author := u
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
local
|
||||
d: STRING
|
||||
do
|
||||
Result := "<div class=%"node " + content_type_name + "%" id=%"nid-" + id.out + "%">"
|
||||
if attached title as l_title then
|
||||
Result.append ("<div class=%"title%">" + a_theme.node_link (Current) + "</div>")
|
||||
end
|
||||
create d.make_empty
|
||||
if attached author as u then
|
||||
d.append ("by " + a_theme.user_link (u) + " ")
|
||||
end
|
||||
if attached modification_date as dt then
|
||||
d.append ("last modified: " + dt.year.out + "/" + dt.month.out + "/" + dt.day.out + "")
|
||||
end
|
||||
if not d.is_empty then
|
||||
Result.append ("<div class=%"description%">")
|
||||
Result.append (d)
|
||||
Result.append ("</div>")
|
||||
end
|
||||
if attached body as b then
|
||||
Result.append ("<div class=%"inner%">")
|
||||
Result.append (format.to_html (b))
|
||||
Result.append ("</div>")
|
||||
end
|
||||
Result.append ("</div>")
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: helper
|
||||
|
||||
formats: CMS_FORMATS
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user