CPPSERV


Home Projects Jobs Clientele Contact

cppserv


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cppserv patch



On Fri, 2008-03-21 at 11:11 +0200, Ilya A. Volynets-Evenbakh wrote:
> Can you test attached patch on your pure apr-1.x system?

I applied the patch to a fresh copy of 0.1.105 and things worked
perfectly.  Thanks.  

--matt



> plain text document attachment (apr-1.x.diff)
> diff --git a/env-tests/env-test-custom.mk b/env-tests/env-test-custom.mk
> index 724ef22..a488bdd 100644
> --- a/env-tests/env-test-custom.mk
> +++ b/env-tests/env-test-custom.mk
> @@ -10,7 +10,7 @@ $(eval $(call cxx_flag_kirpich,-Wredundant-decls))
>  #$(eval $(call cxx_flag_kirpich,-pedantic))
>  endif
>  $(eval $(call prog_kirpich,APXS,apxs2 apxs /usr/sbin/apxs2 /usr/sbin/apxs /usr/local/bin/apxs2 /usr/local/bin/apxs,0))
> -$(eval $(call prog_kirpich,APRCFG,apr-config /usr/bin/apr-config /usr/local/bin/apr-config,0))
> +$(eval $(call prog_kirpich,APRCFG,apr-1-config apr-config /usr/bin/apr-1-config /usr/bin/apr-config /usr/local/bin/apr-config,0))
>  $(eval $(call sptk_kirpich))
>  $(eval $(call sptk_namespace_kirpich))
>  #####################################################
> diff --git a/src/mod_cppserv/mod_cserv.cpp b/src/mod_cppserv/mod_cserv.cpp
> index 6afe0c8..0090f2a 100644
> --- a/src/mod_cppserv/mod_cserv.cpp
> +++ b/src/mod_cppserv/mod_cserv.cpp
> @@ -37,10 +37,16 @@ extern "C" {
>  #include "apr_strings.h"
>  #include "apr_network_io.h"
>  #include "apr_portable.h"
> +#include "apr_version.h"
>  
>  #include <sys/un.h>
>  }
>  
> +// Ugly compatibility layer
> +#if (APR_MAJOR_VERSION==0)
> +#define apr_socket_create apr_socket_create_ex
> +#endif
> +
>  #define CSERV_BUF_SZ 1024
>  #define PORT 9004
>  //Pre-declare module
> @@ -89,7 +95,7 @@ static int connectServer(request_rec *r,apr_socket_t** con)
>  			    host, dconf->port, strerror(errno));
>  			return HTTP_SERVICE_UNAVAILABLE;
>  		}
> -		if((ret=apr_socket_create(&sock,APR_INET,SOCK_STREAM,p))!=APR_SUCCESS) {
> +		if((ret=apr_socket_create(&sock,APR_INET,SOCK_STREAM,APR_PROTO_TCP,p))!=APR_SUCCESS) {
>  			ap_log_rerror(APLOG_MARK,APLOG_ERR,APR_SUCCESS,r,
>  			    "Cannot connect to CPPSERV (%s:%d): %s",
>  			    host, dconf->port, strerror(errno));
> @@ -153,12 +159,14 @@ static void discard_script_output(apr_bucket_brigade *bb)
>      const char *buf;
>      apr_size_t len;
>      apr_status_t rv;
> -    APR_BRIGADE_FOREACH(e, bb) {
> +    for (e = APR_BRIGADE_FIRST(bb);
> +         e != APR_BRIGADE_SENTINEL(bb);
> +         e = APR_BUCKET_NEXT(e)) {
>          if (APR_BUCKET_IS_EOS(e)) {
>              break;
>          }
>          rv = apr_bucket_read(e, &buf, &len, APR_BLOCK_READ);
> -        if (!APR_STATUS_IS_SUCCESS(rv)) {
> +        if (APR_SUCCESS == rv) {
>              break;
>          }
>      }
> @@ -299,7 +307,9 @@ static int cserv_handler(request_rec *r)
>  		rv = ap_get_brigade(r->input_filters,bb,AP_MODE_READBYTES,APR_BLOCK_READ,HUGE_STRING_LEN);
>  		if(rv!=APR_SUCCESS)
>  			return rv;
> -		APR_BRIGADE_FOREACH(bucket,bb){
> +		for (bucket = APR_BRIGADE_FIRST(bb);
> +			bucket != APR_BRIGADE_SENTINEL(bb);
> +			bucket = APR_BUCKET_NEXT(bucket)) {
>  			const char* data;
>  			apr_size_t len;
>  			if(APR_BUCKET_IS_EOS(bucket)){


Authoright © Total Knowledge: 2001-2008