Skip to content

Extract method comes with no specified headers #96

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
TonyEight opened this issue Oct 21, 2013 · 4 comments
Closed

Extract method comes with no specified headers #96

TonyEight opened this issue Oct 21, 2013 · 4 comments
Assignees
Labels

Comments

@TonyEight
Copy link

I may be getting silly or maybe I just can't understand the implementation, but it seems like the extract method is not implemented in a way to give proper parameters to _send_request.

There are no given headers. With the current _send_request implementation, when no headers are provided, it uses application/xml instead :

if not 'content-type' in [key.lower() for key in headers.keys()]:
    headers['Content-type'] = 'application/xml; charset=UTF-8'

Using pysolr with django-haystack, I was unable to correctly implement the extract_contents_file method from SolrBackend due to this fact. Every submitted files were considered as XML instead of the ContentType found by Tika, resulting in a continuous ParseError...

Commentting the given part of code solves my case, but I'm sure there may be another better option.

Do you have any clue ?

@tongwang
Copy link
Contributor

tongwang commented Dec 4, 2013

Having the same issue here. extract is broken.

@ghost ghost assigned acdha Dec 4, 2013
@acdha
Copy link
Collaborator

acdha commented Dec 4, 2013

This apparently changed at some point in Solr's release cycle. I'd want to test to confirm that it works as far back as we support but otherwise my first question is whether this works if you use a generic mime type like application/octet-stream which would allow us to avoid any chance of affecting other requests by having extract set that header for its requests.

tongwang added a commit to tongwang/pysolr that referenced this issue Dec 6, 2013
…ed test solr sever from 4.1.0 to 4.6.0. All tests pass
@tongwang
Copy link
Contributor

tongwang commented Dec 6, 2013

application/octet-stream won't work. Seems like the only way to make it work is to not setting Content-type at all, letting requests to set it to the correct multipart/form-data with boundary.

@stale
Copy link

stale bot commented Jun 5, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 5, 2018
@stale stale bot closed this as completed Jul 5, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants