text:
package org.json.junit;

import static org.junit.Assert.*;

import java.io.IOException;
import java.io.StringWriter;
import java.util.*;

import org.json.*;
import org.junit.Test;

/**
 * Tests for JSONString implementations, and the difference between
 * {@link JSONObject#valueToString} and {@link JSONObject#writeValue}.
 */
public class JSONStringTest {

    /**
     * This tests the JSONObject.writeValue() method. We can't test directly
     * due to it being a package-protected method. Instead, we can call
     * JSONArray.write(), which delegates the writing of each entry to
     * writeValue().
     */
    @Test
    public void writeValues() throws Exception {
        JSONArray jsonArray = new JSONArray();
        jsonArray.put((Object)null);

        StringWriter writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[null]".equals(output));

            jsonArray = new JSONArray();
            jsonArray.put(JSONObject.NULL);
        } finally {
            writer.close();
        }
        writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[null]".equals(output));

            jsonArray = new JSONArray();
            jsonArray.put(new JSONObject());
        } finally {
            writer.close();
        }
        writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[{}]".equals(output));

            jsonArray = new JSONArray();
            jsonArray.put(new JSONArray());
        } finally {
            writer.close();
        }
        writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[[]]".equals(output));

            jsonArray = new JSONArray();
            Map<?,?> singleMap = Collections.singletonMap("key1", "value1");
            jsonArray.put((Object)singleMap);
        } finally {
            writer.close();
        }
        writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[{\"key1\":\"value1\"}]".equals(output));

            jsonArray = new JSONArray();
            List<?> singleList = Collections.singletonList("entry1");
            jsonArray.put((Object)singleList);
        } finally {
            writer.close();
        }
        writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[[\"entry1\"]]".equals(output));

            jsonArray = new JSONArray();
            int[] intArray = new int[] { 1, 2, 3 };
            jsonArray.put(intArray);
        } finally {
            writer.close();
        }
        writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[[1,2,3]]".equals(output));

            jsonArray = new JSONArray();
            jsonArray.put(24);
        } finally {
            writer.close();
        }
        writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[24]".equals(output));

            jsonArray = new JSONArray();
            jsonArray.put("string value");
        } finally {
            writer.close();
        }
        writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[\"string value\"]".equals(output));

            jsonArray = new JSONArray();
            jsonArray.put(true);
        } finally {
            writer.close();
        }
        writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[true]".equals(output));
        } finally {
            writer.close();
        }

    }

    /**
     * This tests the JSONObject.valueToString() method. These should be
     * identical to the values above, except for the enclosing [ and ].
     */
    @SuppressWarnings("boxing")
    @Test
    public void valuesToString() throws Exception {

        String output = JSONObject.valueToString(null);
        assertTrue("String values should be equal", "null".equals(output));

        output = JSONObject.valueToString(JSONObject.NULL);
        assertTrue("String values should be equal", "null".equals(output));

        output = JSONObject.valueToString(new JSONObject());
        assertTrue("String values should be equal", "{}".equals(output));

        output = JSONObject.valueToString(new JSONArray());
        assertTrue("String values should be equal", "[]".equals(output));

        Map<?,?> singleMap = Collections.singletonMap("key1", "value1");
        output = JSONObject.valueToString(singleMap);
        assertTrue("String values should be equal", "{\"key1\":\"value1\"}".equals(output));

        List<?> singleList = Collections.singletonList("entry1");
        output = JSONObject.valueToString(singleList);
        assertTrue("String values should be equal", "[\"entry1\"]".equals(output));

        int[] intArray = new int[] { 1, 2, 3 };
        output = JSONObject.valueToString(intArray);
        assertTrue("String values should be equal", "[1,2,3]".equals(output));

        output = JSONObject.valueToString(24);
        assertTrue("String values should be equal", "24".equals(output));

        output = JSONObject.valueToString("string value");
        assertTrue("String values should be equal", "\"string value\"".equals(output));

        output = JSONObject.valueToString(true);
        assertTrue("String values should be equal", "true".equals(output));

    }

    /**
     * Test what happens when toJSONString() returns a well-formed JSON value.
     * This is the usual case.
     */
    @Test
    public void testJSONStringValue() throws Exception {
        JSONStringValue jsonString = new JSONStringValue();
        JSONArray jsonArray = new JSONArray();

        jsonArray.put(jsonString);

        StringWriter writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[\"the JSON string value\"]".equals(output));

            output = JSONObject.valueToString(jsonString);
            assertTrue("String values should be equal", "\"the JSON string value\"".equals(output));
        } finally {
            writer.close();
        }
    }

    /**
     * Test what happens when toJSONString() returns null. In one case,
     * use the object's toString() method. In the other, throw a JSONException.
     */
    @Test
    public void testJSONNullStringValue() throws Exception {
        JSONNullStringValue jsonString = new JSONNullStringValue();
        JSONArray jsonArray = new JSONArray();

        jsonArray.put(jsonString);

        StringWriter writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[\"the toString value\"]".equals(output));

            // The only different between writeValue() and valueToString():
            // in this case, valueToString throws a JSONException
            try {
                output = JSONObject.valueToString(jsonString);
                fail("Expected an exception, got a String value");
            } catch (Exception e) {
                assertTrue("Expected JSONException", e instanceof JSONException);
                assertTrue("Exception message does not match", "Bad value from toJSONString: null".equals(e.getMessage()));
            }
        } finally {
            writer.close();
        }
    }

    /**
     * Test what happens when toJSONString() returns an exception. In both
     * cases, a JSONException is thrown, with the cause and message set from
     * the original exception.
     */
    @Test
    public void testJSONStringExceptionValue() throws IOException {
        JSONStringExceptionValue jsonString = new JSONStringExceptionValue();
        JSONArray jsonArray = new JSONArray();

        jsonArray.put(jsonString);

        StringWriter writer = new StringWriter();
        try {
            jsonArray.write(writer).toString();
            fail("Expected an exception, got a String value");
        } catch (JSONException e) {
            assertEquals("Unable to write JSONArray value at index: 0", e.getMessage());
        } catch(Exception e) {
            fail("Expected JSONException");
        } finally {
            writer.close();
        }

        try {
            JSONObject.valueToString(jsonString);
            fail("Expected an exception, got a String value");
        } catch (JSONException e) {
            assertTrue("Exception message does not match", "the exception value".equals(e.getMessage()));
        } catch(Exception e) {
            fail("Expected JSONException");
        }
    }

    /**
     * Test what happens when a Java object's toString() returns a String value.
     * This is the usual case.
     */
    @Test
    public void testStringValue() throws Exception {
        StringValue nonJsonString = new StringValue();
        JSONArray jsonArray = new JSONArray();

        jsonArray.put(nonJsonString);

        StringWriter writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[\"the toString value for StringValue\"]".equals(output));

            output = JSONObject.valueToString(nonJsonString);
            assertTrue("String values should be equal", "\"the toString value for StringValue\"".equals(output));
        } finally {
            writer.close();
        }
    }

    /**
     * Test what happens when a Java object's toString() returns null.
     * Defaults to empty string.
     */
    @Test
    public void testNullStringValue() throws Exception {
        NullStringValue nonJsonString = new NullStringValue();
        JSONArray jsonArray = new JSONArray();

        jsonArray.put(nonJsonString);

        StringWriter writer = new StringWriter();
        try {
            String output = jsonArray.write(writer).toString();
            assertTrue("String values should be equal", "[\"\"]".equals(output));

            output = JSONObject.valueToString(nonJsonString);
            assertTrue("String values should be equal", "\"\"".equals(output));
        } finally {
            writer.close();
        }
    }

    /**
     * A JSONString that returns a valid JSON string value.
     */
    private static final class JSONStringValue implements JSONString {

        @Override
        public String toJSONString() {
            return "\"the JSON string value\"";
        }

        @Override
        public String toString() {
            return "the toString value for JSONStringValue";
        }
    }

    /**
     * A JSONString that returns null when calling toJSONString().
     */
    private static final class JSONNullStringValue implements JSONString {

        @Override
        public String toJSONString() {
            return null;
        }

        @Override
        public String toString() {
            return "the toString value";
        }
    }

    /**
     * A JSONString that throw an exception when calling toJSONString().
     */
    private static final class JSONStringExceptionValue implements JSONString {

        @Override
        public String toJSONString() {
            throw new IllegalStateException("the exception value");
        }

        @Override
        public String toString() {
            return "the toString value for JSONStringExceptionValue";
        }
    }

    public static final class StringValue {

        @Override
        public String toString() {
            return "the toString value for StringValue";
        }
    }

    public static final class NullStringValue {

        @Override
        public String toString() {
            return null;
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
UnixListParser
</TITLE>

<META NAME="date" CONTENT="2012-06-26">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

it.sauronsoftware.ftp4j.listparsers

Class UnixListParser

java.lang.Object
  it.sauronsoftware.ftp4j.listparsers.UnixListParser

All Implemented Interfaces:
FTPListParser

public class UnixListParser
extends java.lang.Object
implements FTPListParser

This parser can handle the result of a list ftp command as it is a UNIX "ls
 -l" command response.

Author:

Carlo Pelliccia

Constructor Summary

UnixListParser()

Method Summary

 FTPFile[]
parse(java.lang.String[] lines)

          Parses a LIST command response and builds an array of FTPFile objects.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

UnixListParser

public UnixListParser()

Method Detail

parse

public FTPFile[] parse(java.lang.String[] lines)
                throws FTPListParseException

Description copied from interface: FTPListParser

Parses a LIST command response and builds an array of FTPFile objects.

Specified by:
parse in interface FTPListParser

Parameters:
lines - The response to parse, splitted by line.

Returns:
An array of FTPFile objects representing the result of the
         operation.

Throws:

FTPListParseException - If this parser cannot parse the given response.

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

redpajama_set_name: RedPajamaGithub


text:
package com.box.l10n.mojito.security;

import com.box.l10n.mojito.entity.security.user.Authority;
import com.box.l10n.mojito.entity.security.user.User;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * `
 *
 * @author wyau
 */
public class UserDetailsImpl implements UserDetails {

  private final User user;
  private final Collection<? extends GrantedAuthority> grantedAuthorities;

  public UserDetailsImpl(User user) {
    this.grantedAuthorities = getGrantedAuthority(user);
    this.user = user;
  }

  /**
   * Get {@link org.springframework.security.core.GrantedAuthority} for a given {@link
   * com.box.l10n.mojito.entity.security.user.User}
   *
   * @param user User to get {@link org.springframework.security.core.GrantedAuthority} for
   * @return The set of {@link org.springframework.security.core.GrantedAuthority} extracted from
   *     the {@link com.box.l10n.mojito.entity.security.user.User}
   */
  protected Set<GrantedAuthority> getGrantedAuthority(User user) {
    Set<Authority> authorities = user.getAuthorities();
    Set<GrantedAuthority> grantedAuthorities = new HashSet<>();

    for (Authority authority : authorities) {
      GrantedAuthority grantedAuthority = new SimpleGrantedAuthority(authority.getAuthority());

      grantedAuthorities.add(grantedAuthority);
    }

    return grantedAuthorities;
  }

  @Override
  public Collection<? extends GrantedAuthority> getAuthorities() {
    return grantedAuthorities;
  }

  @Override
  public String getPassword() {
    return user.getPassword();
  }

  @Override
  public String getUsername() {
    return user.getUsername();
  }

  @Override
  public boolean isAccountNonExpired() {
    return true;
  }

  @Override
  public boolean isAccountNonLocked() {
    return true;
  }

  @Override
  public boolean isCredentialsNonExpired() {
    return true;
  }

  @Override
  public boolean isEnabled() {
    return user.getEnabled();
  }

  public User getUser() {
    return user;
  }
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;

namespace Auxano.Osm.Api
{
    /// <summary>
    /// Holds an array of terms.
    /// </summary>
    public class TermArray
        : IEnumerable<Term>
    {
        private readonly Term current;
        private readonly Section section;
        private readonly ImmutableArray<Term> terms;

        /// <summary>
        /// Initialises a new instance of <see cref="TermArray"/>.
        /// </summary>
        /// <param name="section">The section these terms are for.</param>
        /// <param name="terms">The terms in the array.</param>
        /// <param name="current">The current term.</param>
        public TermArray(Section section, IEnumerable<Term> terms, Term current = null)
        {
            this.section = section;
            this.terms = ImmutableArray.Create(terms.ToArray());
            var today = DateTime.UtcNow.Date;
            this.current = current ??
                (this.terms.Any() ? this.terms.FirstOrDefault(t => (t.StartDate <= today) && (t.EndDate >= today)) : null);
        }

        /// <summary>
        /// The currently active term.
        /// </summary>
        public Term Current
        {
            get { return this.current; }
        }

        /// <summary>
        /// The section these terms are for.
        /// </summary>
        public Section Section
        {
            get { return this.section; }
        }

        /// <summary>
        /// Changes the currently active term.
        /// </summary>
        /// <param name="term">The new active term.</param>
        /// <returns>A new <see cref="TermArray"/> instance.</returns>
        public TermArray ChangeCurrentTerm(Term term)
        {
            return new TermArray(this.section, this.terms, term);
        }

        /// <summary>
        /// Gets the enumerator for iterating through the list of terms.
        /// </summary>
        /// <returns></returns>
        public IEnumerator<Term> GetEnumerator()
        {
            return this.terms
                .AsEnumerable()
                .GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return terms
                .AsQueryable()
                .GetEnumerator();
        }
    }
}


text:
package org.pi.litepost.html;

public class Textarea extends Input {
	Textarea(Validator validator) {
		super("", validator);
		this.closeTag = true;
	}
	public Input prepopulate() {
		if(validator != null && attributes.containsKey("name")) {
			this.content = validator.value(attributes.get("name"));
		}
		return this;
	}
}


text:
'use strict';

var merge = require('merge');
var Input = require('./input');

module.exports = function () {
	return merge.recursive(Input(), {
		data: function data() {
			return {
				fieldType: 'color'
			};
		},
		mounted: function mounted() {
			if (!browserSupportsColorpicker()) {
				var that = this;
				$(this.$el).find("input[type=color]").spectrum({
					color: that.value ? that.value : "#000000",
					change: function change(color) {
						that.$emit('input', color.toHexString());
					}
				});
			}
		}
	});
};

function browserSupportsColorpicker() {
	var colorInput;
	colorInput = $('<input type="color" value="!" />')[0];
	return colorInput.type === 'color' && colorInput.value !== '!';
}


text:
Decaf http API
==============

Decaf provides both a client and server API.  They are distinct/separate.

The http server consists of a Node.js style server:

```javascript
var http = require('http');

http.createServer(function(req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(1337, '127.0.0.1', 5000);
console.log('Server running at http://127.0.0.1:1337/');
```

<br/>You will find useful information in the documentation for the Request and Response objects.

Note that you may end up using Jolt, which is built on top of the http server API.

The http client provides a simple means to do GET or POST requests to remote servers.  The API is
chainable, so you get something that looks like this:

```javascript
var Client = require('http').Client;

debugger;
var client = new Client('http://google.com').get();

// client.responseText contains the HTML retrieved for the URL specified
```


text:
package TestApache::discard_rbody;

# test $r->discard_request_body when the input body wasn't read at
# all, read partially or completely.

use strict;
use warnings FATAL => 'all';

use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Connection ();
use Apache2::Filter ();
use APR::Brigade ();
use APR::Error ();

use TestCommon::Utils ();

use Apache2::Const -compile => qw(OK MODE_READBYTES);
use APR::Const    -compile => qw(SUCCESS BLOCK_READ);

use constant IOBUFSIZE => 8192;

sub handler {
    my $r = shift;

    $r->content_type('text/plain');
    my $test = $r->args;

    if ($test eq 'none') {
        # don't read the request body
    }
    elsif ($test eq 'partial') {
        # read some of request POSTed data (IOBUFSIZE bytes),
        # but not all of it
        my $filters = $r->input_filters();
        my $ba = $r->connection->bucket_alloc;
        my $bb = APR::Brigade->new($r->pool, $ba);
        $filters->get_brigade($bb, Apache2::Const::MODE_READBYTES,
                              APR::Const::BLOCK_READ, IOBUFSIZE);
    }
    elsif ($test eq 'all') {
        # consume all of the request body
        my $data = TestCommon::Utils::read_post($r);
        die "failed to consume all the data" unless length($data) == 100000;
    }

    # now get rid of the rest of the input data should work, no matter
    # how little or how much of the body was read
    my $rc = $r->discard_request_body;
    die APR::Error::strerror($rc) unless $rc == Apache2::Const::OK;

    $r->print($test);

    Apache2::Const::OK;
}

1;


text:
FROM debian:stretch

MAINTAINER Christian Luginbühl <dinkel@pimprecords.com>

ENV SPAMASSASSIN_VERSION 3.4.1

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
        gpg \
	libio-socket-ip-perl \
        libmail-dkim-perl \
        libnet-ident-perl \
        libsocket-getaddrinfo-perl \
        pyzor \
        razor \
        spamassassin=${SPAMASSASSIN_VERSION}* && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN mkdir -p /etc/spamassassin/sa-update-keys && \
    chmod 700 /etc/spamassassin/sa-update-keys && \
    chown debian-spamd:debian-spamd /etc/spamassassin/sa-update-keys && \
    mkdir -p /var/lib/spamassassin/.pyzor && \
    chmod 700 /var/lib/spamassassin/.pyzor && \
    echo "public.pyzor.org:24441" > /var/lib/spamassassin/.pyzor/servers && \
    chmod 600 /var/lib/spamassassin/.pyzor/servers && \
    chown -R debian-spamd:debian-spamd /var/lib/spamassassin/.pyzor

RUN sed -i 's/^logfile = .*$/logfile = \/dev\/stderr/g' /etc/razor/razor-agent.conf

COPY spamd.sh /

COPY rule-update.sh /

COPY run.sh /

EXPOSE 783

CMD ["/run.sh"]


text:
require "chef/knife"
require "chef/config"

class Chef
  class Knife
    class SslFetch < Chef::Knife

      deps do
        require "pp"
        require "socket"
        require "uri"
        require "openssl"
        require "chef/mixin/proxified_socket"
        include Chef::Mixin::ProxifiedSocket
      end

      banner "knife ssl fetch [URL] (options)"

      def initialize(*args)
        super
        @uri = nil
      end

      def uri
        @uri ||= begin
          Chef::Log.trace("Checking SSL cert on #{given_uri}")
          URI.parse(given_uri)
        end
      end

      def given_uri
        (name_args[0] || Chef::Config.chef_server_url)
      end

      def host
        uri.host
      end

      def port
        uri.port
      end

      def validate_uri
        unless host && port
          invalid_uri!
        end
      rescue URI::Error
        invalid_uri!
      end

      def invalid_uri!
        ui.error("Given URI: `#{given_uri}' is invalid")
        show_usage
        exit 1
      end

      def remote_cert_chain
        tcp_connection = proxified_socket(host, port)
        shady_ssl_connection = OpenSSL::SSL::SSLSocket.new(tcp_connection, noverify_peer_ssl_context)
        shady_ssl_connection.connect
        shady_ssl_connection.peer_cert_chain
      end

      def noverify_peer_ssl_context
        @noverify_peer_ssl_context ||= begin
          noverify_peer_context = OpenSSL::SSL::SSLContext.new
          noverify_peer_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
          noverify_peer_context
        end
      end

      def cn_of(certificate)
        subject = certificate.subject
        if cn_field_tuple = subject.to_a.find { |field| field[0] == "CN" }
          cn_field_tuple[1]
        else
          nil
        end
      end

      # Convert the CN of a certificate into something that will work well as a
      # filename. To do so, all `*` characters are converted to the string
      # "wildcard" and then all characters other than alphanumeric and hypen
      # characters are converted to underscores.
      # NOTE: There is some confustion about what the CN will contain when
      # using internationalized domain names. RFC 6125 mandates that the ascii
      # representation be used, but it is not clear whether this is followed in
      # practice.
      # https://tools.ietf.org/html/rfc6125#section-6.4.2
      def normalize_cn(cn)
        cn.gsub("*", "wildcard").gsub(/[^[:alnum:]\-]/, "_")
      end

      def configuration
        Chef::Config
      end

      def trusted_certs_dir
        configuration.trusted_certs_dir
      end

      def write_cert(cert)
        FileUtils.mkdir_p(trusted_certs_dir)
        cn = cn_of(cert)
        filename = cn.nil? ? "#{host}_#{Time.new.to_i}" : normalize_cn(cn)
        full_path = File.join(trusted_certs_dir, "#{filename}.crt")
        ui.msg("Adding certificate for #{filename} in #{full_path}")
        File.open(full_path, File::CREAT | File::TRUNC | File::RDWR, 0644) do |f|
          f.print(cert.to_s)
        end
      end

      def run
        validate_uri
        ui.warn(<<~TRUST_TRUST)
          Certificates from #{host} will be fetched and placed in your trusted_cert
          directory (#{trusted_certs_dir}).

          Knife has no means to verify these are the correct certificates. You should
          verify the authenticity of these certificates after downloading.

TRUST_TRUST
        remote_cert_chain.each do |cert|
          write_cert(cert)
        end
      rescue OpenSSL::SSL::SSLError => e
        # 'unknown protocol' usually means you tried to connect to a non-ssl
        # service. We handle that specially here, any other error we let bubble
        # up (probably a bug of some sort).
        raise unless e.message.include?("unknown protocol")

        ui.error("The service at the given URI (#{uri}) does not accept SSL connections")

        if uri.scheme == "http"
          https_uri = uri.to_s.sub(/^http/, "https")
          ui.error("Perhaps you meant to connect to '#{https_uri}'?")
        end
        exit 1
      end

    end
  end
end