]> granicus.if.org Git - apache/commitdiff
rfc1413.c fixes:
authorJeff Trawick <trawick@apache.org>
Tue, 9 May 2000 19:29:57 +0000 (19:29 +0000)
committerJeff Trawick <trawick@apache.org>
Tue, 9 May 2000 19:29:57 +0000 (19:29 +0000)
1) we were retrieving our local port before APR filled it in; wait a
   little longer :)
   (maybe APR needs to be a little smarter about when/if to call
   getsockname()?  it could call it when the info is first needed and
   not do it at all if never needed)
2) when the server dropped the connection before sending a properly-
   delimited response, we entered a hard loop; we weren't reacting to
   EOF/FIN properly

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85170 13f79535-47bb-0310-9956-ffa450edef68

server/rfc1413.c

index 8355038c9b1070b8483ace424e3007f0a13b3d13..16f7b4db3f422f17ef09a66f755e885e969a84c7 100644 (file)
@@ -134,7 +134,6 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
                    "bind: rfc1413: Error binding to local port");
        return -1;
     }
-    ap_get_local_port(&sav_our_port, sock);
 
 /*
  * errors from connect usually imply the remote machine doesn't support
@@ -145,6 +144,7 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
                     
     if (ap_connect(sock, NULL) != APR_SUCCESS)
         return -1;
+    ap_get_local_port(&sav_our_port, sock);
     ap_get_remote_port(&sav_rmt_port, sock);
 
 /* send the data */
@@ -194,6 +194,10 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
        else if (j > 0) {
            i+=j; 
        }
+        else if (status == APR_SUCCESS && j == 0) {
+            /* Oops... we ran out of data before finding newline */
+            return -1;
+        }
     }
 
 /* RFC1413_USERLEN = 512 */