[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: http_get failing with 404



Hi Mike,

On 8/13/2013 3:05 PM, Mike Krebs wrote:
I haven't tried it but setting the path like you are and using HTTP_URL_GET doesn't seem like it would work as HTTPAPI would not know what protocol to use (HTTP or HTTPS).


This won't help with Charlie's issue (since he was calling http_url_get unnecesarily), but... In case you're curious -- what HTTPAPI would do is try to re-use the protocol, host name, and port of the previous request. So for example, if you did http://example.com/somedir/somedoc.ext on your first request (post or get, doesn't matter) and then followed up with /anotherdir/anotherdoc.ext on the second request, it would go back to example.com and use http: to find '/aotherdir/anotherdoc.ext' on the same server.

This is done to emulate (as close as I can) the way a browser handles "relative links". (relative urls)

And the reason HTTPAPI tries to handle them is because some sites will send a "redirect" code and will redirect to a relative link -- so for HTTPAPI to handle those redirects properly, it also needs to handle relative links.

One difference, of course, is that browsers handle relative urls based on the page that they appeared inside. HTTPAPI has no notion of appearing "inside a page" since it doesn't interpret html, so I just made it work based on whatever the previous request was, which so far has worked very well for me.

-SK

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------