Hello Jingfei,

Yes, the relevant query parameters are included in the redirect location of the 
HTTP 302 response, and this is by design.

Many of the curl examples in the WebHDFS documentation use the curl -L option.

http://hadoop.apache.org/docs/r2.7.1/hadoop-project-dist/hadoop-hdfs/WebHDFS.html

Passing the -L option to the curl command will cause it to follow redirects 
automatically.  We expect this would work correctly, because the redirect 
location in the HTTP 302 response has the complete query parameter information, 
and curl -L would use this in its subsequent HTTP request.

--Chris Nauroth

From: Jingfei Hu <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Monday, October 12, 2015 at 6:53 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Cc: Jingfei Hu <[email protected]<mailto:[email protected]>>
Subject: Http request uri query parameters of the redirected location

Hi team,
I am using WebHDFS rest api to read from and write to HDFS cluster files. I've 
got a minor question when using curl command line to practice some apis.  It's

Would the query parameters be appended to the redirected location when creating 
files or any other apis which needs a redirect?

Of course, I tried out. And it seems work in that way.

curl -i -X PUT "http://xxx:50070/webhdfs/v1/hellowworld?op=CREATE

If I put it a &user.name=hadoop, then the redirected location would also 
contain such a query parameter.

My further question is it's by design or not. Can I make this assumption when 
writing codes?

Thanks,
Jingfei

Reply via email to