Buggy code:
public void addHeader ( Header rh ) { } public void setHeaders ( String s ) { } public void addParam ( Parameter rp ) { } public void setDebug ( int d ) { } public void setRequestLine ( String s ) { } public String getRequestLine ( ) { } public void setFullRequest ( String s ) { } public String getFullRequest ( ) { } public void addVerbose ( Body b ) { } public void addText ( String s ) { } public void execute ( ) { } boolean prepared = false ; static String CRLF = "\r\n" ; public void prepareRequest ( ) { if ( prepared ) return ; if ( ( host ) == null ) host = HttpRequest . defaultHost ; if ( ( port ) == ( - 1 ) ) port = HttpRequest . defaultPort ; if ( ( protocol ) == null ) protocol = HttpRequest . defaultProtocol ; prepared = true ; if ( ( id ) == null ) { id = "Req" + ( HttpRequest . getId ( ) ) ; } HttpRequest . registerHttpRequest ( id , this ) ; if ( ( fullRequest ) != null ) return ; StringBuffer sb = new StringBuffer ( ) ; if ( ( requestLine ) != null ) sb . append ( requestLine ) ; else { sb . append ( method ) . append ( "<seq2seq4repair_space>" ) . append ( path ) ; boolean first = true ; for ( int i = 0 ; i < ( paramsV . size ( ) ) ; i ++ ) { Parameter p = ( ( Parameter ) ( paramsV . elementAt ( i ) ) ) ; if ( "GET" . equals ( p . getType ( method ) ) ) { if ( first && ( ( path . indexOf ( "?" ) ) < 0 ) ) { sb . append ( "?" ) ; first = false ; } else { sb . append ( "&" ) ; } sb . append ( p . getName ( ) ) ; sb . append ( "=" ) ; String v = p . getValue ( ) ; if ( v != null ) sb . append ( v ) ; } } sb . append ( "<seq2seq4repair_space>" ) . append ( "HTTP//1.0" ) ; requestLine = sb . toString ( ) ; } sb . append ( HttpRequest . CRLF ) ; if ( ( requestLine . indexOf ( "HTTP//1." ) ) < 0 ) { fullRequest = sb . toString ( ) ; return ; } String contentL = null ; String hostHeader = null ; String contentType = null ; String authorization = null ; Enumeration headersE = headerVector . elements ( ) ; while ( headersE . hasMoreElements ( ) ) { Header h = ( ( Header ) ( headersE . nextElement ( ) ) ) ; sb . append ( h . getName ( ) ) . append ( ":<seq2seq4repair_space>" ) ; sb . append ( h . getValue ( ) ) . append ( HttpRequest . CRLF ) ; if ( "Content-Type" . equals ( h . getName ( ) ) ) contentType = h . getValue ( ) ; if ( "Content-Length" . equals ( h . getName ( ) ) ) contentL = h . getValue ( ) ; if ( "Host" . equals ( h . getName ( ) ) ) hostHeader = h . getValue ( ) ; if ( "Authorization" . equals ( h . getName ( ) ) ) authorization = h . getValue ( ) ; } if ( ( ( hostHeader == null ) && ( ( host ) != null ) ) && ( ! ( "" . equals ( host ) ) ) ) { <START_BUG> sb . append ( "Host:<seq2seq4repair_space>" ) . append ( host ) . append ( HttpRequest . CRLF ) ; <END_BUG> } if ( ( ( body ) == null ) && ( "POST" . equals ( method ) ) ) { StringBuffer bodySB = new StringBuffer ( ) ; boolean first = true ; for ( int i = 0 ; i < ( paramsV . size ( ) ) ; i ++ ) { Parameter p = ( ( Parameter ) ( paramsV . elementAt ( i ) ) ) ; if ( "POST" . equals ( p . getType ( "POST" ) ) ) { if ( ! first ) { bodySB . append ( "&" ) ; } first = false ; bodySB . append ( p . getName ( ) ) ; bodySB . append ( "=" ) ; String v = p . getValue ( ) ; if ( v != null ) bodySB . append ( v ) ; } } if ( ! first ) { if ( contentType == null ) { sb . append ( "Content-Type:<seq2seq4repair_space>" ) ; sb . append ( "application//x-www-form-urlencoded" ) ; sb . append ( HttpRequest . CRLF ) ; } body = new Body ( bodySB . toString ( ) ) ; } } if ( ( ( authorization == null ) && ( ( user ) != null ) ) && ( ( password ) != null ) ) { sb . append ( "Authorization:<seq2seq4repair_space>Basic<seq2seq4repair_space>" ) ; String token = ( ( user ) + ":" ) + ( password ) ; sb . append ( java . util . Base64 . encode ( token . getBytes ( ) ) ) ; sb . append ( HttpRequest . CRLF ) ; } if ( ( body ) != null ) { if ( contentL == null ) { sb . append ( "Content-Length:<seq2seq4repair_space>" ) . append ( body . getBody ( ) . length ( ) ) ; sb . append ( HttpRequest . CRLF ) . append ( HttpRequest . CRLF ) ; }

Fix:
sb . append ( "Host:<seq2seq4repair_space>" ) . append ( host ) . append ( ':' ) . append ( port ) . append ( HttpRequest . CRLF ) ;