Giter Site home page Giter Site logo

Comments (4)

julianharty avatar julianharty commented on July 22, 2024 1

Thanks to ferreting around, reading up, and some experimentation I think I've found a fix - to allocate memory from the relevant Apache memory pool and copy the contentType to it.

A very useful clue was found in https://lists.gt.net/apache/users/375588
I've extracted the following text below:

"We developed an Apache module. In the module, when we sent HTTP
response, Apache always changed the "Content-Type", sometimes this field
is correct, sometime it is truncated, sometimes with an invalid value.
We sent response back with the following function, and the response
header was always set properly.

int our_module_handler(request_rec *r)
{
// process requests
// prepare response
ap_set_content_type(r, "application/user-config+xml");
ap_send_http_header(r);
ap_rwrite(..);
return OK;
} 

We added some logs before and after the above calls, and found the
content-type is always right. However, sometimes (not always), in the
response sent by Apache server, Content-Type will be changed to
something like "application/user-config" or
"application/user-config+xm", or some other values."

Followed by Eric's response which unlocked the clue for me:
"I suspect its your modules own misuse of r->pool. Completely gut all
of your actual logic from your module and see if it still truncates
the header.

Or start with a new module that just sets the content type and prints
a canned response.

--
Eric Covener
[email protected]"

from kiwix-apache.

kelson42 avatar kelson42 commented on July 22, 2024

@julianharty Please check the ZIM file is not basically wrong (with zimdump) before assuming something is wrong in your code or in the code of the kiwix lib.

from kiwix-apache.

julianharty avatar julianharty commented on July 22, 2024

My initial test is contained in the following commit 766838e This seems to do the trick I next want to review the overall code of the module and start tidying it up since it's starting to get too messy and insufficiently modular.

from kiwix-apache.

mossroy avatar mossroy commented on July 22, 2024

I confirm it solves the content-type issue for me : good work!

from kiwix-apache.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.