cURL cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1423 Encoding ampersand (&) in windows shells

From: Daniel Stenberg <bagder_at_users.sf.net>
Date: Fri, 03 Oct 2014 21:14:18 +0000

- **status**: pending-invalid --> closed-invalid

---
** [bugs:#1423] Encoding ampersand (&) in windows shells**
**Status:** closed-invalid
**Labels:** windows scape encoding 
**Created:** Wed Sep 17, 2014 10:01 AM UTC by Pedro J. Molina
**Last Updated:** Thu Sep 18, 2014 05:03 PM UTC
**Owner:** Daniel Stenberg
Using curl in two environments I found a different behaviour. Not sure if this is related to the OS, the shell or curl itself. So, posting here for your consideration.
*Environment A.*
	Local machine. 
	+ OS version:    ```Windows 8.1 Enterprise 64bits```
	= Shell version: ```Microsoft Windows [Version 6.3.9600]```
	= curl -V:
        ```curl 7.28.1 (i386-pc-win32) libcurl/7.28.1 OpenSSL/1.0.0j zlib/1.2.7 libidn/1.18 libssh2/1.4.2 librtmp/2.3
        Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
        Features: AsynchDNS GSS-Negotiate IDN Largefile NTLM SSL SSPI libz```
*Environment B.*
	Azure VM Cloud Machine.
	+ OS version:    ```Windows Server 2012 R2 Datacenter```
	= Shell version: ```Microsoft Windows [Version 6.3.9600]```
	= curl -V:
        ```curl 7.28.1 (i386-pc-win32) libcurl/7.28.1 OpenSSL/1.0.0j zlib/1.2.7 libidn/1.18 libssh2/1.4.2 librtmp/2.3
		Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
		Features: AsynchDNS GSS-Negotiate IDN Largefile NTLM SSL SSPI libz```
		
Given the commented environments, the following command:	
   ```curl -k -o src.zip "https://appworks2devel.blob.core.windows.net/jobs/ff80ad05-1d64-4dd8-a9be-147dd7f1889d/code/App.zip?sv=2012-02-12&st=2014-09-17T08%3A24%3A33Z&se=2014-09-17T12%3A29%3A33Z&sr=b&sp=r&sig=%2FFdVnkl7Qql3grpK6iGFVMkFTsmwKfKc%2BG0KdRIU3%2Fo%3D"```
Result: 
  - Fails on Environment A.
  - And works on Environment B.
Error report on A follows:
```
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   223  100   223    0     0    190      0  0:00:01  0:00:01 --:--:--   264
'st' is not recognized as an internal or external command,
operable program or batch file.
'se' is not recognized as an internal or external command,
operable program or batch file.
'sr' is not recognized as an internal or external command,
operable program or batch file.
'sp' is not recognized as an internal or external command,
operable program or batch file.
'sig' is not recognized as an internal or external command,
operable program or batch file.
```
Reading a bit more about encoding on DOS shells some people recommends to scape  & in DOS to be ^&. Therefore the fixed command would be:
   ```curl -k -o src.zip "https://appworks2devel.blob.core.windows.net/jobs/ff80ad05-1d64-4dd8-a9be-147dd7f1889d/code/App.zip?sv=2012-02-12^&st=2014-09-17T08%3A24%3A33Z^&se=2014-09-17T12%3A29%3A33Z^&sr=b^&sp=r^&sig=%2FFdVnkl7Qql3grpK6iGFVMkFTsmwKfKc%2BG0KdRIU3%2Fo%3D"```
Result: 
  - Works on Environment A.
  - And fails on Environment B.
  Error on B:
  The URL is invalid: breaks the signature and downloads an invalid file instead the real one.
There is a way to make this work in both platforms with a unique syntax?
What is the recommended form?
Thank you.
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2014-10-03

These mail archives are generated by hypermail.