module AP_MODULE_DECLARE_DATA proxy_fdpass_module;
+#define MOP_DEBUG 0
+
static int proxy_fdpass_canon(request_rec *r, char *url)
{
const char *path;
- {
+ if (MOP_DEBUG == 1) {
int mop_fd;
char mop_bf[512];
- mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT);
+ mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, 0644);
sprintf(mop_bf, "proxy_http_canon: start\n");
write(mop_fd, mop_bf, strlen(mop_bf));
close(mop_fd);
char b = '\0', *buf;
ANCIL_FD_BUFFER(2) ancil_buf;
- {
+ if (MOP_DEBUG == 1) {
int mop_fd;
char mop_bf[512];
- mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
+ mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, 0644);
sprintf(mop_bf, "send_socket: start\n");
write(mop_fd, mop_bf, strlen(mop_bf));
close(mop_fd);
-
}
rv = apr_os_sock_get(&rawsock, outbound);
return rv;
}
- {
+ if (MOP_DEBUG == 1) {
int mop_fd;
char mop_bf[512];
- mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
+ mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, 0644);
write(mop_fd, "XX", 2);
write(mop_fd, &srawsock, sizeof(apr_os_sock_t));
write(mop_fd, "XX", 2);
close(mop_fd);
-
}
memset(&msg, 0, sizeof(msg));
rv = sendmsg(srawsock, &msg, 0);
- {
+ if (MOP_DEBUG == 1) {
int mop_fd;
char mop_bf[512];
- mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
+ mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, 0644);
sprintf(mop_bf, "SENT BYTES: %d\n", rv);
write(mop_fd, mop_bf, strlen(mop_bf));
close(mop_fd);
-
}
if (rv == -1) {
int rsize, len_read, rpos=0;
long length = r->remaining;
*rbuf = (char *)apr_pcalloc(r->pool, length +1);
-
while ((len_read = ap_get_client_block(r, argsbuffer,
sizeof(argsbuffer))) > 0) {
if ((rpos + len_read) > length) {
int read_post(request_rec *r, const char **data)
{
const char *type;
+ char *p, s_type[256];
int rc = OK;
+ s_type[255] = '\0';
+ if (MOP_DEBUG == 1) {
+ int mop_fd;
+ char mop_bf[512];
+
+ mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, 0644);
+ sprintf(mop_bf, "read_post: start: numb: %d %d head_in: [%s]\n", r->method_number, M_POST, apr_table_get(r->headers_in, "Content-Type"));
+ write(mop_fd, mop_bf, strlen(mop_bf));
+ close(mop_fd);
+ }
+
+
if (r->method_number != M_POST) {
return rc;
}
type = apr_table_get(r->headers_in, "Content-Type");
- if (strcasecmp(type, DEFAULT_ENCTYPE) != 0) {
+ strncpy(s_type, type, 255);
+ if (p = strchr(s_type, ';')) {
+ *p = '\0';
+ }
+ if (strcasecmp(s_type, DEFAULT_ENCTYPE) != 0) {
return DECLINED;
}
return rc;
}
+ if (MOP_DEBUG == 1) {
+ int mop_fd;
+ char mop_bf[512];
+
+ mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, 0644);
+ sprintf(mop_bf, "read_post: finish\n");
+ write(mop_fd, mop_bf, strlen(mop_bf));
+ close(mop_fd);
+ }
+
return OK;
}
}
read_post(r, &post_data);
- {
+ if (MOP_DEBUG == 1) {
int mop_fd;
char mop_bf[512];
- mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
+ mop_fd = open("/tmp/apache_mop.log", O_WRONLY | O_APPEND | O_CREAT, 0644);
sprintf(mop_bf, "proxy_fdpass_handler: start\n");
write(mop_fd, mop_bf, strlen(mop_bf));
write(mop_fd, headers_out, strlen(headers_out));
close(mop_fd);
-
}
/* create a couple of sockets and pass one to the client for headers and so on */
if (socketpair(AF_UNIX, SOCK_STREAM, 0, ctrlrawsock)) {