mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-05-31 01:01:19 +00:00
* GSWeb/GSWComponentRequestHandler.m
* GSWeb/GSWComponent.m * GSWeb/GSWConstants.[h|m] * GSWeb/GSWFileUpload.m * GSWeb/GSWRequest.m * GSWeb/GSWResourceRequestHandler.m * GSWeb/GSWResponse.m introduce some new string constants to GSWConstants and use them more consistently git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@36743 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b87aa5a799
commit
0e263dd5a5
10 changed files with 37 additions and 18 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2013-06-22: Sebastian Reitenbach <sebastia@l00-bugdead-prods.de>
|
||||||
|
* GSWeb/GSWComponentRequestHandler.m
|
||||||
|
* GSWeb/GSWComponent.m
|
||||||
|
* GSWeb/GSWConstants.[h|m]
|
||||||
|
* GSWeb/GSWFileUpload.m
|
||||||
|
* GSWeb/GSWRequest.m
|
||||||
|
* GSWeb/GSWResourceRequestHandler.m
|
||||||
|
* GSWeb/GSWResponse.m
|
||||||
|
introduce some new string constants to GSWConstants
|
||||||
|
and use them more consistently
|
||||||
|
|
||||||
2013-06-12: David Wetzel <dave@turbocat.de>
|
2013-06-12: David Wetzel <dave@turbocat.de>
|
||||||
* GSWAdaptors/Apache2/mod_gsw.c
|
* GSWAdaptors/Apache2/mod_gsw.c
|
||||||
use strncasecmp to be more tolerant with header case
|
use strncasecmp to be more tolerant with header case
|
||||||
|
|
|
@ -1306,7 +1306,7 @@ Call this method before using a component which was cached in a variable.
|
||||||
|
|
||||||
[response setHTTPVersion:httpVersion];
|
[response setHTTPVersion:httpVersion];
|
||||||
[response setHeader:@"text/html"
|
[response setHeader:@"text/html"
|
||||||
forKey:@"Content-Type"];
|
forKey:GSWHTTPHeader_ContentType];
|
||||||
[aContext _setResponse:response];
|
[aContext _setResponse:response];
|
||||||
|
|
||||||
pageElement=[aContext _pageElement];
|
pageElement=[aContext _pageElement];
|
||||||
|
|
|
@ -160,7 +160,7 @@ GSWResponse * _dispatchWithPreparedPage(GSWComponent * aPage, GSWSession * aSess
|
||||||
|
|
||||||
[aResponse setHTTPVersion:[aRequest httpVersion]];
|
[aResponse setHTTPVersion:[aRequest httpVersion]];
|
||||||
[aResponse setHeader:@"text/html"
|
[aResponse setHeader:@"text/html"
|
||||||
forKey:@"Content-Type"];
|
forKey:GSWHTTPHeader_ContentType];
|
||||||
[aContext _setResponse:aResponse];
|
[aContext _setResponse:aResponse];
|
||||||
|
|
||||||
if (oldContextID == nil) {
|
if (oldContextID == nil) {
|
||||||
|
|
|
@ -143,6 +143,7 @@ GSWEB_EXPORT NSString* GSWHTTPHeader_RecordingIDsCookie[2];
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_RecordingApplicationNumber[2];
|
GSWEB_EXPORT NSString* GSWHTTPHeader_RecordingApplicationNumber[2];
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_LoadAverage;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_LoadAverage;
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_RefuseSessions;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_RefuseSessions;
|
||||||
|
GSWEB_EXPORT NSString* GSWHTTPHeader_RefusingRedirection[2];
|
||||||
|
|
||||||
// Header key to return statistics to Adaptor
|
// Header key to return statistics to Adaptor
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_AdaptorStats[2];
|
GSWEB_EXPORT NSString* GSWHTTPHeader_AdaptorStats[2];
|
||||||
|
@ -152,8 +153,11 @@ GSWEB_EXPORT NSString* GSWHTTPHeader_MethodPost;
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_MethodGet;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_MethodGet;
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_AcceptLanguage;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_AcceptLanguage;
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_AcceptEncoding;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_AcceptEncoding;
|
||||||
|
GSWEB_EXPORT NSString* GSWHTTPHeader_ContentDisposition;
|
||||||
|
GSWEB_EXPORT NSString* GSWHTTPHeader_ContentEncoding;
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_ContentType;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_ContentType;
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_FormURLEncoded;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_FormURLEncoded;
|
||||||
|
GSWEB_EXPORT NSString* GSWHTTPHeader_Location;
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_MultipartFormData;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_MultipartFormData;
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_ContentLength;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_ContentLength;
|
||||||
GSWEB_EXPORT NSString* GSWHTTPHeader_MimeType_TextPlain;
|
GSWEB_EXPORT NSString* GSWHTTPHeader_MimeType_TextPlain;
|
||||||
|
|
|
@ -142,14 +142,18 @@ NSString* GSWHTTPHeader_RecordingIDsCookie[2]={ @"x-gsweb-ids-url", @"x-webobjec
|
||||||
NSString* GSWHTTPHeader_RecordingApplicationNumber[2]={ @"x-gsweb-application-number", @"x-webobjects-application-number" };
|
NSString* GSWHTTPHeader_RecordingApplicationNumber[2]={ @"x-gsweb-application-number", @"x-webobjects-application-number" };
|
||||||
NSString* GSWHTTPHeader_LoadAverage = @"x-webobjects-loadaverage";
|
NSString* GSWHTTPHeader_LoadAverage = @"x-webobjects-loadaverage";
|
||||||
NSString* GSWHTTPHeader_RefuseSessions = @"x-webobjects-refusenewsessions";
|
NSString* GSWHTTPHeader_RefuseSessions = @"x-webobjects-refusenewsessions";
|
||||||
|
NSString* GSWHTTPHeader_RefusingRedirection[2] = { @"x-gsweb-refusing-redirection", @"x-webobjects-refusing-redirection" };
|
||||||
NSString* GSWHTTPHeader_AdaptorStats[2] = { @"x-gsweb-adaptorstats", @"x-webobjects-adaptorstats" };
|
NSString* GSWHTTPHeader_AdaptorStats[2] = { @"x-gsweb-adaptorstats", @"x-webobjects-adaptorstats" };
|
||||||
|
|
||||||
NSString* GSWHTTPHeader_MethodPost=@"POST";
|
NSString* GSWHTTPHeader_MethodPost=@"POST";
|
||||||
NSString* GSWHTTPHeader_MethodGet=@"GET";
|
NSString* GSWHTTPHeader_MethodGet=@"GET";
|
||||||
NSString* GSWHTTPHeader_AcceptLanguage=@"Accept-Language";
|
NSString* GSWHTTPHeader_AcceptLanguage=@"Accept-Language";
|
||||||
NSString* GSWHTTPHeader_AcceptEncoding=@"Accept-Encoding";
|
NSString* GSWHTTPHeader_AcceptEncoding=@"Accept-Encoding";
|
||||||
|
NSString* GSWHTTPHeader_ContentDisposition=@"Content-Disposition";
|
||||||
|
NSString* GSWHTTPHeader_ContentEncoding=@"Content-Encoding";
|
||||||
NSString* GSWHTTPHeader_ContentType=@"Content-Type";
|
NSString* GSWHTTPHeader_ContentType=@"Content-Type";
|
||||||
NSString* GSWHTTPHeader_FormURLEncoded=@"application/x-www-form-urlencoded";
|
NSString* GSWHTTPHeader_FormURLEncoded=@"application/x-www-form-urlencoded";
|
||||||
|
NSString* GSWHTTPHeader_Location=@"Location";
|
||||||
NSString* GSWHTTPHeader_MultipartFormData=@"multipart/form-data";
|
NSString* GSWHTTPHeader_MultipartFormData=@"multipart/form-data";
|
||||||
NSString* GSWHTTPHeader_MimeType_TextPlain=@"text/plain";
|
NSString* GSWHTTPHeader_MimeType_TextPlain=@"text/plain";
|
||||||
NSString* GSWHTTPHeader_UserAgent=@"User-Agent";
|
NSString* GSWHTTPHeader_UserAgent=@"User-Agent";
|
||||||
|
|
|
@ -182,7 +182,7 @@ RCS_ID("$Id$")
|
||||||
nameInContext=[self nameInContext:context];
|
nameInContext=[self nameInContext:context];
|
||||||
|
|
||||||
fileNameFormValueName = [NSString stringWithFormat:@"%@.filename", nameInContext];
|
fileNameFormValueName = [NSString stringWithFormat:@"%@.filename", nameInContext];
|
||||||
mimeValueName = [NSString stringWithFormat:@"%@.%@",nameInContext, @"content-type"];
|
mimeValueName = [NSString stringWithFormat:@"%@.%@",nameInContext, GSWHTTPHeader_ContentType];
|
||||||
|
|
||||||
fileDatas = [request formValuesForKey:nameInContext];
|
fileDatas = [request formValuesForKey:nameInContext];
|
||||||
|
|
||||||
|
|
|
@ -1639,7 +1639,7 @@ RCS_ID("$Id$")
|
||||||
@"Document is not a GSMimeDocument but a %@:\n%@",
|
@"Document is not a GSMimeDocument but a %@:\n%@",
|
||||||
[aDoc class],aDoc);
|
[aDoc class],aDoc);
|
||||||
aDocContent=[aDoc content];
|
aDocContent=[aDoc content];
|
||||||
contentDispositionHeader=[aDoc headerNamed:@"content-disposition"];
|
contentDispositionHeader=[aDoc headerNamed:GSWHTTPHeader_ContentDisposition];
|
||||||
contentDispositionValue=[contentDispositionHeader value];
|
contentDispositionValue=[contentDispositionHeader value];
|
||||||
contentDispositionParams=[contentDispositionHeader parameters];
|
contentDispositionParams=[contentDispositionHeader parameters];
|
||||||
|
|
||||||
|
@ -1671,7 +1671,7 @@ RCS_ID("$Id$")
|
||||||
|
|
||||||
paramFormValueName = [NSString stringWithFormat:@"%@.%@",formDataName,paramName];
|
paramFormValueName = [NSString stringWithFormat:@"%@.%@",formDataName,paramName];
|
||||||
previous = [formValues objectForKey:paramFormValueName];
|
previous = [formValues objectForKey:paramFormValueName];
|
||||||
typeFormValueName = [NSString stringWithFormat:@"%@.%@",formDataName, @"content-type"];
|
typeFormValueName = [NSString stringWithFormat:@"%@.%@",formDataName, GSWHTTPHeader_ContentType];
|
||||||
prevContentType = [formValues objectForKey:typeFormValueName];
|
prevContentType = [formValues objectForKey:typeFormValueName];
|
||||||
|
|
||||||
contentType = [NSString stringWithFormat:@"%@/%@",
|
contentType = [NSString stringWithFormat:@"%@/%@",
|
||||||
|
|
|
@ -206,7 +206,7 @@ NSLog(@"dateString is %@", dateString);
|
||||||
if (contentType)
|
if (contentType)
|
||||||
{
|
{
|
||||||
[aResponse setHeader:contentType
|
[aResponse setHeader:contentType
|
||||||
forKey:@"Content-Type"];
|
forKey:GSWHTTPHeader_ContentType];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -243,9 +243,9 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
|
||||||
GSWResponse_appendContentString(self, content);
|
GSWResponse_appendContentString(self, content);
|
||||||
[self setStatus:302];
|
[self setStatus:302];
|
||||||
[self setHeader:location
|
[self setHeader:location
|
||||||
forKey:@"Location"];
|
forKey:GSWHTTPHeader_Location];
|
||||||
[self setHeader:@"YES"
|
[self setHeader:@"YES"
|
||||||
forKey:@"x-webobjects-refusing-redirection"];
|
forKey:GSWHTTPHeader_RefusingRedirection[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -293,8 +293,8 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
|
||||||
// it does not make sense to compress data less than 150 bytes.
|
// it does not make sense to compress data less than 150 bytes.
|
||||||
if ((dataLength > 150) && ([self _browserSupportsCompression:[aContext request]]))
|
if ((dataLength > 150) && ([self _browserSupportsCompression:[aContext request]]))
|
||||||
{
|
{
|
||||||
NSString* contentType=[self headerForKey:@"Content-Type"];
|
NSString* contentType=[self headerForKey:GSWHTTPHeader_ContentType];
|
||||||
NSString* contentEncoding=[self headerForKey:@"Content-Encoding"];
|
NSString* contentEncoding=[self headerForKey:GSWHTTPHeader_ContentEncoding];
|
||||||
|
|
||||||
if ((contentEncoding) || (!compressableContentTypesCache)) {
|
if ((contentEncoding) || (!compressableContentTypesCache)) {
|
||||||
return;
|
return;
|
||||||
|
@ -322,7 +322,7 @@ void GSWResponse_appendTagAttributeValueEscapingHTMLAttributeValue(GSWResponse*
|
||||||
[self setContent:compressedData];
|
[self setContent:compressedData];
|
||||||
dataLength=[self _contentLength];
|
dataLength=[self _contentLength];
|
||||||
[self setHeader:@"gzip"
|
[self setHeader:@"gzip"
|
||||||
forKey:@"Content-Encoding"];
|
forKey:GSWHTTPHeader_ContentEncoding];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ escapingHTMLAttributeValue:(BOOL)escape
|
||||||
if (httpVersion)
|
if (httpVersion)
|
||||||
[aResponse setHTTPVersion:httpVersion];
|
[aResponse setHTTPVersion:httpVersion];
|
||||||
[aResponse setHeader:@"text/html"
|
[aResponse setHeader:@"text/html"
|
||||||
forKey:@"Content-Type"];
|
forKey:GSWHTTPHeader_ContentType];
|
||||||
[aContext _setResponse:aResponse];
|
[aContext _setResponse:aResponse];
|
||||||
responseString=[NSString stringWithFormat:@"<HTML>\n<TITLE>GNUstepWeb Error</TITLE>\n</HEAD>\n<BODY bgcolor=\"white\">\n<CENTER>\n%@\n</CENTER>\n</BODY>\n</HTML>\n",
|
responseString=[NSString stringWithFormat:@"<HTML>\n<TITLE>GNUstepWeb Error</TITLE>\n</HEAD>\n<BODY bgcolor=\"white\">\n<CENTER>\n%@\n</CENTER>\n</BODY>\n</HTML>\n",
|
||||||
GSWResponse_stringByEscapingHTMLString(aResponse,aMessage)];
|
GSWResponse_stringByEscapingHTMLString(aResponse,aMessage)];
|
||||||
|
@ -544,18 +544,18 @@ escapingHTMLAttributeValue:(BOOL)escape
|
||||||
GSWResponse_appendContentString(self,message);
|
GSWResponse_appendContentString(self,message);
|
||||||
|
|
||||||
[self setHeader:GSWIntToNSString([[self content] length])
|
[self setHeader:GSWIntToNSString([[self content] length])
|
||||||
forKey:@"content-length"];
|
forKey:GSWHTTPHeader_ContentLength];
|
||||||
};
|
};
|
||||||
if (isDefinitive)
|
if (isDefinitive)
|
||||||
[self setStatus:301]; // redirect definitive !
|
[self setStatus:301]; // redirect definitive !
|
||||||
else
|
else
|
||||||
[self setStatus:302]; // redirect temporary !
|
[self setStatus:302]; // redirect temporary !
|
||||||
[self setHeader:location
|
[self setHeader:location
|
||||||
forKey:@"Location"];
|
forKey:GSWHTTPHeader_Location];
|
||||||
[self setHeader:@"text/html"
|
[self setHeader:@"text/html"
|
||||||
forKey:@"Content-Type"];
|
forKey:GSWHTTPHeader_ContentType];
|
||||||
[self setHeader:@"YES"
|
[self setHeader:@"YES"
|
||||||
forKey:@"x-gsweb-refusing-redirection"];
|
forKey:GSWHTTPHeader_RefusingRedirection[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
|
@ -224,10 +224,10 @@ static Class NSStringClass = Nil;
|
||||||
else
|
else
|
||||||
[response setContent:data];
|
[response setContent:data];
|
||||||
[response setHeader:GSWIntToNSString((int)[data length])
|
[response setHeader:GSWIntToNSString((int)[data length])
|
||||||
forKey:@"Content-Length"];
|
forKey:GSWHTTPHeader_ContentLength];
|
||||||
|
|
||||||
[response setHeader:_mimeType
|
[response setHeader:_mimeType
|
||||||
forKey:@"Content-Type"];
|
forKey:GSWHTTPHeader_ContentType];
|
||||||
};
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue