httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Mizrahi <smizr...@v3d.fr>
Subject Re: TCP socket wothout HTTP protocol
Date Thu, 04 Jun 2020 10:19:21 GMT
Another not desired behavior related :

The ap_hook_process_connection is not called until client stops. In the client, the

Seb.
Le 14 avr. 2020 à 19:46 +0200, Sébastien Mizrahi <smizrahi@v3d.fr>, a écrit :
Hey Eric just a feedback to confirm that it just works as expected.
Thanks again !

Client from https://www.geeksforgeeks.org/socket-programming-cc/

Apache module :
int socket_process_connection(conn_rec *req) {
printf(« Conn init\n");
apr_socket_t *asock = ap_get_conn_socket(req);
int fd = 0;
apr_os_sock_get(&fd, asock);
char buffer[1024] = {0};
int valread = read(fd , buffer, 1024);
printf("%s\n", buffer);
return 0;
}

// Apache callback to register our hooks
void register_hooks(apr_pool_t* pool) {
static const char* const mod_ssl_reqtimeout[] = {"mod_ssl.c", "mod_reqtimeout.c", NULL};
ap_hook_process_connection(socket_process_connection, NULL, mod_ssl_reqtimeout, APR_HOOK_REALLY_FIRST);
}

Sebastien.

Le 14 avr. 2020 à 17:40 +0200, Sébastien Mizrahi <smizrahi@v3d.fr>, a écrit :
Thanks a lor Eric !

Gonna read this :)
Le 14 avr. 2020 à 17:20 +0200, Eric Covener <covener@gmail.com>, a écrit :
On Tue, Apr 14, 2020 at 11:16 AM Sébastien Mizrahi <smizrahi@v3d.fr> wrote:

Hi,

For some reasons, I would like to read natively TCP socket in an Apache module. The request
is not encapsulated in HTTP protocol end the client send raw data.
I have already an apache module that manage standard HTTP request and I would like to mutualise
the code.


The test suite has "weird" modules that are not HTTP that you might
have a look at

https://svn.apache.org/repos/asf/httpd/test/framework/trunk

./c-modules/nntp_like/mod_nntp_like.c is what I was thinking of. Just
from seeing it scroll by.

There is also mod_ftp: https://httpd.apache.org/mod_ftp/
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message