GermainZ / CrappaLinks

Xposed module that removes link masking and shortening
GNU General Public License v3.0
47 stars 8 forks source link

Use HEAD method instead of GET #25

Closed sm4rk0 closed 8 years ago

sm4rk0 commented 8 years ago

Currently the application downloads the target URL. But using HEAD method should have the same effect as it has now, only without getting the response body from the server. I've checked this with t.co using Fiddler Web Debugger. There is only one line of code needed: c.setRequestMethod("HEAD"); before the c.connect(); in Resolver.getRedirect()

sm4rk0 commented 8 years ago

I'm sorry, I didn't see the part after making a connection. This part, specifically: // It might also be a redirection using meta tags. Using HEAD request would require another connection/GET request to fetch the body in that case and this would introduce unnecessary complexity to the code...

GermainZ commented 8 years ago

Yup. I'm reluctant to hardcode the type of redirection for each domain for maintenance reasons, but sending a HEAD request first then a GET request if that's not enough would probably be better in most cases.

(Sorry for the late reply, I missed the original comment.)