Bug 65590 - fix_uds_filename function seems broken since apache 2.4.49
Summary: fix_uds_filename function seems broken since apache 2.4.49
Status: RESOLVED DUPLICATE of bug 57691
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 2.4.49
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk
: 65600 65617 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-09-22 10:17 UTC by Sylvain Cresto
Modified: 2021-10-05 21:22 UTC (History)
2 users (show)



Attachments
Handle UDS ("unix:") scheme is mod_rewrite (492 bytes, patch)
2021-09-22 10:58 UTC, Yann Ylavic
Details | Diff
Handle UDS ("unix:") scheme in mod_rewrite [P] (611 bytes, patch)
2021-09-22 11:28 UTC, Yann Ylavic
Details | Diff
Handle UDS ("unix:") scheme in mod_rewrite [P] (619 bytes, patch)
2021-09-22 11:31 UTC, Yann Ylavic
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain Cresto 2021-09-22 10:17:57 UTC
Since we have upgraded from httpd-2.4.48 to httpd-2.4.49 our websocket application fail to load in web browser.
Apache seems to hang.


Our configuration is :

<Location /activex/>
  Options FollowSymLinks
  RewriteEngine On
  RewriteCond %{HTTP:Upgrade} !=websocket [NC]
  RewriteRule /activex/([^\/]+)/(.*)           unix:/dev/shm/HXL_${NOM_UTILISATEUR}/backoffice_$1.socket|http://localhost/$2 [NE,P,L]

  RewriteCond %{HTTP:Upgrade} =websocket [NC]
  RewriteCond %{HTTP_COOKIE} hxlsession=([^;]+)
  RewriteRule /activex/([^\/]+)/(.*)           unix:/dev/shm/HXL_${NOM_UTILISATEUR}/backoffice_$1.socket|ws://localhost/$2?arg=%1 [NE,P,L]
</Location>

To try to fix I have replace fix_uds_filename function in httpd-2.4.49/modules/proxy/proxy_util.c with version presents in httpd-2.4.48/modules/proxy/proxy_util.c and the problem has go away, 
so il looks like a httpd-2.4.49 regression.

If it can help I have add some trace in this function and it's look like the probleme is with "unix:" part who does no more match with ap_cstr_casecmpn function.
I notice too that r->filaneme length seem to anormaly grow.

Tracing r->filename display:
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http://localhost/
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http://localhost/
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_unix:.socket|http://localhost/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http:/localhost/
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_unix:.socket|http://localhost/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http:/localhost/
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_unix:.socket|http://localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http:/localhost/
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_unix:.socket|http://localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http:/localhost/
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_unix:.socket|http://localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http:/localhost/
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_unix:.socket|http://localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http:/localhost/]
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_unix:.socket|http://localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http:/localhost/
proxy:http://dev76.lis-dev.net:2000/activex/unix:/dev/shm/HXL_scresto/backoffice_unix:.socket|http://localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_unix:.socket|http:/localhost/dev/shm/HXL_scresto/backoffice_session.8f304bcaaf818c4d5bd799b8c75dbf20.14400.MHXL.socket|http:/localhost/


If you need more information, please let me know.

Thanks
Comment 1 Ruediger Pluem 2021-09-22 10:28:05 UTC
Your RewriteRules are broken. Move them out of the Location block and it should work. The r->filenames you show below are correctly classified as invalid.
Comment 2 Yann Ylavic 2021-09-22 10:58:13 UTC
Created attachment 38043 [details]
Handle UDS ("unix:") scheme is mod_rewrite

Maybe the issue is that mod_rewrite does not consider that a "unix:" scheme forms an absolute URI?
Comment 3 Yann Ylavic 2021-09-22 11:10:08 UTC
Related to bug 57691 ?
Comment 4 Yann Ylavic 2021-09-22 11:28:55 UTC
Created attachment 38044 [details]
Handle UDS ("unix:") scheme in mod_rewrite [P]

Or maybe this one instead since the "unix:" scheme is a [P] thing only.
Comment 5 Yann Ylavic 2021-09-22 11:31:14 UTC
Created attachment 38045 [details]
Handle UDS ("unix:") scheme in mod_rewrite [P]

This one should compile..
Comment 6 Sylvain Cresto 2021-09-22 13:06:53 UTC
Thanks for your quick reply.

OK I have move RewriteRules in correct Directy section.

I have applied patch 38045 but it does not make different, it does not works.
With fix_uds_filename function from httpd-2.4.48 it still works.
Comment 7 Ruediger Pluem 2021-09-22 13:26:52 UTC
Do you have traces for r->filename with the patch applied? Does the 38043 attached patch help?
Comment 8 Yann Ylavic 2021-09-22 13:41:14 UTC
(In reply to Sylvain Cresto from comment #6)
> I have applied patch 38045 but it does not make different, it does not works.

Please verify that you are running the patched version, I can't reproduce the issue with the patch applied.

Also the RewriteRule should go outside any Location or Directory section (directly at the VirtualHost level), otherwise the rewritten URL will always be prefixed by the directory or location specified, which breaks the "unix:" scheme.
Comment 9 Sylvain Cresto 2021-09-22 14:33:35 UTC
Hi

OK my bad, i haven't applied patch 38043.

With patchs 38043 and 38045 it's now correctly working, thank you !
Comment 10 Ruediger Pluem 2021-09-22 14:37:23 UTC
Only one of the patches should be applied. Can you please do tests with only one of them applied?
Comment 11 Sylvain Cresto 2021-09-22 15:00:19 UTC
OK I've just test those patchs.
Patch 38043 is the mandatory patch.

Thanks
Comment 12 Yann Ylavic 2021-09-22 15:02:41 UTC
Do you mean that 38045 alone is not working?
Comment 13 Sylvain Cresto 2021-09-22 16:35:45 UTC
Yes, in my case :

Patch 38043 alone : good
Patch 38045 alone : bad
Patch 38043 + 38045 : good
Comment 14 Yann Ylavic 2021-09-22 18:21:14 UTC
Thanks for testing Sylvain.

This is now fixed in trunk (r1893516) with the patch attachment 37289 [details] from bug 57691, so I'm marking this PR as duplicate to track the backport at a single place.

*** This bug has been marked as a duplicate of bug 57691 ***
Comment 15 Sylvain Cresto 2021-09-23 07:30:53 UTC
Thanks !
Comment 16 Ruediger Pluem 2021-10-04 15:31:26 UTC
*** Bug 65600 has been marked as a duplicate of this bug. ***
Comment 17 Yann Ylavic 2021-10-05 21:22:11 UTC
*** Bug 65617 has been marked as a duplicate of this bug. ***