aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorswhite <swhite@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2004-04-07 14:28:50 +0000
committerswhite <swhite@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2004-04-07 14:28:50 +0000
commit46eb8514f4613b2daad5d2998287bcaaa04af7b6 (patch)
treeb5ef3e6c983ce06f20124c0f06684dc82ed2bb65
parent5b350aa4013f4ece2f0b92d2da0fde1e8ca164c5 (diff)
Fixed the thorn HTTPDExtra broken by commit of HTTPD changes.
Made HTTPDExtra to include headers from HTTPD using the proper Cactus include header mechanism (although it seems to still include files directly from other thorns). Did the same process as before with HTTPD, replacing strcpy and sprintf writes of data of unkown length into automatic buffers with calls to a String module. Altered the namespace mechanism for the String module, using header files rather than defining a preprocessor variable. Caveat: Although I turned it on and looked at the pages it produces, I have not tested this as extensively as HTTPD thorn. git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@189 1faa4e14-9dd3-4be0-9f0e-ffe519881164
-rw-r--r--src/Authorisation.c1
-rw-r--r--src/Content.c2
-rw-r--r--src/Cookies.c5
-rw-r--r--src/Groups.c2
-rw-r--r--src/HTTPDUtils.h36
-rw-r--r--src/Headers.c5
-rw-r--r--src/Parameters.c4
-rw-r--r--src/Redirect.c1
-rw-r--r--src/SString.h54
-rw-r--r--src/SStringHTML.h8
-rw-r--r--src/SStringHTML_Namespace.h20
-rw-r--r--src/SStringIO.h15
-rw-r--r--src/SStringIO_Namespace.h25
-rw-r--r--src/SString_Namespace.h66
-rw-r--r--src/Server.c4
-rw-r--r--src/Thorns.c3
-rw-r--r--src/http_Content.h1
-rw-r--r--src/http_SString.h7
18 files changed, 166 insertions, 93 deletions
diff --git a/src/Authorisation.c b/src/Authorisation.c
index b0c4723..6ca76c6 100644
--- a/src/Authorisation.c
+++ b/src/Authorisation.c
@@ -28,6 +28,7 @@
#include "http_Request.h"
#include "http_Auth.h"
#include "http_SString.h"
+#include "SString_Namespace.h"
#include "base64.h"
diff --git a/src/Content.c b/src/Content.c
index 425b9f2..be751c5 100644
--- a/src/Content.c
+++ b/src/Content.c
@@ -41,12 +41,12 @@
#include "cctk_Parameters.h"
#include "http_SString.h"
+#include "SString_Namespace.h"
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusConnect_HTTPD_Content_c)
-#define EMPTYSTRING {'\0'}
/********************************************************************
********************* Local Data Types ***********************
********************************************************************/
diff --git a/src/Cookies.c b/src/Cookies.c
index f4cf36d..766d942 100644
--- a/src/Cookies.c
+++ b/src/Cookies.c
@@ -17,9 +17,8 @@
#include "http_Request.h"
#include "http_Cookies.h"
-#define STRING_NAMESPACE 1
-#include "SString.h"
-
+#include "http_SString.h"
+#include "SString_Namespace.h"
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusConnect_HTTPD_Cookies_c)
diff --git a/src/Groups.c b/src/Groups.c
index 08a54ad..3df8f40 100644
--- a/src/Groups.c
+++ b/src/Groups.c
@@ -20,7 +20,7 @@
#include "http_Content.h"
#include "http_SString.h"
-
+#include "SString_Namespace.h"
static const char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusConnect_HTTPD_Groups_c)
diff --git a/src/HTTPDUtils.h b/src/HTTPDUtils.h
new file mode 100644
index 0000000..b3d9509
--- /dev/null
+++ b/src/HTTPDUtils.h
@@ -0,0 +1,36 @@
+ /*@@
+ @header HTTPDUtils.h
+ @date April 7 2004
+ @author Steve White
+ @desc
+ Routines exported by HTTPD to other thorns.
+ @enddesc
+ @version $Header$
+ @@*/
+
+#ifndef __HTTP_UTILS_H__
+#define __HTTP_UTILS_H__ 1
+
+#define HTTP_QUICKLINK 1
+
+#include "http_Request.h"
+#include "http_SString.h"
+#include "http_Content.h"
+#include "SString_Namespace.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+int SetHTML_ContentHeader(const cGH *cctkGH, int choice, String *mess,
+ const String *menu);
+int SetHTML_ContentFooter(const cGH *cctkGH, int choice, String *mess);
+
+void SendHTTP_OK_Header(httpRequest *request);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/Headers.c b/src/Headers.c
index d143f60..25534d0 100644
--- a/src/Headers.c
+++ b/src/Headers.c
@@ -14,6 +14,8 @@
#include <string.h>
+#include "SString_Namespace.h"
+#define EMPTYSTRING { '\0' }
static const char *rcsid = "$Header$";
@@ -111,9 +113,6 @@ static const char * cactus_doctype =
********************* External Routines **********************
********************************************************************/
-#define EMPTYSTRING { '\0' }
-#define STRING_NAMESPACE
-#include "SString.h"
void SetHTML_HeadHeader( String *header)
{
SetToCString( header, cactus_styles );
diff --git a/src/Parameters.c b/src/Parameters.c
index 17cc3d5..44b17f8 100644
--- a/src/Parameters.c
+++ b/src/Parameters.c
@@ -30,12 +30,14 @@
#include "http_Cookies.h"
#include "http_Content.h"
+#include "http_SString.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
-#define STRING_NAMESPACE 1
#include "SStringHTML.h"
+#include "SString_Namespace.h"
+#include "SStringHTML_Namespace.h"
static const char *rcsid = "$Header$";
diff --git a/src/Redirect.c b/src/Redirect.c
index 56141cf..24f9729 100644
--- a/src/Redirect.c
+++ b/src/Redirect.c
@@ -27,6 +27,7 @@
#include "http_Redirect.h"
#include "http_SString.h"
+#include "SString_Namespace.h"
static const char *rcsid = "$Header$";
diff --git a/src/SString.h b/src/SString.h
index 1ff5445..96d1af6 100644
--- a/src/SString.h
+++ b/src/SString.h
@@ -68,58 +68,4 @@ String * StringConcatDouble( String *str, double d );
String * StringConcatFormattedDouble( String *str, int ndigits,
int ndecimals, double d );
-/* A poor man's namespace for the String module */
-#ifdef STRING_NAMESPACE
-
-#define Set( a, b ) \
- StringSet( a, b )
-#define SetToCString( a, b ) \
- StringSetToCString( a, b )
-#define InsertCString( a, b, c ) \
- StringInsertCString( a, b, c )
-#define ConcatCString( a, b ) \
- StringConcatCString( a, b )
-#define SetToBuffer( a, b ) \
- StringSetToBuffer( a, b )
-#define GetBuffer( a ) \
- StringGetBuffer( a )
-#define Length( p ) \
- StringLength( p )
-#define NthChar( s, n ) \
- StringNthChar( s, n )
-#define SetNthChar( s, n, c ) \
- StringSetNthChar( s, n, c )
-#define Truncate( s, n ) \
- StringTruncate( s, n )
-#define FindSubString( s, c, p ) \
- StringFindSubString( s, c, p )
-#define FindChar( s, c, p ) \
- StringFindChar( s, c, p )
-#define Compare( a, b ) \
- StringCompare( a, b )
-#define AreEqual( a, b ) \
- StringsAreEqual( a, b )
-#define Insert( a, b, p ) \
- StringInsert( a, b, p )
-#define InsertChar( a, b, p ) \
- StringInsertChar( a, b, p )
-#define Concat( a, b ) \
- StringConcat( a, b )
-#define Print( a ) \
- StringPrint( a )
-#define FormatPrint( a, s ) \
- StringFormatPrint( a, s )
-#define ConcatDecimal( a, s ) \
- StringConcatDecimal( a, s )
-#define ConcatHex( a, s ) \
- StringConcatHex( a, s )
-#define ConcatOctal( a, s ) \
- StringConcatOctal( a, s )
-#define ConcatDouble( a, s ) \
- StringConcatDouble( a, s )
-#define ConcatFormattedDouble( a, f, f2, s ) \
- StringConcatFormattedDouble( a, f, f2, s )
-
-#endif
-
#endif
diff --git a/src/SStringHTML.h b/src/SStringHTML.h
index 6749ac8..6fb220c 100644
--- a/src/SStringHTML.h
+++ b/src/SStringHTML.h
@@ -33,13 +33,5 @@ String * StringEncodeURL( String * str );
String * StringSetToEncodedHTMLCString( String * str, const char *c );
String * StringEncodeHTML( String * str );
-#ifdef STRING_NAMESPACE
-
-#define EncodeHTML( s ) \
- StringEncodeHTML( s )
-#define SetToEncodedHTMLCString( s, c ) \
- StringSetToEncodedHTMLCString( s, c )
-
-#endif
#endif
diff --git a/src/SStringHTML_Namespace.h b/src/SStringHTML_Namespace.h
new file mode 100644
index 0000000..0560f42
--- /dev/null
+++ b/src/SStringHTML_Namespace.h
@@ -0,0 +1,20 @@
+ /*@@
+ @file SStringHTMLNamespace.h
+ @date 02.04.2004
+ @author Steve White
+ @desc Extension to Strings module with function specific to HTML
+ @enddesc
+ @version $Header$
+ @@*/
+#ifndef _SSTRINGHTML_NAMESPACE_H
+#define _SSTRINGHTML_NAMESPACE_H
+
+#include "SStringHTML.h"
+
+
+#define EncodeHTML( s ) \
+ StringEncodeHTML( s )
+#define SetToEncodedHTMLCString( s, c ) \
+ StringSetToEncodedHTMLCString( s, c )
+
+#endif
diff --git a/src/SStringIO.h b/src/SStringIO.h
index 0d79c28..7c84fb1 100644
--- a/src/SStringIO.h
+++ b/src/SStringIO.h
@@ -21,19 +21,4 @@ void StringPrintToFile( const String *str, FILE * is );
void StringFormatPrintToFile( const String *str, const char *format,
FILE * is );
-#ifdef STRING_NAMESPACE
-
-#define ReadToDelimiter( a, f, d ) \
- StringReadToDelimiter( a, f, d )
-#define ReadToEndOfLine( a, f ) \
- StringReadToEndOfLine( a, f )
-#define ReadLine( a, f ) \
- StringReadLine( a, f )
-#define PrintToFile( a, f ) \
- StringPrintToFile( a, f )
-#define FormatPrintToFile( a, s, f ) \
- StringFormatPrintToFile( a, s, f )
-
-#endif
-
#endif
diff --git a/src/SStringIO_Namespace.h b/src/SStringIO_Namespace.h
new file mode 100644
index 0000000..274027b
--- /dev/null
+++ b/src/SStringIO_Namespace.h
@@ -0,0 +1,25 @@
+ /*@@
+ @file SStringIO_Namespace.h
+ @date 02.04.2004
+ @author Steve White
+ @desc Extensions to Strings module involvint file IO
+ @enddesc
+ @version $Header$
+ @@*/
+#ifndef _SSTRINGIO_NAMESPACE_H
+#define _SSTRINGIO_NAMESPACE_H
+
+#include "SStringIO.h"
+
+#define ReadToDelimiter( a, f, d ) \
+ StringReadToDelimiter( a, f, d )
+#define ReadToEndOfLine( a, f ) \
+ StringReadToEndOfLine( a, f )
+#define ReadLine( a, f ) \
+ StringReadLine( a, f )
+#define PrintToFile( a, f ) \
+ StringPrintToFile( a, f )
+#define FormatPrintToFile( a, s, f ) \
+ StringFormatPrintToFile( a, s, f )
+
+#endif
diff --git a/src/SString_Namespace.h b/src/SString_Namespace.h
new file mode 100644
index 0000000..4c40388
--- /dev/null
+++ b/src/SString_Namespace.h
@@ -0,0 +1,66 @@
+ /*@@
+ @file SString_Namespace.h
+ @date 02.04.2004
+ @author Steve White
+ @desc Module for generic operations on strings
+ @enddesc
+ @version $Header$
+ @@*/
+#ifndef _SSTRING_NAMESPACE_H
+#define _SSTRING_NAMESPACE_H
+
+#include "SString.h"
+
+
+/* A poor man's namespace for the String module */
+
+#define Set( a, b ) \
+ StringSet( a, b )
+#define SetToCString( a, b ) \
+ StringSetToCString( a, b )
+#define InsertCString( a, b, c ) \
+ StringInsertCString( a, b, c )
+#define ConcatCString( a, b ) \
+ StringConcatCString( a, b )
+#define SetToBuffer( a, b ) \
+ StringSetToBuffer( a, b )
+#define GetBuffer( a ) \
+ StringGetBuffer( a )
+#define Length( p ) \
+ StringLength( p )
+#define NthChar( s, n ) \
+ StringNthChar( s, n )
+#define SetNthChar( s, n, c ) \
+ StringSetNthChar( s, n, c )
+#define Truncate( s, n ) \
+ StringTruncate( s, n )
+#define FindSubString( s, c, p ) \
+ StringFindSubString( s, c, p )
+#define FindChar( s, c, p ) \
+ StringFindChar( s, c, p )
+#define Compare( a, b ) \
+ StringCompare( a, b )
+#define AreEqual( a, b ) \
+ StringsAreEqual( a, b )
+#define Insert( a, b, p ) \
+ StringInsert( a, b, p )
+#define InsertChar( a, b, p ) \
+ StringInsertChar( a, b, p )
+#define Concat( a, b ) \
+ StringConcat( a, b )
+#define Print( a ) \
+ StringPrint( a )
+#define FormatPrint( a, s ) \
+ StringFormatPrint( a, s )
+#define ConcatDecimal( a, s ) \
+ StringConcatDecimal( a, s )
+#define ConcatHex( a, s ) \
+ StringConcatHex( a, s )
+#define ConcatOctal( a, s ) \
+ StringConcatOctal( a, s )
+#define ConcatDouble( a, s ) \
+ StringConcatDouble( a, s )
+#define ConcatFormattedDouble( a, f, f2, s ) \
+ StringConcatFormattedDouble( a, f, f2, s )
+
+#endif
diff --git a/src/Server.c b/src/Server.c
index 85116db..9af9c55 100644
--- a/src/Server.c
+++ b/src/Server.c
@@ -27,8 +27,8 @@
#include "http_Steer.h"
#include "http_Expression.h"
-#define STRING_NAMESPACE 1
-#include "SString.h"
+
+#include "SString_Namespace.h"
static const char *rcsid = "$Header$";
diff --git a/src/Thorns.c b/src/Thorns.c
index 05ca112..5b10a8c 100644
--- a/src/Thorns.c
+++ b/src/Thorns.c
@@ -17,6 +17,9 @@
#include "http_Request.h"
#include "http_Content.h"
+#include "http_SString.h"
+#include "SString_Namespace.h"
+#include "SStringHTML_Namespace.h"
static const char *rcsid = "$Header$";
diff --git a/src/http_Content.h b/src/http_Content.h
index bfac5d7..307da99 100644
--- a/src/http_Content.h
+++ b/src/http_Content.h
@@ -13,7 +13,6 @@
#define HTTP_QUICKLINK 1
-#define STRING_NAMESPACE 1
#include "SString.h"
#define EMPTYSTRING {'\0'}
diff --git a/src/http_SString.h b/src/http_SString.h
index 3244666..091a1a6 100644
--- a/src/http_SString.h
+++ b/src/http_SString.h
@@ -1,7 +1,7 @@
/*@@
- @header http_Content.h
- @date Sun Sep 17 14:19:23 2000
- @author Tom Goodale
+ @header http_SString.h
+ @date April 7 14:19:23 2004
+ @author Steve White
@desc
Routines exported by the Content stuff.
@enddesc
@@ -11,7 +11,6 @@
#ifndef __HTTP_SSTRING_H__
#define __HTTP_SSTRING_H__ 1
-#define STRING_NAMESPACE 1
#include "SString.h"
#define EMPTYSTRING {'\0'}