Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support big responses for Apache 2 adaptor #633

Merged
merged 5 commits into from
Apr 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Utilities/Adaptors/Adaptor/appcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ static char *_retrieveServerInfo(ConfigServer *server, net_fd s, int *len, char
}
tr_close(c, AC_INVALID_HANDLE, 0);
if (resp != NULL) {
*len = resp->content_length;
*len = (int) resp->content_length;
*content_type = '\0';
if (resp->status == HTTP_OK) {
/* may be NOT_MODIFIED (or worse!) */
Expand Down
2 changes: 1 addition & 1 deletion Utilities/Adaptors/Adaptor/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef int intptr_t;
#define CURRENT_WOF_VERSION_MAJOR 4
#define CURRENT_WOF_VERSION_MINOR 6

#define ADAPTOR_VERSION "4.6.2"
#define ADAPTOR_VERSION "4.6.3"

/* Used to turn the value of a macro into a string literal */
#define _Str(x) #x
Expand Down
10 changes: 5 additions & 5 deletions Utilities/Adaptors/Adaptor/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const char *req_AddHeader_common(HTTPRequest *req,const char *key,const char *va
*/
if ((req->content_length == 0) &&
((strcasecmp(key, CONTENT_LENGTH) == 0) || (strcasecmp(key, "content_length") == 0))) /* get content-length */
req->content_length = atoi(value);
req->content_length = atol(value);

#ifdef DEBUG
WOLog(WO_DBG,"(req-hdr) %s: %s",key, value);
Expand Down Expand Up @@ -263,8 +263,8 @@ int req_sendRequest(HTTPRequest *req, net_fd socket)
/* Note that we reuse buffers, and the existing content-data buffer. */
if (req->content_length > req->content_buffer_size)
{
int total_sent = req->content_buffer_size;
int len_read, amount_to_read;
long total_sent = req->content_buffer_size;
long len_read, amount_to_read;
req->haveReadStreamedData = 1;
while (total_sent < req->content_length)
{
Expand Down Expand Up @@ -362,8 +362,8 @@ int req_sendRequest(HTTPRequest *req, net_fd socket)
/* Note that we reuse buffers, and the existing content-data buffer. */
if (req->content_length > req->content_buffer_size)
{
int total_sent = req->content_buffer_size;
int len_read, amount_to_read;
long total_sent = req->content_buffer_size;
long len_read, amount_to_read;
req->haveReadStreamedData = 1;
while (total_sent < req->content_length && result == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion Utilities/Adaptors/Adaptor/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ typedef struct _HTTPRequest {
char *request_str; /* the http request (includes CRLF) */
void *headers; /* (strtbl *) but you don't need to know */
void *api_handle; /* api specific pointer */
unsigned content_length;
unsigned long content_length;
void *content;
unsigned content_buffer_size;
req_getMoreContentCallback getMoreContent;
Expand Down
10 changes: 5 additions & 5 deletions Utilities/Adaptors/Adaptor/response.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ HTTPResponse *resp_errorResponse(const char *msg, int status)
resp->content = html_msg->text;
resp_addStringToResponse(resp, html_msg);
resp->flags |= RESP_DONT_FREE_CONTENT;
sprintf(buf,"%d",resp->content_length);
sprintf(buf, "%lu", resp->content_length);
st_add(resp->headers, CONTENT_LENGTH, buf, STR_COPYVALUE|STR_FREEVALUE);
return resp;
}
Expand Down Expand Up @@ -174,8 +174,8 @@ void resp_addHeader(HTTPResponse *resp, String *rawhdr)
// 2009/06/10: an explicit content-length value is available.
// Update response flag information:
resp->flags |= RESP_LENGTH_EXPLICIT;
resp->content_length = atoi(value);
WOLog(WO_INFO,"content-length was set expl.: %d", resp->content_length);
resp->content_length = atol(value);
WOLog(WO_INFO, "content-length was set expl.: %lu", resp->content_length);
}

if (((strcasecmp(CONTENT_TYPE,key) == 0) || strcasecmp("content_type", key) == 0))
Expand Down Expand Up @@ -235,7 +235,7 @@ HTTPResponse *resp_getResponseHeaders(WOConnection *instanceConnection, WOInstan
// can be found in the adaptor source code. Therefore, we
// should better use INT_MAX!
resp->content_length = INT_MAX;
WOLog(WO_WARN, "Response doesn't specify a content-length: assuming %u bytes!",
WOLog(WO_WARN, "Response doesn't specify a content-length: assuming %lu bytes!",
resp->content_length);
}
}
Expand All @@ -254,7 +254,7 @@ int resp_getResponseContent(HTTPResponse *resp, int allowStreaming)
{
int ret = 0;
if (resp->content_length) {
int count, amountToRead;
long count, amountToRead;

if (resp->content == NULL)
{
Expand Down
4 changes: 2 additions & 2 deletions Utilities/Adaptors/Adaptor/response.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ typedef struct _HTTPResponse {
/* These Strings get freed along with the response. */
String *responseStrings;
void *content;
unsigned content_length;
unsigned long content_length;
unsigned content_buffer_size;
unsigned content_read; /* total amount of data read from the instance */
unsigned long content_read; /* total amount of data read from the instance */
unsigned content_valid; /* amount of valid data in content buffer */
int (*getMoreContent)(struct _HTTPResponse *resp, void *buffer, int bufferSize);

Expand Down
2 changes: 1 addition & 1 deletion Utilities/Adaptors/Apache2.2/mod_WebObjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static void sendResponse(request_rec *r, HTTPResponse *resp) {
while (resp->content_read < resp->content_length &&
(resp->flags & RESP_LENGTH_INVALID) != RESP_LENGTH_INVALID)
{
int count;
long count;

ap_rwrite(resp->content, resp->content_valid, r);
if (r->connection->aborted) {
Expand Down
2 changes: 1 addition & 1 deletion Utilities/Adaptors/Apache2.4/mod_WebObjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static void sendResponse(request_rec *r, HTTPResponse *resp) {
while (resp->content_read < resp->content_length &&
(resp->flags & RESP_LENGTH_INVALID) != RESP_LENGTH_INVALID)
{
int count;
long count;

ap_rwrite(resp->content, resp->content_valid, r);
if (r->connection->aborted) {
Expand Down
2 changes: 1 addition & 1 deletion Utilities/Adaptors/CGI/WebObjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static void sendResponse(HTTPResponse *resp)
#ifndef PROFILE
/* resp->content_valid will be 0 for HEAD requests and empty responses */
if (resp->content_valid) {
int count;
long count;

while (resp->content_read < resp->content_length &&
(resp->flags & RESP_LENGTH_INVALID) != RESP_LENGTH_INVALID) {
Expand Down
4 changes: 2 additions & 2 deletions Utilities/Adaptors/IIS/WebObjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static void sendResponse(EXTENSION_CONTROL_BLOCK *p, HTTPResponse *resp)

/* resp->content_valid will be 0 for HEAD requests and empty responses */
if (resp->content_valid) {
int count;
long count;
while (resp->content_read < resp->content_length &&
(resp->flags & RESP_LENGTH_INVALID) != RESP_LENGTH_INVALID &&
browserStatus == 0) {
Expand Down Expand Up @@ -567,7 +567,7 @@ static int readContentData(HTTPRequest *req, void *dataBuffer, int dataSize, int
length = (char *)WOMALLOC(32);
if (length)
{
sprintf(length,"%d",req->content_length);
sprintf(length,"%lu",req->content_length);
req_addHeader(req, CONTENT_LENGTH, length, STR_FREEVALUE);
}
if (p->lpszContentType != NULL)
Expand Down