Closed (fixed)
Project:
Feeds
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Dec 2011 at 19:31 UTC
Updated:
20 Mar 2013 at 08:20 UTC
Jump to comment: Most recent file
Using curl, http_request_get will return the response header of the FIRST request. If a requests results in one or multiple redirect this will break expected behavior as the first (instead of the last) response headers are returned. I can submit patch for this (as soon as I have one done).
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | feeds-http_request_get-1380636-6.patch | 937 bytes | emackn |
| #1 | feeds-http_request_get-1380636-1.patch | 721 bytes | gnucifer |
Comments
Comment #1
gnucifer commentedPatch submitted.
Comment #2
gnucifer commentedComment #3
emackn commentedCan you provide me a feed that does this so I can check it out?
Also, can you explain a little about what you are doing with the lines you added?
It looks like you are splitting up all the headers, and then splitting again on the last set of headers for $header_lines.
Thanks.
Comment #4
gnucifer commentedThe feed is fetched from a webservice that required authentication, so can't give you give you an example. This is how the headers returned by curl looks like though.
The current code will return the header for the first resonse. To fix this I split the headerblocks on the separator (two \r\n) so that only the last one is parsed and included in the response-object.
Ideally I would also like the file to be saved as basename(/data/CBild/3UOQASUN/QGSBJG1J_q70_mFile_cmNone.jpg), the location of the last redirect) instead of the original request url. But have not figured out a way to do this in a clean way.
Comment #5
emackn commentedCode works well. Were you checking the headers for some other processing that led you to this?
Comment #6
emackn commentedhad to re-roll the patch since the some other things have been added to dev in the last week.
Comment #7
emackn commentedComment #8
emackn commentedcommitted to 7.x-2.x
Comment #9
gnucifer commentedemackn: Yes, I was checking the headers primarily for mime-type checking etc as discussed in this issue: http://drupal.org/node/706908. I later dropped the idea of checking mime-type in headers in favor of downloading the file to perform mime-checking with fileinfo. The mime-type in the response can't be trusted anyway, so I don't see how it's usable besides giving an indication of what type of file to expect.
Comment #10
emackn commentedNice catch by the way. ;)
Comment #11
dave reidComment #12
twistor commentedThis was committed to 6.x some time ago.