Refactored prepare_path and prepare_query_parameters to avoid the use of URI.pm and...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / HTTP.pm
index b8e50e7..1bc26b1 100644 (file)
@@ -16,9 +16,8 @@ use IO::Select       ();
 require Catalyst::Engine::HTTP::Restarter;
 require Catalyst::Engine::HTTP::Restarter::Watcher;
 
-sub CHUNKSIZE () { 64 * 1024 }
-
-sub DEBUG () { $ENV{CATALYST_HTTP_DEBUG} || 0 }
+use constant CHUNKSIZE => 64 * 1024;
+use constant DEBUG     => $ENV{CATALYST_HTTP_DEBUG} || 0;
 
 =head1 NAME
 
@@ -245,6 +244,12 @@ sub run {
     # Ignore broken pipes as an HTTP server should
     local $SIG{PIPE} = 'IGNORE';
     
+    # Restart on HUP
+    local $SIG{HUP} = sub { 
+        $restart = 1;
+        warn "Restarting server on SIGHUP...\n";
+    };
+    
     LISTEN:
     while ( !$restart ) {
         while ( accept( Remote, $daemon ) ) {        
@@ -511,16 +516,6 @@ sub _socket_data {
 
 sub _inet_addr { unpack "N*", inet_aton( $_[0] ) }
 
-=head1 CONSTANTS
-
-=head2 CHUNKSIZE
-
-How much data to read at once.  This value is set to 64K.
-
-=head2 DEBUG
-
-Enables debugging via the environment variable CATALYST_HTTP_DEBUG.
-
 =head1 SEE ALSO
 
 L<Catalyst>, L<Catalyst::Engine>.