Double escaping
I'm trying to use a pull (docker pull, to pull from a registry, in my case it's red:5000/image-name). I noticed that in function: Modem.prototype.dial, it is escaping the path when adding the opts to the address (address += querystring.stringify(opts);)
When it comes to the Modem.prototype.buildRequest, and creates the http req (var req = http[self.protocol].request(options, function() {});), this function also escapes the path. so now the path will look like /images/create?fromImage=red%253A5000%252Fimage-name
So it seems like it does a double escape (which I assume the docker server doesn't like, since I get a response back : Invalid repository name (red%3A5000%2Fimage-name), only [a-z0-9-_.] are allowed
Can't replicate this, can you provide an example script?
Hi Pedro.
I'll take a look at it in 1.5 week (I'm on a trip right now). I'll try ti figure out what exactly happens, since I recall I get a different result if I run in an OSX enviroment compared to an ARM linux.
Best regards, Niklas On Dec 27, 2014 7:51 PM, "Pedro Dias" [email protected] wrote:
Can't replicate this, can you provide an example script?
— Reply to this email directly or view it on GitHub https://github.com/apocas/docker-modem/issues/29#issuecomment-68197574.
Hi Pedro.
Sorry I haven't got back to you. I have been pretty swamped lately, so I haven't had much time to look at this.
I'll do it asap.
Best regards, Niklas
On Sat, Dec 27, 2014 at 7:59 PM, Niklas Molin [email protected] wrote:
Hi Pedro.
I'll take a look at it in 1.5 week (I'm on a trip right now). I'll try ti figure out what exactly happens, since I recall I get a different result if I run in an OSX enviroment compared to an ARM linux.
Best regards, Niklas On Dec 27, 2014 7:51 PM, "Pedro Dias" [email protected] wrote:
Can't replicate this, can you provide an example script?
— Reply to this email directly or view it on GitHub https://github.com/apocas/docker-modem/issues/29#issuecomment-68197574.
Hi Pedro.
I finally had time to look at this again.
So I trying to pull from following address, 192.168.10.39:5000/pga In mode.js,line 96 (address += querystring.stringify(opts); ) opts has following paramters:
- fromImage: "192.168.10.39:5000/pga"
- tag: undefined
address has (before this line) "http://192.168.55.126:4243/images/create?" , after line is executed " http://192.168.55.126:4243/images/create?fromImage=192.168.10.39%3A5000%2Fpga&tag= " Now the address has the "%3A and %2F, instead of : and /, which are the ASCII hex values for these characters.
later in function buildRequest on line 148, var req = http[self.protocol].request(options, function() {}); options has parameter path: "/images/create?fromImage=192.168.10.39%3A5000%2Fpga&tag=" After lrequest is execute, req object will have parameter path: "/images/create?fromImage=192.168.10.39%253A5000%252Fpga&tag=" Now it seems like it changed the % character with an "escaping" %25. So when this path is translated on the receiving side till will be: "/images/create?fromImage=192.168.10.39%3A5000%2Fpga&tag=", instead of "/images/create?fromImage=192.168.10.39:5000/pga&tag=" The error I get back from docker is:
Error: HTTP code is 500 which indicates error: server error - Invalid repository name (192.168.10.39%3A5000%2Faperios), only [a-z0-9-_.] are allowed
I hope this gives a better explanation of the problem.
Best regards,
Niklas
On Sat, Dec 27, 2014 at 7:51 PM, Pedro Dias [email protected] wrote:
Can't replicate this, can you provide an example script?
— Reply to this email directly or view it on GitHub https://github.com/apocas/docker-modem/issues/29#issuecomment-68197574.