author | Amit Gupta <amit.gupta221@gmail.com> | |
Fri, 1 May 2009 12:38:50 +0000 (14:38 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 1 May 2009 13:02:24 +0000 (15:02 +0200) | ||
commit | b046582ac6fd2392a8971c95d71d85ee229277e0 | |
tree | b989f98811d64e0ae2a2cf871d7680f13263310c | tree | snapshot |
parent | a3da854628383819439f0680acd2786fd00744fe | commit | diff |
apache plugin: Use the HTTP header to determine the server software.
On Wed, Apr 22, 2009 at 1:53 PM, Florian Forster <octo@verplant.org> wrote:
> I think we have two options left:
>
> - Set a header callback using the CURLOPT_HEADERFUNCTION option and
> look for the <91>Server<92> header field. If it contains <93>lighttpd<94>, assume
> lighttpd, Apache otherwise.
>
> - Let the user configure which server software he's using.
>
> The two could be combined, of course: Use the user's setting if he has
> given one, (try to) determine the server software automatically if not.
>
> What do you think?
yeah this sounds good. While I thought about parsing the headers
initially but then the server headers can easily be changed, so I
wasn't sure about this approach earlier. Combing this with the user
specified server configuration value seems like the best solution.
Do find the patch attached. I am using st->server_type variable which
will be set to APACHE or LIGHTTPD based on the following logic:
- If the user has specified Server element in the conf file and it is
"apache" or "lighttpd", then set st->server_type variable
appropriately, otherwise ignore the Server value
- Parse the headers (only if the Server element is NULL or invalid) to
determine the type and set the st->server_type variable accordingly
- if st->server_type is not set as yet, then default it to apache
Regards
Amit
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
On Wed, Apr 22, 2009 at 1:53 PM, Florian Forster <octo@verplant.org> wrote:
> I think we have two options left:
>
> - Set a header callback using the CURLOPT_HEADERFUNCTION option and
> look for the <91>Server<92> header field. If it contains <93>lighttpd<94>, assume
> lighttpd, Apache otherwise.
>
> - Let the user configure which server software he's using.
>
> The two could be combined, of course: Use the user's setting if he has
> given one, (try to) determine the server software automatically if not.
>
> What do you think?
yeah this sounds good. While I thought about parsing the headers
initially but then the server headers can easily be changed, so I
wasn't sure about this approach earlier. Combing this with the user
specified server configuration value seems like the best solution.
Do find the patch attached. I am using st->server_type variable which
will be set to APACHE or LIGHTTPD based on the following logic:
- If the user has specified Server element in the conf file and it is
"apache" or "lighttpd", then set st->server_type variable
appropriately, otherwise ignore the Server value
- Parse the headers (only if the Server element is NULL or invalid) to
determine the type and set the st->server_type variable accordingly
- if st->server_type is not set as yet, then default it to apache
Regards
Amit
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/apache.c | diff | blob | history |