// Generated by CoffeeScript 1.3.1
(function() {
  var CustomOAuth, OAuth, quote, replaceAfterEncode,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };

  OAuth = require('oauth').OAuth;

  replaceAfterEncode = require('./encode-image').replaceAfterEncode;

  quote = require('./escape-py').quote;

  CustomOAuth = (function(_super) {

    __extends(CustomOAuth, _super);

    CustomOAuth.name = 'CustomOAuth';

    function CustomOAuth() {
      return CustomOAuth.__super__.constructor.apply(this, arguments);
    }

    CustomOAuth.prototype._createSignatureBase = function() {
      var _remain, _signatureBase;
      _signatureBase = CustomOAuth.__super__._createSignatureBase.apply(this, arguments);
      if (/data%255B\d%255D/g.test(_signatureBase)) {
        _remain = _signatureBase.split('%26').splice(1).join('%26');
        _signatureBase = replaceAfterEncode(_signatureBase, this.originalBody);
        return _signatureBase + "%26" + _remain;
      } else {
        return _signatureBase;
      }
    };

    CustomOAuth.prototype._encodeData = function(toEncode) {
      var result;
      if ((!(toEncode != null)) || (toEncode === '')) {
        return '';
      } else {
        if (/data(\:|%5B)/g.test(toEncode)) {
          result = quote(toEncode.replace(/data( \:|%5B )/g, ''));
        } else {
          result = encodeURIComponent(toEncode);
        }

        return result.replace(/\!/g, "%21").replace(/\'/g, "%27").replace(/\(/g, "%28").replace(/\)/g, "%29").replace(/\*/g, "%2A");
      }
    };

    CustomOAuth.prototype._createClient = function() {
      var client, _write;
      client = CustomOAuth.__super__._createClient.apply(this, arguments);
      _write = client.write.bind(client);
      client.write = function(chunk, encoding) {
        var contentLength;
        if (/data%3A/g.test(chunk)) {
          chunk = replaceAfterEncode(chunk).replace("*", '%2A').replace("/", '%2F');
        }
        contentLength = 0;
        if (Buffer.isBuffer(chunk) != null) {
          contentLength = chunk.length;
        } else {
          contentLength = Buffer.byteLength(chunk);
        }
        this.setHeader("Content-Length", contentLength);
        this.removeHeader("Connection");
        return _write(chunk, encoding);
      };
      return client;
    };

    return CustomOAuth;

  })(OAuth);

  module.exports = CustomOAuth;

}).call(this);

@@ -646,47 +646,8 @@
 );%0A%0A
-    CustomOAuth.name = 'CustomOAuth';%0A%0A
     

Fix problem readonly property CustomOAuth.name