You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by "Sivadoss, Pradosh" <pr...@logicacmg.com> on 2006/11/03 17:43:58 UTC
RE: Apache doesnt close connection with the client
Connection: close
In the HTTP request header, will take care of it.
-----Original Message-----
From: amol tambe [mailto:amol_ideas@yahoo.com]
Sent: Friday, November 03, 2006 8:56 AM
To: modules-dev@httpd.apache.org
Subject: Apache doesnt close connection with the client
Hello,
I am trying to write a protocol module for Apache which will encrypt
data and send to-from Apache. (I can not use mod_SSL for some reasons).
My module code builds and loads fine.
After the module is loaded, when I send a simple GET request to my
Apache server as follows
https://localhost/cgi-bin/hello_name.exe?name=Rhino
I get the expected output from my CGI at the client but then my client
hangs waiting for more response/data from the server.
Since this is a protocol module, it directly reads from socket and
writes to the socket. The functions that read and write to a socket
respectively are
SSCryptoRead() and SSCryptoWrite(). After I read the data using
SSCryptoRead, I insert it into the buckets so that is passed to my
content generator which is the CGI (hello_name.exe) as shown in the URL
above. Then in the output filters, I grab the generated data and encrypt
and send it back to the client using function SSCryptoWrite.
I doubt if my problem could be related to not inserting and EOS bucket.
But I am not sure if I am supposed to enter an EOS bucket or Apache
would do it for me.
I am also not sure if I need so set something like KEEP-ALIVE or CLOSE
in my request or response. Since my code is much like SSL, I tried
looking up the SSL code but I could not find anything of help. Can
anyone point me to what might be missing here? Are there any special
steps to be taken while writing a protocol module?
An extract of my module code is pasted below...
module AP_MODULE_DECLARE_DATA ss_module = {
STANDARD20_MODULE_STUFF,
NULL,
NULL,
ss_config_server_create,
NULL,
ss_config_cmds,
ss_register_hooks
};
static void ss_register_hooks (apr_pool_t *p) {
ap_register_input_filter (ss_io_filter, ss_io_filter_input,
NULL, AP_FTYPE_CONNECTION + 5);
ap_register_output_filter (ss_io_filter, ss_io_filter_output,
NULL, AP_FTYPE_CONNECTION + 5);
ap_hook_post_config (ss_init_Module,
NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_pre_connection
(ss_hook_pre_connection,NULL,NULL, APR_HOOK_MIDDLE); }
static apr_status_t ss_io_filter_input(ap_filter_t *f,
apr_bucket_brigade *bb, ap_input_mode_t mode, apr_read_type_e block,
apr_off_t readbytes) {
.
.
.
len =
SSSecureRead(inctx->filter_ctx->session_ctx->session,
buf, &len);
if (len > 0) {
apr_bucket *bucket =
apr_bucket_transient_create(inctx->buffer, len,
f->c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, bucket);
}
return APR_SUCCESS;
}
static apr_status_t ss_io_filter_output(ap_filter_t *f,
apr_bucket_brigade *bb) {
.
.
.
while (!APR_BRIGADE_EMPTY(bb)) {
apr_bucket *bucket = APR_BRIGADE_FIRST(bb);
if (APR_BUCKET_IS_EOS(bucket) ||
APR_BUCKET_IS_FLUSH(bucket)) {
if (ss_filter_out_flush(filter_ctx->pWriteptr) <
0)
status = outctx->rc;
break;
}
else if (AP_BUCKET_IS_EOC(bucket)) {
if ((status = ap_pass_brigade(f->next, bb)) !=
APR_SUCCESS)
return status;
break;
}
else {
const char *data;
apr_size_t len;
/*Read the data from the buckets and write it to
the socket*/
status = apr_bucket_read(bucket, &data, &len,
rblock);
res =
SSCryptoWrite(filter_ctx->session_ctx->session, data, len);
}
}
return APR_SUCCESS;
}
Any suggestions/pointers would be highly appreciated.
Thanks,
Amol
________________________________________________________________________
____________
Get your email and see which of your friends are online - Right on the
New Yahoo.com
(http://www.yahoo.com/preview)
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
RE: Apache doesnt close connection with the client
Posted by Amol Tambe <am...@symantec.com>.
Hi
Thanks for this info. But I am not sure, where in the server I set
"Connection: close". Is there an APP to do this? And what would be the
deciding criteria to conclude that I want to call "Connection: close"?
Thanks in advance for your help.
Amol
-----Original Message-----
From: Sivadoss, Pradosh [mailto:pradosh.sivadoss@logicacmg.com]
Sent: Friday, November 03, 2006 10:14 PM
To: modules-dev@httpd.apache.org
Subject: RE: Apache doesnt close connection with the client
Connection: close
In the HTTP request header, will take care of it.
-----Original Message-----
From: amol tambe [mailto:amol_ideas@yahoo.com]
Sent: Friday, November 03, 2006 8:56 AM
To: modules-dev@httpd.apache.org
Subject: Apache doesnt close connection with the client
Hello,
I am trying to write a protocol module for Apache which will encrypt
data and send to-from Apache. (I can not use mod_SSL for some reasons).
My module code builds and loads fine.
After the module is loaded, when I send a simple GET request to my
Apache server as follows
https://localhost/cgi-bin/hello_name.exe?name=Rhino
I get the expected output from my CGI at the client but then my client
hangs waiting for more response/data from the server.
Since this is a protocol module, it directly reads from socket and
writes to the socket. The functions that read and write to a socket
respectively are
SSCryptoRead() and SSCryptoWrite(). After I read the data using
SSCryptoRead, I insert it into the buckets so that is passed to my
content generator which is the CGI (hello_name.exe) as shown in the URL
above. Then in the output filters, I grab the generated data and encrypt
and send it back to the client using function SSCryptoWrite.
I doubt if my problem could be related to not inserting and EOS bucket.
But I am not sure if I am supposed to enter an EOS bucket or Apache
would do it for me.
I am also not sure if I need so set something like KEEP-ALIVE or CLOSE
in my request or response. Since my code is much like SSL, I tried
looking up the SSL code but I could not find anything of help. Can
anyone point me to what might be missing here? Are there any special
steps to be taken while writing a protocol module?
An extract of my module code is pasted below...
module AP_MODULE_DECLARE_DATA ss_module = {
STANDARD20_MODULE_STUFF,
NULL,
NULL,
ss_config_server_create,
NULL,
ss_config_cmds,
ss_register_hooks
};
static void ss_register_hooks (apr_pool_t *p) {
ap_register_input_filter (ss_io_filter, ss_io_filter_input,
NULL, AP_FTYPE_CONNECTION + 5);
ap_register_output_filter (ss_io_filter, ss_io_filter_output,
NULL, AP_FTYPE_CONNECTION + 5);
ap_hook_post_config (ss_init_Module,
NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_pre_connection
(ss_hook_pre_connection,NULL,NULL, APR_HOOK_MIDDLE); }
static apr_status_t ss_io_filter_input(ap_filter_t *f,
apr_bucket_brigade *bb, ap_input_mode_t mode, apr_read_type_e block,
apr_off_t readbytes) {
.
.
.
len =
SSSecureRead(inctx->filter_ctx->session_ctx->session,
buf, &len);
if (len > 0) {
apr_bucket *bucket =
apr_bucket_transient_create(inctx->buffer, len,
f->c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, bucket);
}
return APR_SUCCESS;
}
static apr_status_t ss_io_filter_output(ap_filter_t *f,
apr_bucket_brigade *bb) {
.
.
.
while (!APR_BRIGADE_EMPTY(bb)) {
apr_bucket *bucket = APR_BRIGADE_FIRST(bb);
if (APR_BUCKET_IS_EOS(bucket) ||
APR_BUCKET_IS_FLUSH(bucket)) {
if (ss_filter_out_flush(filter_ctx->pWriteptr) <
0)
status = outctx->rc;
break;
}
else if (AP_BUCKET_IS_EOC(bucket)) {
if ((status = ap_pass_brigade(f->next, bb)) !=
APR_SUCCESS)
return status;
break;
}
else {
const char *data;
apr_size_t len;
/*Read the data from the buckets and write it to
the socket*/
status = apr_bucket_read(bucket, &data, &len,
rblock);
res =
SSCryptoWrite(filter_ctx->session_ctx->session, data, len);
}
}
return APR_SUCCESS;
}
Any suggestions/pointers would be highly appreciated.
Thanks,
Amol
________________________________________________________________________
____________
Get your email and see which of your friends are online - Right on the
New Yahoo.com
(http://www.yahoo.com/preview)
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by, any other party. If you are
not an intended recipient then please promptly delete this e-mail and
any attachment and all copies and inform the sender. Thank you.