You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Günter Knauf <ef...@gmx.net> on 2004/02/02 01:10:21 UTC

Re: [PATCH] ./native2/common/jk_channel_apr_socket.c - use apr_port_t instead of short for port

Hi,
> This would also allow closing of Bug 17579 since the recent changeover to
> APR for mod_jk2 (now using jk_channel_apr_socket.c)
thanks for the pointer! Showed that my recent patch was incomplete...; so next try:

http://www.gknw.com/test/jk_channel_apr_socket.c.diff
==========================================================================
# Patch to solve http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17579
#
--- ./jk/native2/common/jk_channel_apr_socket.c.orig    Thu Jan 29 18:23:28 2004
+++ ./jk/native2/common/jk_channel_apr_socket.c         Mon Feb 02 00:49:56 2004
@@ -74,9 +74,9 @@
  */
 struct jk_channel_apr_private {
     int ndelay;
+    apr_port_t port;
     apr_sockaddr_t *addr;
     char *host;
-    short port;
     int keepalive;
     int timeout;
 };
@@ -92,7 +92,7 @@
 */
 
 static int JK_METHOD jk2_channel_apr_resolve(jk_env_t *env, char *host,
-                                                short port,
+                                                apr_port_t port,
                                                 jk_channel_apr_private_t *rc);
 
 static int JK_METHOD jk2_channel_apr_close(jk_env_t *env, jk_channel_t *_this,
@@ -168,7 +168,7 @@
     jk_channel_apr_private_t *socketInfo=
         (jk_channel_apr_private_t *)(ch->_privatePtr);
     int rc;
-    short port=socketInfo->port;
+    apr_port_t port=socketInfo->port;
 
     if( socketInfo->host==NULL ) {
         char *localName=ch->mbean->localName;
@@ -227,7 +227,7 @@
 /** private: resolve the address on init
  */
 static int JK_METHOD jk2_channel_apr_resolve(jk_env_t *env,
-                                             char *host, short port,
+                                             char *host, apr_port_t port,
                                              jk_channel_apr_private_t *rc)
 {
     int err;


Guenter.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [PATCH] ./native2/common/jk_channel_apr_socket.c - use apr_port_t instead of short for port

Posted by Günter Knauf <ef...@gmx.net>.
Hi Henri,
>> Do you know what's about the ./native2/common/jk_channel_socket.c file?
>> Does soemone still use it since APR is now mandatory, or can we remove
>> it?
>>If it stays then we should also patch the port there to 'unsigned
>>short'...

> Yes, it should be removed but the conservative approach will be to
> have a patch for unsigned short
here we go:
http://www.gknw.com/test/jk_channel_socket.c.diff
========================================================================
# Patch to solve http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17579
#
--- ./jk/native2/common/jk_channel_socket.c.origThu Jan 29 18:23:28 2004
+++ ./jk/native2/common/jk_channel_socket.cMon Feb 02 18:19:28 2004
@@ -100,7 +100,7 @@
     int ndelay;
     struct sockaddr_in addr;    
     char *host;
-    short port; /* Should be unsigned - big ports will fail */
+    unsigned short port;
     int keepalive;
     int timeout;
 };
@@ -116,7 +116,7 @@
 */
 
 static int JK_METHOD jk2_channel_socket_resolve(jk_env_t *env, char *host,
-                                               short port,
+                                               unsigned short port,
                                                struct sockaddr_in *rc);
 
 static int JK_METHOD jk2_channel_socket_close(jk_env_t *env, jk_channel_t *ch,
@@ -276,7 +276,8 @@
 
 /** private: resolve the address on init
  */
-static int JK_METHOD jk2_channel_socket_resolve(jk_env_t *env, char *host, short port,
+static int JK_METHOD jk2_channel_socket_resolve(jk_env_t *env, char *host, 
+                                               unsigned short port,
                                                struct sockaddr_in *rc)
 {
     int x;
@@ -285,7 +286,7 @@
     /* for now use the correct type, in_addr_t   */    
 in_addr_t laddr;
     
-    rc->sin_port   = htons((short)port);
+    rc->sin_port   = htons((unsigned short)port);
     rc->sin_family = AF_INET;
 
     /* Check if we only have digits in the string */

Guenter.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [PATCH] ./native2/common/jk_channel_apr_socket.c - use apr_port_t instead of short for port

Posted by Henri Gomez <hg...@apache.org>.
Günter Knauf a écrit :

>>Commited, thanks
> 
> thanks, Henri!
> 
> Do you know what's about the ./native2/common/jk_channel_socket.c file? Does soemone still use it since APR is now mandatory, or can we remove it? 
>If it stays then we should also patch the port there to 'unsigned short'...

Yes, it should be removed but the conservative approach will be to
have a patch for unsigned short

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Download servlet with resume

Posted by Tim Funk <fu...@joedog.org>.
Please follow up with tomcat-user since this is a user topic.

What you'll want to look at is utilizing the Byte-Range header. it is a 
standard way for a client to get only part of a request. DefaultServlet has 
support for this so if you need some example code, look there.

-Tim

Patrik Andersson wrote:

> Hi all!
> 
> I have been trying to find information on how to make a java-servlet for
> download of content from the Tomcat-server without success.
> The content differs from images, mp3's etc etc and I need the servlet in
> order to do some database-stuff. The content also differs very much in size
> and I need some way to be able to resume the download on big files as some
> of the clients communicating with the servlet are mobile phone useing GPRS,
> and as this is not the fastest communication and it might loose connection
> during download.
> 
> Therefore I'll ask you if anyone has any information, links, samples etc to
> help me with this.....
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Download servlet with resume

Posted by Patrik Andersson <pa...@tactel.se>.
Hi all!

I have been trying to find information on how to make a java-servlet for
download of content from the Tomcat-server without success.
The content differs from images, mp3's etc etc and I need the servlet in
order to do some database-stuff. The content also differs very much in size
and I need some way to be able to resume the download on big files as some
of the clients communicating with the servlet are mobile phone useing GPRS,
and as this is not the fastest communication and it might loose connection
during download.

Therefore I'll ask you if anyone has any information, links, samples etc to
help me with this.....

Regards
Patrik



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [PATCH] ./native2/common/jk_channel_apr_socket.c - use apr_port_t instead of short for port

Posted by Günter Knauf <ef...@gmx.net>.
> Commited, thanks
thanks, Henri!

Do you know what's about the ./native2/common/jk_channel_socket.c file? Does soemone still use it since APR is now mandatory, or can we remove it? If it stays then we should also patch the port there to 'unsigned short'...

Guenter.




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [PATCH] ./native2/common/jk_channel_apr_socket.c - use apr_port_t instead of short for port

Posted by Henri Gomez <hg...@apache.org>.
Commited, thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org