~tritone-team/tritone/eucalyptus

« back to all changes in this revision

Viewing changes to clc/modules/wsstack/src/main/java/com/eucalyptus/ws/handlers/http/NioSslHandler.java

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland, Dustin Kirkland
  • Date: 2009-12-01 21:09:28 UTC
  • mfrom: (1.1.23 upstream)
  • Revision ID: james.westby@ubuntu.com-20091201210928-frch6ej464vfn58y
Tags: 1.6.1~bzr1083-0ubuntu1
[ Dustin Kirkland ]
* Merge upstream bzr revision 1082; the following bugs have been fixed
  upstream since the last merge:
  - LP: #378969 - private bug
  - LP: #404842 - init script fix
  - LP: #434283 - existing keys should be overwritten unconditionally
  - LP: #445990 - run instance will fail if no kernel or ramdisk specified
  - LP: #447457 - euca_conf --register-sc ... check the number of parameters
  - LP: #449874 - fix incorrect help text (--delete-nodes doesn't exist)
  - LP: #451795 - show registered images in elastic fox
  - LP: #454405 - return correct networkIndex values on describeInstances
  - LP: #456877 - init script fix
  - LP: #456878 - fix for libvirt xen driver
  - LP: #460085 - fix rampart memory leak
  - LP: #461156 - fix authentication problem w/ userdata
  - LP: #461394 - fix multiple concurrent snapshots on the same volume
  - LP: #461444 - fix memory leaks in NC getConsoleOutput and startup_thread
  - LP: #469984 - fix iptables rules issue
  - LP: #477776 - fix query string authentication
  - LP: #480783 - allow api connection over https
  - LP: #482249 - fix "Describe Regions"
  - LP: #484217 - create keypair should return an error if key exists
  - LP: #490623 - parse RFC 1123 formatted datetime
* debian/control:
  - make all package lists one-per-line (makes changes henceforth more
    readable), sort lists
  - depend on rampart >= 1.3.0-0ubuntu6, which fixes some shared library
    installation issues
* debian/patches/04-axis2c-1.6.0-rampart-1.3.0.patch: drop this patch,
  since Eucalyptus 1.6.1 natively supports axis2c 1.6.0 now
* debian/eucalyptus-cloud.install,
  debian/eucalyptus-common.eucalyptus.upstart,
  debian/eucalyptus-java-common.install, debian/eucalyptus-sc.install,
  debian/eucalyptus-walrus.install: update static version number strings
  from "1.6-devel" to "1.6.1"; (we should really find a better way to do
  this)
* debian/patches/03-DESTDIR.patch: ported forward for merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
package com.eucalyptus.ws.handlers.http;
2
2
 
3
 
import javax.net.ssl.SSLEngine;
4
 
import javax.net.ssl.SSLException;
 
3
import java.util.concurrent.atomic.AtomicBoolean;
5
4
 
6
5
import org.jboss.netty.buffer.ChannelBuffer;
7
 
import org.jboss.netty.channel.Channel;
8
6
import org.jboss.netty.channel.ChannelEvent;
9
 
import org.jboss.netty.channel.ChannelFuture;
10
7
import org.jboss.netty.channel.ChannelHandlerContext;
11
 
import org.jboss.netty.channel.ChannelStateEvent;
12
 
import org.jboss.netty.channel.ExceptionEvent;
 
8
import org.jboss.netty.channel.ChannelPipelineCoverage;
13
9
import org.jboss.netty.channel.MessageEvent;
14
10
import org.jboss.netty.handler.ssl.SslHandler;
15
11
 
 
12
import com.eucalyptus.auth.util.SslSetup;
 
13
import com.eucalyptus.ws.util.HttpUtils;
 
14
 
 
15
@ChannelPipelineCoverage("one")
16
16
public class NioSslHandler extends SslHandler {
17
 
 
18
 
  public NioSslHandler( SSLEngine engine ) {
19
 
    super( engine );
20
 
  }
21
 
 
22
 
  @Override
23
 
  public void channelBound( ChannelHandlerContext ctx, ChannelStateEvent e ) throws Exception {
24
 
    super.channelBound( ctx, e );
25
 
  }
26
 
 
27
 
  @Override
28
 
  public void channelOpen( ChannelHandlerContext ctx, ChannelStateEvent e ) throws Exception {
29
 
    super.channelOpen( ctx, e );
30
 
  }
31
 
 
 
17
  private AtomicBoolean first = new AtomicBoolean( true );
 
18
  
 
19
  public NioSslHandler( ) {
 
20
    super( SslSetup.getServerEngine( ) );
 
21
  }
 
22
    
32
23
  @Override
33
24
  public void handleUpstream( ChannelHandlerContext ctx, ChannelEvent e ) throws Exception {
34
 
    if( e instanceof MessageEvent ) {
35
 
      Object o = ((MessageEvent) e).getMessage( );      
36
 
      if( ! (o instanceof ChannelBuffer ) ) {
37
 
        ctx.getPipeline( ).removeFirst( );//this should be me.
38
 
        ctx.sendUpstream(e);
39
 
        return;
40
 
      } else { //we punt on HTTP and only delegate SSL.
41
 
      }
 
25
    Object o = null;
 
26
    if ( e instanceof MessageEvent
 
27
        && first.compareAndSet( true, false )
 
28
        && ( o = ( ( MessageEvent ) e ).getMessage( ) ) instanceof ChannelBuffer 
 
29
        && !HttpUtils.maybeSsl( ( ChannelBuffer ) o ) ) {
 
30
      ctx.getPipeline( ).removeFirst( );
 
31
      ctx.sendUpstream( e );
 
32
    } else {
 
33
      super.handleUpstream( ctx, e );
42
34
    }
43
 
    super.handleUpstream( ctx, e );
44
35
  }
45
 
 
46
 
 
 
36
  
47
37
}