Re: conditionally create a Virtual Host?

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

 



Hi,

this has been backported to 2.4.x branch. It will be part of apache 2.4.42.
No date is foreseen at the moment. The release should happen in a couple of months.

CJ

Le 05/09/2019 à 21:12, Christophe JAILLET a écrit :
Hi,

we don't have a fixed schedule for release.
2.4.41 has just been released a few weeks ago.

Unless a serious regression is spotted or some security issues discovered, you should not expect a new release before, let say, 3-4 months.
If you want to have an idea of the "release rate", have a look at [1].

CJ

[1]: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?revision=1866035&view=markup&sortby=date


Le 05/09/2019 à 00:41, Heather Lotz a écrit :
That is fantastic news!  Thank-you very much for figuring it out and fixing it. Assuming the change gets approved, approximately when will the next release become available?

------------------------------------------------------------------------
*From:* Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
*Sent:* Wednesday, September 4, 2019 2:14 PM
*To:* users@xxxxxxxxxxxxxxxx <users@xxxxxxxxxxxxxxxx>; Heather Lotz <knot22@xxxxxxxxxxx>
*Subject:* Re: conditionally create a Virtual Host?
Hi,

The issue has been tracked down and has been fixed on trunk in r1866418 [1].

It will be proposed for backport and should be in next release if the change is approved.

Best regards,
CJ

[1]: http://svn.apache.org/viewvc?rev=1866418&view=rev <http://svn.apache.org/viewvc?rev=1866418&view=rev>


Le 01/09/2019 à 01:11, Heather Lotz a écrit :
Hello - Just wondering if there has been any progress made on getting <IfFile> to work for Windows.

------------------------------------------------------------------------
*From:* Heather Lotz <knot22@xxxxxxxxxxx> <mailto:knot22@xxxxxxxxxxx>
*Sent:* Saturday, August 24, 2019 11:40 AM
*To:* Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> <mailto:christophe.jaillet@xxxxxxxxxx>; users@xxxxxxxxxxxxxxxx <mailto:users@xxxxxxxxxxxxxxxx> <users@xxxxxxxxxxxxxxxx> <mailto:users@xxxxxxxxxxxxxxxx>
*Subject:* Re: conditionally create a Virtual Host?
Seeking clarification - does this mean you were able to reproduce the issue?

------------------------------------------------------------------------
*From:* Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> <mailto:christophe.jaillet@xxxxxxxxxx>
*Sent:* Saturday, August 24, 2019 5:18 AM
*To:* users@xxxxxxxxxxxxxxxx <mailto:users@xxxxxxxxxxxxxxxx> <users@xxxxxxxxxxxxxxxx> <mailto:users@xxxxxxxxxxxxxxxx>; Heather Lotz <knot22@xxxxxxxxxxx> <mailto:knot22@xxxxxxxxxxx>
*Subject:* Re: conditionally create a Virtual Host?
Hi,

confirmed, using the binaries provided by https://www.apachelounge.com/download/ <https://www.apachelounge.com/download/>

CJ

Le 23/08/2019 à 23:53, Heather Lotz a écrit :
Right, I have zero knowledge of C. That would be super if you would be able to replicate the issue in a Windows environment.  Admittedly, I don't know what a Windows binary is.

I ran some more tests, based on your suggestion, and also found a couple of links about DOS device paths that proved to be helpful*.

Here are the results -
For each of these Apache would not start:
<IfFile "\\.\Z:">
<IfFile "\\.\Z:\">
<IfFile "\\.\Z:\files\development\ApacheSmokeSignal.txt">
<IfFile "\\.\C:">

For each of these Apache would start whether Z: was connected to the PC or not.  However, the code within the <IfFile> tags never executed because localhost:8080/miscellaneous/ always returned a 404 error in the browser.
<IfFile "\\?\Z:">
<IfFile "\\?\Z:\">
<IfFile "\\?\Z:\files\development\ApacheSmokeSignal.txt">
<IfFile "\\?\C:">
<IfFile "\\?\C:\">
<IfFile "\\?\C:\Users\heather.lotz\Documents\_user_files\text.txt">

*For reference, here are links to the useful pages about DOS device paths -
https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats
https://stackoverflow.com/questions/23041983/path-prefixes-and


------------------------------------------------------------------------
*From:* Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> <mailto:christophe.jaillet@xxxxxxxxxx>
*Sent:* Friday, August 23, 2019 8:55 AM
*To:* users@xxxxxxxxxxxxxxxx <mailto:users@xxxxxxxxxxxxxxxx> <users@xxxxxxxxxxxxxxxx> <mailto:users@xxxxxxxxxxxxxxxx>; Heather Lotz <knot22@xxxxxxxxxxx> <mailto:knot22@xxxxxxxxxxx>
*Subject:* Re: conditionally create a Virtual Host?

Hi,


Ok, if you have little knowledge of C, no need to try to apply the patch.

You would need a compiler, some libraries, set-up the environment, configure, build, install...


I'll install a Windows binaries and try your configuration. Should be easy to reproduce.


The syntax you have used is correct (Z:/bla/bla/). AFAIK, the internals of httpd (the APR library to be precise) already translate the '/' (Linux style) in '\' (Windows style).


My proposal was just based on information taken from Microsoft doc (search for "When opening a volume or removable media drive (for example, a floppy disk drive or flash memory thumb drive), ..."  near the end of https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew). Because, at some point, on Windows, 'CreteFileW()' is called.




Just 2 words on the patch.

When a configuration file is parsed, when a '<IfFile ...>' directive is found, all lines up to the corresponding </Iffile> are discarded.

To do that the function, we call 'apr_stat()' which gives information on a file (size, name, dates...). In the specific case, no information is requested. This is unusual. Usually we ask for size only, or "standard" information.

The patch just changes the requirement from "do not return anything" to "return size file only".

However, asking for no information *should still work*. The function should tell us that the file exists or not, without any details on the file itself, if found.

My point is that using it this way, is unusual. This could hide a corner case (read: bug in the APR underlying library)


I've had in my todo list for a long time to setup a test environment for Windows. It could be a good occasion to do it. Or you could try with the supplier of a Windows binary (Steffen from Apache lounge is following closely the project and could be of help). Reproduce the issue with their binaries and report to issue to them as well.


Finally, I put back the mailing list in copy, should anyone have an opinion on it

CJ


Le 23/08/2019 à 14:12, Heather Lotz a écrit :
Also, it would be helpful to know the expected syntax to use in <IfFile> once the patch is applied.

For instance, does the patch expect
<IfFile "/z/files/development/ApacheSmokeSignal.txt">
and the purpose of the patch is to execute the code within the <IfFile> tags?

Or does the patch expect
<IfFile "Z:/files/development/ApacheSmokeSignal.txt">
and the patch will allow the code within the <IfFile> tags to execute as it would on a Linux machine?

I opened the patch file in Notepad++ but don't understand the contents.

------------------------------------------------------------------------
*From:* Heather Lotz <knot22@xxxxxxxxxxx> <mailto:knot22@xxxxxxxxxxx>
*Sent:* Friday, August 23, 2019 6:44 AM
*To:* Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> <mailto:christophe.jaillet@xxxxxxxxxx>
*Subject:* Re: conditionally create a Virtual Host?
Hello Christophe - Thank-you for the reply.  Can you please provide some instructions about how to apply the patch?
Heather

------------------------------------------------------------------------
*From:* Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> <mailto:christophe.jaillet@xxxxxxxxxx>
*Sent:* Friday, August 23, 2019 12:50 AM
*To:* users@xxxxxxxxxxxxxxxx <mailto:users@xxxxxxxxxxxxxxxx> <users@xxxxxxxxxxxxxxxx> <mailto:users@xxxxxxxxxxxxxxxx>; Heather Lotz <knot22@xxxxxxxxxxx> <mailto:knot22@xxxxxxxxxxx>
*Subject:* Re: conditionally create a Virtual Host?
Le 23/08/2019 à 05:04, Heather Lotz a écrit :
After some more testing, it seems that this syntax -
<IfFile "Z:/files/development/ApacheSmokeSignal.txt">
is the root cause of Apache not starting when the external storage device, mapped to Z:, is detached from the Windows 10 PC.

I tested these variants individually, which are more *nix like -
<IfFile "Z/files/development/ApacheSmokeSignal.txt">
<IfFile "/Z/files/development/ApacheSmokeSignal.txt">
<IfFile "/z/files/development/ApacheSmokeSignal.txt">
and the behavior is Apache starts whether or not Z: is attached to the PC, so that is a step in the right direction. However, the code within the <IfFile> tags never executes because when localhost:8080/miscellaneous/ is entered in a browser it always returns a 404 error.

Another test was this -
<IfFile "/c/Users/heather.lotz/Documents/_user_files/test.txt">
which points to an existing file which is not stored on Z:. The behavior here was the same as that of the 3 *nix like tests.  Apache starts whether or not Z: is attached to the PC but code within the <IfFile> tags is not executed because localhost:8080/miscellaneous/ returns a 404 error.

Does this constitute a bug of <IfFile> when used on a Windows OS?

------------------------------------------------------------------------
*From:* Heather Lotz <knot22@xxxxxxxxxxx> <mailto:knot22@xxxxxxxxxxx>
*Sent:* Wednesday, August 21, 2019 9:36 PM
*To:* users@xxxxxxxxxxxxxxxx <mailto:users@xxxxxxxxxxxxxxxx> <users@xxxxxxxxxxxxxxxx> <mailto:users@xxxxxxxxxxxxxxxx>
*Subject:* Re:  conditionally create a Virtual Host?
A new file was created on Z: for the sole purpose of having a designated file for Apache to seek.
The file is  called Z:\files\development\ApacheSmokeSignal.txt.

Here is what httpd-vhosts.conf looks like now:
<IfFile "Z:/files/development/ApacheSmokeSignal.txt">
<VirtualHost *:8080>
 DocumentRoot "Z:/files/xampp/htdocs"
 <Directory "Z:/files/xampp/htdocs">
  Options Indexes
  Require all granted
 </Directory>
</VirtualHost>
</IfFile>

With this update in place, Apache starts fine when Z: is attached to the PC. However, when Z: is not attached to the PC Apache does not start and these lines appear in the XAMPP Control Panel console:
9:30:24 PM  [Apache]  Attempting to start Apache app...
9:30:24 PM  [Apache]  Status change detected: running
9:30:26 PM  [Apache]  Status change detected: stopped
9:30:26 PM  [Apache]  Error: Apache shutdown unexpectedly.
9:30:26 PM  [Apache]  This may be due to a blocked port, missing dependencies, 9:30:26 PM  [Apache]  improper privileges, a crash, or a shutdown by another method. 9:30:26 PM  [Apache]  Press the Logs button to view error logs and check
9:30:26 PM  [Apache]  the Windows Event Viewer for more clues
9:30:26 PM  [Apache]  If you need more help, copy and post this
9:30:26 PM  [Apache]  entire log window on the forums

There are no entries in error.log with a Wed Aug 21 21:30 or later timestamp.

Is the syntax incorrect? Note that Apache is installed in this location on the PC in question: C:\xampp\apache.

------------------------------------------------------------------------
*From:* Eric Covener <covener@xxxxxxxxx> <mailto:covener@xxxxxxxxx>
*Sent:* Wednesday, August 21, 2019 7:27 PM
*To:* users@xxxxxxxxxxxxxxxx <mailto:users@xxxxxxxxxxxxxxxx> <users@xxxxxxxxxxxxxxxx> <mailto:users@xxxxxxxxxxxxxxxx>
*Subject:* Re:  conditionally create a Virtual Host?
On Wed, Aug 21, 2019 at 8:21 PM Heather Lotz <knot22@xxxxxxxxxxx> <mailto:knot22@xxxxxxxxxxx> wrote:
>
> Greetings,
>
> In my development environment on a Windows 10 PC I have added the following to Apache's configuration files -
>
> To httpd.conf:
> Listen 8080
>
> To httpd-vhosts.conf:
> <VirtualHost *:8080>
> DocumentRoot "Z:/files/xampp/htdocs"
> <Directory "Z:/files/xampp/htdocs">
>  Options Indexes
>  Require all granted
> </Directory>
> </VirtualHost>
>
> Note that Z: is mapped to an external storage device.
>
> With this setup, Apache successfully accesses C: on port 80 and Z: on port 8080. However, if the external storage device is not attached to the computer, Apache will not start. Is there a way to check if Z: is present, and only create the virtual host if that device is plugged in so that Apache always starts?  If so, how can this be achieved?

Try <IfFile> https://httpd.apache.org/docs/2.4/mod/core.html#iffile

--
Eric Covener
covener@xxxxxxxxx <mailto:covener@xxxxxxxxx>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx <mailto:users-unsubscribe@xxxxxxxxxxxxxxxx> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx <mailto:users-help@xxxxxxxxxxxxxxxx>

Hi,


would you have the opportunity to test the attached patch?

The 0 passed to apr_stat looks spurious to me. (but should work)



(Pure speculation)
Also, based on Microsoft doc, could you also try:

<IfFile "\\.\Z:">
...

and
<IfFile "\\.\Z:\">

...


CJ






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux