From 5347581f8437f6d457e57c36800e46abc8343ad8 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Mon, 19 Jul 2010 14:47:39 +0100 Subject: [PATCH] improvements to compatibility of http server package. --- packages/http/config.h | 91 -------------------------------- packages/http/http_client.pl | 1 + packages/http/http_header.pl | 2 +- packages/http/http_stream.pl | 3 ++ packages/http/test_cgi_stream.pl | 5 +- 5 files changed, 7 insertions(+), 95 deletions(-) delete mode 100644 packages/http/config.h diff --git a/packages/http/config.h b/packages/http/config.h deleted file mode 100644 index 2e68a60b9..000000000 --- a/packages/http/config.h +++ /dev/null @@ -1,91 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -/* #undef CRAY_STACKSEG_END */ - -/* Define to 1 if using `alloca.c'. */ -/* #undef C_ALLOCA */ - -/* Define to 1 if you have `alloca', as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#define HAVE_ALLOCA_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "" - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -/* #undef STACK_DIRECTION */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Define for multi-thread support */ -/* #undef _REENTRANT */ diff --git a/packages/http/http_client.pl b/packages/http/http_client.pl index f65823edc..d3fb29b3d 100644 --- a/packages/http/http_client.pl +++ b/packages/http/http_client.pl @@ -47,6 +47,7 @@ :- use_module(library(lists)). :- use_module(library(error)). :- use_module(library(option)). +:- use_module(http_stream). :- use_module(dcg_basics). :- multifile diff --git a/packages/http/http_header.pl b/packages/http/http_header.pl index 2614a2fe8..1ee2559f5 100644 --- a/packages/http/http_header.pl +++ b/packages/http/http_header.pl @@ -55,13 +55,13 @@ :- use_module(library(memfile)). :- use_module(library(settings)). :- use_module(library(error)). +:- use_module(library(ctypes)). :- use_module(dcg_basics). :- use_module(html_write). :- use_module(http_exception). :- use_module(mimetype). :- use_module(mimepack). - % see http_update_transfer/4. :- setting(http:chunked_transfer, oneof([never,on_request,if_possible]), diff --git a/packages/http/http_stream.pl b/packages/http/http_stream.pl index d4aee79d7..b7505f15d 100644 --- a/packages/http/http_stream.pl +++ b/packages/http/http_stream.pl @@ -131,6 +131,9 @@ bytes, dispite the fact that the underlying stream may be longer. % size(ContentLength). Closing DataStream does not close % RawStream. +:- meta_predicate cgi_open(+, -, :, +). + + %% cgi_open(+OutStream, -CGIStream, :Hook, +Options) is det. % % Process CGI output. OutStream is normally the socket returning diff --git a/packages/http/test_cgi_stream.pl b/packages/http/test_cgi_stream.pl index 8ea565af2..e1a440b51 100644 --- a/packages/http/test_cgi_stream.pl +++ b/packages/http/test_cgi_stream.pl @@ -43,7 +43,6 @@ :- expects_dialect(swi). :- assert(system:swi_io). - /** Test CGI stream object This module defines a series of tests outside the context of the HTTP @@ -199,12 +198,12 @@ test(traditional, ]) :- data(Name, Data, ContentType), cgi_open(Out, CGI, cgi_hook, []), - start_low_level_trace, format(CGI, 'Content-type: ~w\n\n', [ContentType]), format(CGI, '~w', [Data]), close(CGI), close(Out), - http_read_mf(TmpF, Header, Reply), + ( + http_read_mf(TmpF, Header, Reply) ; stop_low_level_trace, halt), assert_header(Header, status(ok, _)). test(unicode,