From simon at josefsson.org Thu Nov 10 19:29:23 2022 From: simon at josefsson.org (Simon Josefsson) Date: Thu, 10 Nov 2022 19:29:23 +0100 Subject: [gnutls-help] guile-gnutls-3.7.10 released [stable] Message-ID: Guile-GnuTLS provides Guile bindings for the GnuTLS library. Project homepage: https://gitlab.com/gnutls/guile The release is available here: https://gitlab.com/gnutls/guile/-/releases/v3.7.10 Documentation: https://gnutls.gitlab.io/guile/manual/ https://gnutls.gitlab.io/guile/manual/gnutls-guile.pdf Here are the compressed sources and a GPG detached signature: https://gitlab.com/gnutls/guile/uploads/2cd9acdf9944191c55048a3b0116f5cf/guile-gnutls-3.7.10.tar.gz https://gitlab.com/gnutls/guile/uploads/8eab68830f9064ba6e98bc22bd2ad719/guile-gnutls-3.7.10.tar.gz.sig Here are the SHA1 and SHA256 checksums: 4b5ca1917e112d8c50301a14f206bca53e844743 guile-gnutls-3.7.10.tar.gz EprRR1JqmFYkQkwuT0dw8fVtYVG8Ku712LD8Vr6oRd4 guile-gnutls-3.7.10.tar.gz The SHA256 checksum is base64 encoded, instead of the hexadecimal encoding that most checksum tools default to. Use a .sig file to verify that the corresponding file (without the .sig suffix) is intact. First, be sure to download both the .sig file and the corresponding tarball. Then, run a command like this: gpg --verify guile-gnutls-3.7.10.tar.gz.sig The signature should match the fingerprint of the following key: pub ed25519 2019-03-20 [SC] B1D2 BD13 75BE CB78 4CF4 F8C4 D73C F638 C53C 06BE uid Simon Josefsson If that command fails because you don't have the required public key, or that public key has expired, try the following commands to retrieve or refresh it, and then rerun the 'gpg --verify' command. gpg --locate-external-key simon at josefsson.org gpg --recv-keys 51722B08FE4745A2 wget -q -O- 'https://savannah.gnu.org/project/release-gpgkeys.php?group=guile-gnutls&download=1' | gpg --import - As a last resort to find the key, you can try the official GNU keyring: wget -q https://ftp.gnu.org/gnu/gnu-keyring.gpg gpg --keyring gnu-keyring.gpg --verify guile-gnutls-3.7.10.tar.gz.sig This release was bootstrapped with the following tools: Autoconf 2.71 Automake 1.16.5 Gnulib v0.1-5551-g1db9041826 Makeinfo 7.0 NEWS * Noteworthy changes in release 3.7.10 (2022-11-10) [stable] ** Gnulib is used to improve code-reuse and maintainability. Closes: #1. ** Build fixes wrt static libraries and GNUTLS_CFLAGS. Happy hacking, Simon -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 255 bytes Desc: not available URL: From simon at josefsson.org Thu Nov 10 19:39:42 2022 From: simon at josefsson.org (Simon Josefsson) Date: Thu, 10 Nov 2022 19:39:42 +0100 Subject: [gnutls-help] Guile-Gnutls bindings to separate git repo? In-Reply-To: <871qr5bnhk.fsf@latte.josefsson.org> (Simon Josefsson's message of "Tue, 18 Oct 2022 09:27:19 +0200") References: <87tu4kx83j.fsf@latte.josefsson.org> <87pmf7tps5.fsf@gnu.org> <87lepuxusj.fsf@latte.josefsson.org> <87wn9cc72l.fsf@gnu.org> <2fafa63d919fc8d7b21518e26a4e24939593f9a6.camel@josefsson.org> <87h70fal2b.fsf@gnu.org> <875ygsjfo9.fsf@latte.josefsson.org> <87k0582ex0.fsf@gnu.org> <87v8oqieqt.fsf@latte.josefsson.org> <878rliwtrq.fsf@latte.josefsson.org> <87a65uquyv.fsf@gnu.org> <871qr5bnhk.fsf@latte.josefsson.org> Message-ID: Simon Josefsson writes: > Would you like to make a new release? Hi Ludovic, I pushed out 3.7.10 to improve maintainer rules a bit. Would you like to make a 3.7.11 shortly? To test the release process and get your OpenPGP key into distributions' keyring. I'm hoping the process is just 1) clone repository, 2) ./bootstrap, 3) follow README-release. /Simon -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 255 bytes Desc: not available URL: From udhayakumar at fatpipeinc.com Fri Nov 18 05:15:51 2022 From: udhayakumar at fatpipeinc.com (udhayakumar) Date: Fri, 18 Nov 2022 09:45:51 +0530 Subject: [gnutls-help] ]Fwd: Data transfer - Sending Receiving buffer In-Reply-To: <992795f4-e568-8d90-005d-38c83617cb06@fatpipeinc.com> References: <992795f4-e568-8d90-005d-38c83617cb06@fatpipeinc.com> Message-ID: <2d9a335e-0c92-ed13-3d10-f199ad7a8de2@fatpipeinc.com> Hi team, ??? ??? ??? i have Faced issue on? Data transfer on buffers.? just like proxy . in Both end create and? establish the Connection. while Data transferring website has? Loading? infinity.? but i Got content partially. can any one help this! i copied code here can any one help , or suggestion from the Data transfer both end. --------------------------------------------------------------------------------------------------------------------------------- int handle_epollin(tproxy_conn_t *conn) { ??????? int numbytes,i; ??????? int fd_in, fd_out, ret; ??????? char *data_buf; ??????? void *buff = malloc(80 * MEBYTE); ??????? void *sndbuff = malloc(2 * MEBYTE); ??????? const char *method, *path; ??????? int pret, minor_version; ??????? struct phr_header headers[100]; ??????? size_t buflen = 0, prevbuflen = 0,method_len, path_len, num_headers; ??????? unsigned int server_session = 0; ??????? //Easy way to determin which socket is ready for reading ??????? //TODO: Optimize. This one allows me quick lookup for conn, but ??????? //I need to make a system call to determin which socket ??????? //FILE *stream; ??????? size_t bufferd_size = gnutls_record_check_pending(conn -> serv_session); ??????? if(bufferd_size) ??????????????? log_trace("data contains on server Record %lu", bufferd_size); ??????? else ??????????????? log_trace("data contains on server Record %lu", bufferd_size); ??????? bufferd_size = gnutls_record_check_pending(conn -> cli_session); ??????? if(bufferd_size) ??????????????? log_trace("data contains on client Record %lu", bufferd_size); ??????? else ??????????????? log_trace("data contains on client Record %lu", bufferd_size); ??????? if(ioctl(conn->local_fd, FIONREAD, &numbytes) != -1 ??????????????????????? && numbytes > 0){ ??????????????? server_session = 1; ??????????????? log_trace("IN:[Server Socket is READY for Reading]"); ??????????????? fd_in = conn->local_fd; ??????????????? fd_out = conn->remote_fd; ??????? } else { ??????????????? server_session = 0; ??????????????? log_trace("IN:[client Socket is READY for Reading(origin server)]"); ??????????????? fd_in = conn->remote_fd; ??????????????? fd_out = conn->local_fd; ??????? } ??????? //Optimize with SPLICE_F_MORE later ??????? /*numbytes = splice(fd_in, NULL, conn->splice_pipe[1], NULL, ????????? SPLICE_LEN, SPLICE_F_MOVE);*/ ??????? log_trace("Hostname : %s", conn -> hostname); ??????? int direction = gnutls_record_get_direction(conn -> serv_session); ??????? if(direction) ??????????????? log_trace("[gnutls serv write Data Direction ]"); ??????? else ??????????????? log_trace("[gnutls serv read Data Direction is "); ??????? direction = gnutls_record_get_direction(conn -> cli_session); ??????? if(direction) ??????????????? log_trace("[origin Client write Data Direction ]"); ??????? else ??? ?log_trace("[origin Client write Data Direction ]"); ??????? if(server_session) { ??????????????? log_trace("check : Entering Server Session"); ??????????????? memset(buff,'\0', MAX_BUF); ??????????????? LOOP_CHECK(ret, gnutls_record_recv(conn -> serv_session, buff , MAX_BUF)); ??????????????? if (ret == 0) { ??????????????????????? log_error("\n- Peer has closed the GnuTLS connection"); ??????????????? } else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) { ??????????????????????? log_error( "*** Warning: %s\n",gnutls_strerror(ret)); ??????????????? } else if (ret < 0) { ??????????????????????? log_error("\n*** Received corrupted " ??????????????????????????????????????? "data(%d). Closing the connection.\n", ret); ??????????????????????? return -1; ??????????????? } else if (ret > 0) { ??????????????? if(read_done == false) { ??????????????????????? read_done = true; ??????????????????????? numbytes = ret; ??????????????????????? prevbuflen = buflen; ??????????????????????? buflen += ret; ??????????????????????? num_headers = sizeof(headers) / sizeof(headers[0]); ??????????????????????? pret = phr_parse_request(buff, buflen, &method, &method_len, &path, &path_len, ??????????????????????????????????????? &minor_version, headers, &num_headers, prevbuflen); ??????????????????????? if (pret > 0) ??????????????????????????????? log_trace("parsering success"); /* successfully parsed the request */ ??????????????????????? else if (pret == -1) { ??????????????????????????????? log_error("PArse the Request incompleted!"); ??????????????????????????????? //TODO: expermental? Need to receive again by check checking tls records ??????????????????????????????? return 0; /* request is incomplete, continue the loop */ ??????????????????????? } ??????????????????????? if(pret == -2); ??????????????????????? if (buflen == sizeof(buff)){ ??????????????????????????????? log_error(" Error: To long the Buffer Failed to Parse the Request"); ??????????????????????????????? return 0; ??????????????????????? } ??????????????????????? log_debug("request is %d bytes long", pret); ??????????????????????? log_debug("**method is %.*s", (int)method_len, method); ??????????????????????? log_debug("**path is %.*s", (int)path_len, path); ??????????????????????? log_debug("**HTTP version is 1.%d", minor_version); ??????????????????????? log_debug("**headers:"); ??????????????????????? for (i = 0; i != num_headers; ++i) { ??????????????????????????????? log_debug("**%.*s: %.*s", (int)headers[i].name_len, headers[i].name, (int)headers[i].value_len, headers[i].value); ??????????????????????? } ??????????????????????? //"GET / HTTP/1.1\r\nHost:www.google.org\r\n\r\n" ??????????????????????? memset(sndbuff,'\0', MAX_BUF); ??????????????????????? //sprintf(sndbuff,"%s %s HTTP/1.%d\r\nHost:%s\r\n\n",method,path,minor_version,conn -> hostname); ??????????????????????? sprintf(sndbuff,"%s %s HTTP/1.%d\r\nHost:%s\r\n\n","GET","/",1,conn -> hostname); ??????????????????????? log_debug(" ---- Sndbuff contains:%s-----",(char *)sndbuff); ??????????????????????? /*if(numbytes > 0){ ????????????????????????? numbytes = splice(conn->splice_pipe[0], NULL, fd_out, NULL, ????????????????????????? numbytes, SPLICE_F_MOVE);*/ ??????????????????????? //numbytes = splice_all(conn -> pipes[0], bp, SPLICE_LEN); ??????????????????????? log_debug("IN: Handle EPOLL IN inside client session"); ??????????????????????? LOOP_CHECK(ret, gnutls_record_send(conn -> cli_session, sndbuff, strlen(buff))); ??????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? } ??????????????????????? else { ??????????????????????????????? LOOP_CHECK(ret, gnutls_record_send(conn -> cli_session, buff, strlen(buff))); ??????????????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? } ??????????????? } ??????????????? } else { ??????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? LOOP_CHECK(ret, gnutls_record_recv(conn -> cli_session, buff , MAX_BUF)); ??????????????????????? if (ret == 0) { ??????????????????????????????? log_debug("\n- Peer has closed the GnuTLS connection"); ??????????????????????? } else if (ret < 0 ??????????????????????????????????????? && gnutls_error_is_fatal(ret) == 0) { ??????????????????????????????? log_error("*** Warning: %s", gnutls_strerror(ret)); ??????????????????????? } else if (ret < 0) { ??????????????????????????????? log_error("\n*** Received corrupted " ??????????????????????????????????????????????? "data(%d). Closing the connection.\n", ret); ??????????????????????????????? return -1; ??????????????????????? } else if (ret > 0) { ??????????????????????????????? numbytes = ret; ??????????????????????????????? /*if(numbytes > 0){ ????????????????????????????????? numbytes = splice(conn->splice_pipe[0], NULL, fd_out, NULL, ????????????????????????????????? numbytes, SPLICE_F_MOVE);*/ ??????????????????????? LOOP_CHECK(ret, gnutls_record_send(conn -> serv_session, buff, strlen(buff))); ??????????????????????? //ret = gnutls_record_send(conn -> serv_session, buff, strlen(buff)); ??????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? if (ret == 0) { ??????????????????????????????? log_debug("\n- Peer has closed the GnuTLS connection"); ??????????????????????? } else if (ret < 0 ??????????????????????????????????????? && gnutls_error_is_fatal(ret) == 0) { ??????????????????????????????? log_error("*** Warning: %s\n", gnutls_strerror(ret)); ??????????????????????? } else if (ret < 0) { ??????????????????????????????? log_error("*** Received corrupted " ??????????????????????????????????????????????? "data(%d). Closing the connection.\n", ret); ??????????????????????????????? return -1; ??????????????????????? } ??????????????? } ??????? } ??????? return numbytes; ??????? free(buff); } -- Thanks, udhayakumar -------------- next part -------------- An HTML attachment was scrubbed... URL: From udhayakumar at fatpipeinc.com Fri Nov 18 05:24:41 2022 From: udhayakumar at fatpipeinc.com (udhayakumar) Date: Fri, 18 Nov 2022 09:54:41 +0530 Subject: [gnutls-help] Data transfer - Sending Receiving buffer In-Reply-To: <2d9a335e-0c92-ed13-3d10-f199ad7a8de2@fatpipeinc.com> References: <2d9a335e-0c92-ed13-3d10-f199ad7a8de2@fatpipeinc.com> Message-ID: Hi team, ??? ??? ??? i have Faced issue on? Data transfer on buffers.? just like proxy . in Both end create and? establish the Connection. while Data transferring website has? Loading? infinity.? but i Got content partially. can any one help this! i copied code here can any one help , or suggestion from the Data transfer both end. --------------------------------------------------------------------------------------------------------------------------------- int handle_epollin(tproxy_conn_t *conn) { ??????? int numbytes,i; ??????? int fd_in, fd_out, ret; ??????? char *data_buf; ??????? void *buff = malloc(80 * MEBYTE); ??????? void *sndbuff = malloc(2 * MEBYTE); ??????? const char *method, *path; ??????? int pret, minor_version; ??????? struct phr_header headers[100]; ??????? size_t buflen = 0, prevbuflen = 0,method_len, path_len, num_headers; ??????? unsigned int server_session = 0; ??????? //Easy way to determin which socket is ready for reading ??????? //TODO: Optimize. This one allows me quick lookup for conn, but ??????? //I need to make a system call to determin which socket ??????? //FILE *stream; ??????? size_t bufferd_size = gnutls_record_check_pending(conn -> serv_session); ??????? if(bufferd_size) ??????????????? log_trace("data contains on server Record %lu", bufferd_size); ??????? else ??????????????? log_trace("data contains on server Record %lu", bufferd_size); ??????? bufferd_size = gnutls_record_check_pending(conn -> cli_session); ??????? if(bufferd_size) ??????????????? log_trace("data contains on client Record %lu", bufferd_size); ??????? else ??????????????? log_trace("data contains on client Record %lu", bufferd_size); ??????? if(ioctl(conn->local_fd, FIONREAD, &numbytes) != -1 ??????????????????????? && numbytes > 0){ ??????????????? server_session = 1; ??????????????? log_trace("IN:[Server Socket is READY for Reading]"); ??????????????? fd_in = conn->local_fd; ??????????????? fd_out = conn->remote_fd; ??????? } else { ??????????????? server_session = 0; ??????????????? log_trace("IN:[client Socket is READY for Reading(origin server)]"); ??????????????? fd_in = conn->remote_fd; ??????????????? fd_out = conn->local_fd; ??????? } ??????? //Optimize with SPLICE_F_MORE later ??????? /*numbytes = splice(fd_in, NULL, conn->splice_pipe[1], NULL, ????????? SPLICE_LEN, SPLICE_F_MOVE);*/ ??????? log_trace("Hostname : %s", conn -> hostname); ??????? int direction = gnutls_record_get_direction(conn -> serv_session); ??????? if(direction) ??????????????? log_trace("[gnutls serv write Data Direction ]"); ??????? else ??????????????? log_trace("[gnutls serv read Data Direction is "); ??????? direction = gnutls_record_get_direction(conn -> cli_session); ??????? if(direction) ??????????????? log_trace("[origin Client write Data Direction ]"); ??????? else ??? ?log_trace("[origin Client write Data Direction ]"); ??????? if(server_session) { ??????????????? log_trace("check : Entering Server Session"); ??????????????? memset(buff,'\0', MAX_BUF); ??????????????? LOOP_CHECK(ret, gnutls_record_recv(conn -> serv_session, buff , MAX_BUF)); ??????????????? if (ret == 0) { ??????????????????????? log_error("\n- Peer has closed the GnuTLS connection"); ??????????????? } else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) { ??????????????????????? log_error( "*** Warning: %s\n",gnutls_strerror(ret)); ??????????????? } else if (ret < 0) { ??????????????????????? log_error("\n*** Received corrupted " ??????????????????????????????????????? "data(%d). Closing the connection.\n", ret); ??????????????????????? return -1; ??????????????? } else if (ret > 0) { ??????????????? if(read_done == false) { ??????????????????????? read_done = true; ??????????????????????? numbytes = ret; ??????????????????????? prevbuflen = buflen; ??????????????????????? buflen += ret; ??????????????????????? num_headers = sizeof(headers) / sizeof(headers[0]); ??????????????????????? pret = phr_parse_request(buff, buflen, &method, &method_len, &path, &path_len, ??????????????????????????????????????? &minor_version, headers, &num_headers, prevbuflen); ??????????????????????? if (pret > 0) ??????????????????????????????? log_trace("parsering success"); /* successfully parsed the request */ ??????????????????????? else if (pret == -1) { ??????????????????????????????? log_error("PArse the Request incompleted!"); ??????????????????????????????? //TODO: expermental? Need to receive again by check checking tls records ??????????????????????????????? return 0; /* request is incomplete, continue the loop */ ??????????????????????? } ??????????????????????? if(pret == -2); ??????????????????????? if (buflen == sizeof(buff)){ ??????????????????????????????? log_error(" Error: To long the Buffer Failed to Parse the Request"); ??????????????????????????????? return 0; ??????????????????????? } ??????????????????????? log_debug("request is %d bytes long", pret); ??????????????????????? log_debug("**method is %.*s", (int)method_len, method); ??????????????????????? log_debug("**path is %.*s", (int)path_len, path); ??????????????????????? log_debug("**HTTP version is 1.%d", minor_version); ??????????????????????? log_debug("**headers:"); ??????????????????????? for (i = 0; i != num_headers; ++i) { ??????????????????????????????? log_debug("**%.*s: %.*s", (int)headers[i].name_len, headers[i].name, (int)headers[i].value_len, headers[i].value); ??????????????????????? } ??????????????????????? //"GET / HTTP/1.1\r\nHost:www.google.org\r\n\r\n" ??????????????????????? memset(sndbuff,'\0', MAX_BUF); ??????????????????????? //sprintf(sndbuff,"%s %s HTTP/1.%d\r\nHost:%s\r\n\n",method,path,minor_version,conn -> hostname); ??????????????????????? sprintf(sndbuff,"%s %s HTTP/1.%d\r\nHost:%s\r\n\n","GET","/",1,conn -> hostname); ??????????????????????? log_debug(" ---- Sndbuff contains:%s-----",(char *)sndbuff); ??????????????????????? /*if(numbytes > 0){ ????????????????????????? numbytes = splice(conn->splice_pipe[0], NULL, fd_out, NULL, ????????????????????????? numbytes, SPLICE_F_MOVE);*/ ??????????????????????? //numbytes = splice_all(conn -> pipes[0], bp, SPLICE_LEN); ??????????????????????? log_debug("IN: Handle EPOLL IN inside client session"); ??????????????????????? LOOP_CHECK(ret, gnutls_record_send(conn -> cli_session, sndbuff, strlen(buff))); ??????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? } ??????????????????????? else { ??????????????????????????????? LOOP_CHECK(ret, gnutls_record_send(conn -> cli_session, buff, strlen(buff))); ??????????????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? } ??????????????? } ??????????????? } else { ??????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? LOOP_CHECK(ret, gnutls_record_recv(conn -> cli_session, buff , MAX_BUF)); ??????????????????????? if (ret == 0) { ??????????????????????????????? log_debug("\n- Peer has closed the GnuTLS connection"); ??????????????????????? } else if (ret < 0 ??????????????????????????????????????? && gnutls_error_is_fatal(ret) == 0) { ??????????????????????????????? log_error("*** Warning: %s", gnutls_strerror(ret)); ??????????????????????? } else if (ret < 0) { ??????????????????????????????? log_error("\n*** Received corrupted " ??????????????????????????????????????????????? "data(%d). Closing the connection.\n", ret); ??????????????????????????????? return -1; ??????????????????????? } else if (ret > 0) { ??????????????????????????????? numbytes = ret; ??????????????????????????????? /*if(numbytes > 0){ ????????????????????????????????? numbytes = splice(conn->splice_pipe[0], NULL, fd_out, NULL, ????????????????????????????????? numbytes, SPLICE_F_MOVE);*/ ??????????????????????? LOOP_CHECK(ret, gnutls_record_send(conn -> serv_session, buff, strlen(buff))); ??????????????????????? //ret = gnutls_record_send(conn -> serv_session, buff, strlen(buff)); ??????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? if (ret == 0) { ??????????????????????????????? log_debug("\n- Peer has closed the GnuTLS connection"); ??????????????????????? } else if (ret < 0 ??????????????????????????????????????? && gnutls_error_is_fatal(ret) == 0) { ??????????????????????????????? log_error("*** Warning: %s\n", gnutls_strerror(ret)); ??????????????????????? } else if (ret < 0) { ??????????????????????????????? log_error("*** Received corrupted " ??????????????????????????????????????????????? "data(%d). Closing the connection.\n", ret); ??????????????????????????????? return -1; ??????????????????????? } ??????????????? } ??????? } ??????? return numbytes; ??????? free(buff); } -- Thanks, udhayakumar -------------- next part -------------- An HTML attachment was scrubbed... URL: From udhayakumar at fatpipeinc.com Fri Nov 18 05:09:11 2022 From: udhayakumar at fatpipeinc.com (udhayakumar) Date: Fri, 18 Nov 2022 09:39:11 +0530 Subject: [gnutls-help] Data transfer : Sending Receiving buffer Message-ID: <992795f4-e568-8d90-005d-38c83617cb06@fatpipeinc.com> Hi team, ??? ??? ??? i have Faced issue on? Data transfer on buffers.? just like proxy . in Both end create and? establish the Connection. while Data transferring website has? Loading? infinity.? but i Got content partially. can any one help this! i copied code here can any one help , or suggestion from the Data transfer both end. --------------------------------------------------------------------------------------------------------------------------------- int handle_epollin(tproxy_conn_t *conn) { ??????? int numbytes,i; ??????? int fd_in, fd_out, ret; ??????? char *data_buf; ??????? void *buff = malloc(80 * MEBYTE); ??????? void *sndbuff = malloc(2 * MEBYTE); ??????? const char *method, *path; ??????? int pret, minor_version; ??????? struct phr_header headers[100]; ??????? size_t buflen = 0, prevbuflen = 0,method_len, path_len, num_headers; ??????? unsigned int server_session = 0; ??????? //Easy way to determin which socket is ready for reading ??????? //TODO: Optimize. This one allows me quick lookup for conn, but ??????? //I need to make a system call to determin which socket ??????? //FILE *stream; ??????? size_t bufferd_size = gnutls_record_check_pending(conn -> serv_session); ??????? if(bufferd_size) ??????????????? log_trace("data contains on server Record %lu", bufferd_size); ??????? else ??????????????? log_trace("data contains on server Record %lu", bufferd_size); ??????? bufferd_size = gnutls_record_check_pending(conn -> cli_session); ??????? if(bufferd_size) ??????????????? log_trace("data contains on client Record %lu", bufferd_size); ??????? else ??????????????? log_trace("data contains on client Record %lu", bufferd_size); ??????? if(ioctl(conn->local_fd, FIONREAD, &numbytes) != -1 ??????????????????????? && numbytes > 0){ ??????????????? server_session = 1; ??????????????? log_trace("IN:[Server Socket is READY for Reading]"); ??????????????? fd_in = conn->local_fd; ??????????????? fd_out = conn->remote_fd; ??????? } else { ??????????????? server_session = 0; ??????????????? log_trace("IN:[client Socket is READY for Reading(origin server)]"); ??????????????? fd_in = conn->remote_fd; ??????????????? fd_out = conn->local_fd; ??????? } ??????? //Optimize with SPLICE_F_MORE later ??????? /*numbytes = splice(fd_in, NULL, conn->splice_pipe[1], NULL, ????????? SPLICE_LEN, SPLICE_F_MOVE);*/ ??????? log_trace("Hostname : %s", conn -> hostname); ??????? int direction = gnutls_record_get_direction(conn -> serv_session); ??????? if(direction) ??????????????? log_trace("[gnutls serv write Data Direction ]"); ??????? else ??????????????? log_trace("[gnutls serv read Data Direction is "); ??????? direction = gnutls_record_get_direction(conn -> cli_session); ??????? if(direction) ??????????????? log_trace("[origin Client write Data Direction ]"); ??????? else ??? ?log_trace("[origin Client write Data Direction ]"); ??????? if(server_session) { ??????????????? log_trace("check : Entering Server Session"); ??????????????? memset(buff,'\0', MAX_BUF); ??????????????? LOOP_CHECK(ret, gnutls_record_recv(conn -> serv_session, buff , MAX_BUF)); ??????????????? if (ret == 0) { ??????????????????????? log_error("\n- Peer has closed the GnuTLS connection"); ??????????????? } else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) { ??????????????????????? log_error( "*** Warning: %s\n",gnutls_strerror(ret)); ??????????????? } else if (ret < 0) { ??????????????????????? log_error("\n*** Received corrupted " ??????????????????????????????????????? "data(%d). Closing the connection.\n", ret); ??????????????????????? return -1; ??????????????? } else if (ret > 0) { ??????????????? if(read_done == false) { ??????????????????????? read_done = true; ??????????????????????? numbytes = ret; ??????????????????????? prevbuflen = buflen; ??????????????????????? buflen += ret; ??????????????????????? num_headers = sizeof(headers) / sizeof(headers[0]); ??????????????????????? pret = phr_parse_request(buff, buflen, &method, &method_len, &path, &path_len, ??????????????????????????????????????? &minor_version, headers, &num_headers, prevbuflen); ??????????????????????? if (pret > 0) ??????????????????????????????? log_trace("parsering success"); /* successfully parsed the request */ ??????????????????????? else if (pret == -1) { ??????????????????????????????? log_error("PArse the Request incompleted!"); ??????????????????????????????? //TODO: expermental? Need to receive again by check checking tls records ??????????????????????????????? return 0; /* request is incomplete, continue the loop */ ??????????????????????? } ??????????????????????? if(pret == -2); ??????????????????????? if (buflen == sizeof(buff)){ ??????????????????????????????? log_error(" Error: To long the Buffer Failed to Parse the Request"); ??????????????????????????????? return 0; ??????????????????????? } ??????????????????????? log_debug("request is %d bytes long", pret); ??????????????????????? log_debug("**method is %.*s", (int)method_len, method); ??????????????????????? log_debug("**path is %.*s", (int)path_len, path); ??????????????????????? log_debug("**HTTP version is 1.%d", minor_version); ??????????????????????? log_debug("**headers:"); ??????????????????????? for (i = 0; i != num_headers; ++i) { ??????????????????????????????? log_debug("**%.*s: %.*s", (int)headers[i].name_len, headers[i].name, (int)headers[i].value_len, headers[i].value); ??????????????????????? } ??????????????????????? //"GET / HTTP/1.1\r\nHost:www.google.org\r\n\r\n" ??????????????????????? memset(sndbuff,'\0', MAX_BUF); ??????????????????????? //sprintf(sndbuff,"%s %s HTTP/1.%d\r\nHost:%s\r\n\n",method,path,minor_version,conn -> hostname); ??????????????????????? sprintf(sndbuff,"%s %s HTTP/1.%d\r\nHost:%s\r\n\n","GET","/",1,conn -> hostname); ??????????????????????? log_debug(" ---- Sndbuff contains:%s-----",(char *)sndbuff); ??????????????????????? /*if(numbytes > 0){ ????????????????????????? numbytes = splice(conn->splice_pipe[0], NULL, fd_out, NULL, ????????????????????????? numbytes, SPLICE_F_MOVE);*/ ??????????????????????? //numbytes = splice_all(conn -> pipes[0], bp, SPLICE_LEN); ??????????????????????? log_debug("IN: Handle EPOLL IN inside client session"); ??????????????????????? LOOP_CHECK(ret, gnutls_record_send(conn -> cli_session, sndbuff, strlen(buff))); ??????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? } ??????????????????????? else { ??????????????????????????????? LOOP_CHECK(ret, gnutls_record_send(conn -> cli_session, buff, strlen(buff))); ??????????????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? } ??????????????? } ??????????????? } else { ??????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? LOOP_CHECK(ret, gnutls_record_recv(conn -> cli_session, buff , MAX_BUF)); ??????????????????????? if (ret == 0) { ??????????????????????????????? log_debug("\n- Peer has closed the GnuTLS connection"); ??????????????????????? } else if (ret < 0 ??????????????????????????????????????? && gnutls_error_is_fatal(ret) == 0) { ??????????????????????????????? log_error("*** Warning: %s", gnutls_strerror(ret)); ??????????????????????? } else if (ret < 0) { ??????????????????????????????? log_error("\n*** Received corrupted " ??????????????????????????????????????????????? "data(%d). Closing the connection.\n", ret); ??????????????????????????????? return -1; ??????????????????????? } else if (ret > 0) { ??????????????????????????????? numbytes = ret; ??????????????????????????????? /*if(numbytes > 0){ ????????????????????????????????? numbytes = splice(conn->splice_pipe[0], NULL, fd_out, NULL, ????????????????????????????????? numbytes, SPLICE_F_MOVE);*/ ??????????????????????? LOOP_CHECK(ret, gnutls_record_send(conn -> serv_session, buff, strlen(buff))); ??????????????????????? //ret = gnutls_record_send(conn -> serv_session, buff, strlen(buff)); ??????????????????????? memset(buff,'\0', MAX_BUF); ??????????????????????? if (ret == 0) { ??????????????????????????????? log_debug("\n- Peer has closed the GnuTLS connection"); ??????????????????????? } else if (ret < 0 ??????????????????????????????????????? && gnutls_error_is_fatal(ret) == 0) { ??????????????????????????????? log_error("*** Warning: %s\n", gnutls_strerror(ret)); ??????????????????????? } else if (ret < 0) { ??????????????????????????????? log_error("*** Received corrupted " ??????????????????????????????????????????????? "data(%d). Closing the connection.\n", ret); ??????????????????????????????? return -1; ??????????????????????? } ??????????????? } ??????? } ??????? return numbytes; ??????? free(buff); } -- Thanks, udhayakumar -------------- next part -------------- An HTML attachment was scrubbed... URL: