curl siempre trunca el nombre de usuario después de 63 caracteres

Estoy usando el file _netrc para almacenar las cnetworkingenciales del cliente para la authentication básica y noté que msysgit siempre trunca el nombre de usuario en el 63er carácter.

%HOME%\_netrc es como se ve mi %HOME%\_netrc :

 # username for local repos machine localhost login 12345678901234567890123456789012345678901234567890123456789012345 password secret 

He definido un nombre de usuario de 65 caracteres.

Y luego traté de clonar un repository:

 C:\work>git clone https://localhost:44305/git myrepo 

y aquí está el resultado (con GIT_CURL_VERBOSE=1 y GIT_SSL_NO_VERIFY=true ):

 Cloning into 'myrepo'... * About to connect() to localhost port 44305 (#0) * Trying 127.0.0.1... * connected * Connected to localhost (127.0.0.1) port 44305 (#0) * successfully set certificate verify locations: * CAfile: C:\Program Files (x86)\Git/bin/curl-ca-bundle.crt CApath: none * 0x214a410 is at send pipe head! * Expire cleanetworking * SSL connection using AES128-SHA * Server certificate: * subject: CN=localhost * start date: 2012-10-23 06:41:25 GMT * expire date: 2022-10-23 00:00:00 GMT * issuer: CN=localhost * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. > GET /git/info/refs?service=git-upload-pack HTTP/1.1 User-Agent: git/1.7.11.msysgit.1 Host: localhost:44305 Accept: */* Pragma: no-cache < HTTP/1.1 401 Unauthorized < Cache-Control: private < Content-Type: text/html; charset=utf-8 < Server: Microsoft-IIS/8.0 < WWW-Authenticate: Basic Realm="MyRealm" < X-AspNet-Version: 4.0.30319 < X-SourceFiles: =?UTF-8?B?Yzpcd29ya1xUb0REXFdlYkFwcGxpY2F0aW9uMVxXZWJBcHBsaWNhdGlvbjFcZ2l0XGluZm9ccmVmcw==?= < X-Powenetworking-By: ASP.NET < Date: Thu, 21 Feb 2013 13:05:56 GMT < Content-Length: 4975 < * Ignoring the response-body * Connection #0 to host localhost left intact * Issue another request to this URL: 'https://localhost:44305/git/info/refs?service=git-upload-pack' * Re-using existing connection! (#0) with host localhost * Connected to localhost (127.0.0.1) port 44305 (#0) * 0x214a410 is at send pipe head! * Server auth using Basic with user '123456789012345678901234567890123456789012345678901234567890123☻' > GET /git/info/refs?service=git-upload-pack HTTP/1.1 Authorization: Basic MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzAjpzZWNyZXQ= User-Agent: git/1.7.11.msysgit.1 Host: localhost:44305 Accept: */* Pragma: no-cache < HTTP/1.1 200 OK < Cache-Control: private < Content-Type: text/plain; charset=utf-8 < Server: Microsoft-IIS/8.0 < X-AspNet-Version: 4.0.30319 < X-SourceFiles: =?UTF-8?B?Yzpcd29ya1xUb0REXFdlYkFwcGxpY2F0aW9uMVxXZWJBcHBsaWNhdGlvbjFcZ2l0XGluZm9ccmVmcw==?= < X-Powenetworking-By: ASP.NET < Date: Thu, 21 Feb 2013 13:05:56 GMT < Content-Length: 2 < * Expire cleanetworking * Connection #0 to host localhost left intact * Re-using existing connection! (#0) with host localhost * Connected to localhost (127.0.0.1) port 44305 (#0) * 0x214a410 is at send pipe head! * Server auth using Basic with user '123456789012345678901234567890123456789012345678901234567890123☻' > GET /git/HEAD HTTP/1.1 Authorization: Basic MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzAjpzZWNyZXQ= User-Agent: git/1.7.11.msysgit.1 Host: localhost:44305 Accept: */* Pragma: no-cache < HTTP/1.1 200 OK < Cache-Control: private < Content-Type: text/plain; charset=utf-8 < Server: Microsoft-IIS/8.0 < X-AspNet-Version: 4.0.30319 < X-SourceFiles: =?UTF-8?B?Yzpcd29ya1xUb0REXFdlYkFwcGxpY2F0aW9uMVxXZWJBcHBsaWNhdGlvbjFcZ2l0XEhFQUQ=?= < X-Powenetworking-By: ASP.NET < Date: Thu, 21 Feb 2013 13:05:56 GMT < Content-Length: 2 < * Expire cleanetworking * Connection #0 to host localhost left intact warning: You appear to have cloned an empty repository. 

Observe cómo msysgit truncó el nombre de usuario en el 63er carácter:

 123456789012345678901234567890123456789012345678901234567890123☻ 

Luego deshabilité el file _netrc e intenté escribir el nombre de usuario y la contraseña de forma interactiva, pero esta vez intenté ingresar 256 caracteres:

 C:\work>git clone https://localhost:44305/git myrepo 

y aquí está la session interactiva:

 Cloning into 'myrepo'... * Couldn't find host localhost in the _netrc file; using defaults * About to connect() to localhost port 44305 (#0) * Trying 127.0.0.1... * connected * Connected to localhost (127.0.0.1) port 44305 (#0) * successfully set certificate verify locations: * CAfile: C:\Program Files (x86)\Git/bin/curl-ca-bundle.crt CApath: none * 0x22ea410 is at send pipe head! * Expire cleanetworking * SSL connection using AES128-SHA * Server certificate: * subject: CN=localhost * start date: 2012-10-23 06:41:25 GMT * expire date: 2022-10-23 00:00:00 GMT * issuer: CN=localhost * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. > GET /git/info/refs?service=git-upload-pack HTTP/1.1 User-Agent: git/1.7.11.msysgit.1 Host: localhost:44305 Accept: */* Pragma: no-cache * The requested URL returned error: 401 * Closing connection #0 Username for 'https://localhost:44305': 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 Password for 'https://1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456@localhost:44305': * Couldn't find host localhost in the _netrc file; using defaults * About to connect() to localhost port 44305 (#0) * Trying 127.0.0.1... * connected * Connected to localhost (127.0.0.1) port 44305 (#0) * successfully set certificate verify locations: * CAfile: C:\Program Files (x86)\Git/bin/curl-ca-bundle.crt CApath: none * SSL re-using session ID * 0x22ea410 is at send pipe head! * Expire cleanetworking * SSL connection using AES128-SHA * Server certificate: * subject: CN=localhost * start date: 2012-10-23 06:41:25 GMT * expire date: 2022-10-23 00:00:00 GMT * issuer: CN=localhost * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. > GET /git/info/refs?service=git-upload-pack HTTP/1.1 User-Agent: git/1.7.11.msysgit.1 Host: localhost:44305 Accept: */* Pragma: no-cache < HTTP/1.1 401 Unauthorized < Cache-Control: private < Content-Type: text/html; charset=utf-8 < Server: Microsoft-IIS/8.0 < WWW-Authenticate: Basic Realm="GitApi" < X-AspNet-Version: 4.0.30319 < X-SourceFiles: =?UTF-8?B?Yzpcd29ya1xUb0REXFdlYkFwcGxpY2F0aW9uMVxXZWJBcHBsaWNhdGlvbjFcZ2l0XGluZm9ccmVmcw==?= < X-Powenetworking-By: ASP.NET < Date: Thu, 21 Feb 2013 13:16:35 GMT < Content-Length: 4975 < * Ignoring the response-body * Connection #0 to host localhost left intact * Issue another request to this URL: 'https://localhost:44305/git/info/refs?service=git-upload-pack' * Couldn't find host localhost in the _netrc file; using defaults * Re-using existing connection! (#0) with host localhost * Connected to localhost (127.0.0.1) port 44305 (#0) * 0x22ea410 is at send pipe head! * Server auth using Basic with user '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345' > GET /git/info/refs?service=git-upload-pack HTTP/1.1 Authorization: Basic MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1OnNlY3JldA== User-Agent: git/1.7.11.msysgit.1 Host: localhost:44305 Accept: */* Pragma: no-cache < HTTP/1.1 200 OK < Cache-Control: private < Content-Type: text/plain; charset=utf-8 < Server: Microsoft-IIS/8.0 < X-AspNet-Version: 4.0.30319 < X-SourceFiles: =?UTF-8?B?Yzpcd29ya1xUb0REXFdlYkFwcGxpY2F0aW9uMVxXZWJBcHBsaWNhdGlvbjFcZ2l0XGluZm9ccmVmcw==?= < X-Powenetworking-By: ASP.NET < Date: Thu, 21 Feb 2013 13:16:35 GMT < Content-Length: 2 < * Expire cleanetworking * Connection #0 to host localhost left intact * Couldn't find host localhost in the _netrc file; using defaults * Re-using existing connection! (#0) with host localhost * Connected to localhost (127.0.0.1) port 44305 (#0) * 0x22ea410 is at send pipe head! * Server auth using Basic with user '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345' > GET /git/HEAD HTTP/1.1 Authorization: Basic MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1OnNlY3JldA== User-Agent: git/1.7.11.msysgit.1 Host: localhost:44305 Accept: */* Pragma: no-cache < HTTP/1.1 200 OK < Cache-Control: private < Content-Type: text/plain; charset=utf-8 < Server: Microsoft-IIS/8.0 < X-AspNet-Version: 4.0.30319 < X-SourceFiles: =?UTF-8?B?Yzpcd29ya1xUb0REXFdlYkFwcGxpY2F0aW9uMVxXZWJBcHBsaWNhdGlvbjFcZ2l0XEhFQUQ=?= < X-Powenetworking-By: ASP.NET < Date: Thu, 21 Feb 2013 13:16:35 GMT < Content-Length: 2 < * Expire cleanetworking * Connection #0 to host localhost left intact warning: You appear to have cloned an empty repository. 

Esta vez, el nombre de usuario se truncó en el 255º carácter.

He intentado usar msysgit en un prompt estándar de MS-DOS, así como un indicador de PowerShell y un indicador de Git Bash con los mismos resultados.

Asi que aqui están mis preguntas:

  1. ¿Es esto alguna limitación de msysgit?
  2. ¿Se puede boost este límite (tanto para el file _netrc como para el _netrc interactivo)?
  3. ¿Hay alguna solución?

Y si preguntas por qué necesito nombres de usuario tan largos, bueno, es porque mi objective es enviar tokens OAuth para un server GIT personalizado, de la misma manera que lo hace GitHub (excepto que sus tokens OAuth son bastante cortos).


ACTUALIZAR:

Al investigar más, parece que el problema es con cURL que es lo que GIT usa para el cliente HTTP. Puedo reproducir exactamente el mismo comportamiento con el siguiente command:

 curl --netrc -kv https://localhost:44305/git 

Así que estoy reteniendo la pregunta.


ACTUALIZACIÓN 2:

Investigando más a background en netrc.c :

 /* make sure we have room for at least this size: */ #define LOGINSIZE 64 #define PASSWORDSIZE 64 

Estoy empezando a perder mi optimismo por un buen resultado de esto.

Solutions Collecting From Web of "curl siempre trunca el nombre de usuario después de 63 caracteres"

Sí, parece ser una limitación del curl. El código al que hace reference no es actual: esto, creo, es y tiene los mismos valores.

Para Windows, la versión cygwin de git corrige algunas limitaciones que tiene msysgit, como el límite de tamaño de la ruta. Sin embargo, como esto es una limitación de curl y no de msysgit, no hay mucho que pueda hacer, y de hecho cuando lo probé hubo el mismo comportamiento.

Sin embargo, tenga en count que esto parece ser una limitación del uso del file .netrc, ya que ni la especificación HTTP ni la interfaz programática curl tienen ese límite. De hecho, si solo lo especifica en la url, parece funcionar:

 C:\REMenu>git remote add origin https://1234567890123456789012345678901234567890123456789012345678901234567890@github.com/romaonthego/REMenu.git C:\REMenu>git push origin master ... * Server auth using Basic with user '1234567890123456789012345678901234567890123456789012345678901234567890' .. Password for 'https://1234567890123456789012345678901234567890123456789012345678 901234567890@github.com': 

Si necesita usar _netrc, creo que su única opción es comstackr Curl usted mismo si necesita que esto funcione.

Si no es necesario, tiene otras opciones:

  • ejecutar un proxy local que especifica usuario / pase para usted, y usar ese proxy al conectarse, sin especificar usuario / pase para git o curl
  • usando nombre de usuario en la url
  • usando urls basadas en ssh

Editar: solo para recapitular, límites que hemos visto hasta ahora:

  • _netrc: 64 (curl .netrc limit)
  • interactivo: 256
  • cnetworkingential.helper wincnetworking: 512 (límite de la tienda de cnetworkingenciales de Windows)
  • cnetworkingential.helper plain: 4000+
  • url: 4000+
  • proxy: ilimitado (solo debe estar limitado por HTTP y software proxy)