Welcome Guest, Not a member yet? Register   Sign In
Support to HTTP/3
#1

Hi, yesterday I moved my application made with Codeigniter 4.1.9 from an Apache web server to Caddy web server.

Opening my application on Windows 10 PC with both Chrome and Firefox, I had some problems with the http protocol version, but no problem with Internet Explorer.

The critical error message in the logs was as follows: "Invalid HTTP Protocol Version. Must be one of: 1.0, 1.1, 2.0".

Investigating the Caddy configuration file a bit I noticed that the HTTP/3 version was enabled. Looking in the codeigniter code I found that in the file system/HTTP/Message.php there is a list of accepted versions:

PHP Code:
    
protected $validProtocolVersions = [
        '1.0',
        '1.1',
        '2.0',
    ]; 

For now I have solved it by changing the setting on Caddy server removing HTTP/3 and it seems solved, but I was wondering if there will be support for the HTTP/3 version in the short term or it requires big changes to the framework and it is necessary to wait more time for such support.

Thanks
Reply
#2

I wonder why the check is there at all. Perhaps it's a case of applying the robustness principle too eagerly. Or a false sense of security since after all, it's a good idea to validate your inputs.

The way I see it, the check for HTTP protocol version is a misfeature.
Reply
#3

I re-open this post after some time, to ask the developers if it is possible to consider the inclusion in the list of http versions supported also the http/3 which has officially become a standard. Or if anyone can tell me if there is a way to extend this class in the app and customize these values by adding 3.0 to the list, and avoid it being overwritten with each framework update.

As I said in the past I have an application that runs on Caddy Web Server that uses http/3 as default value, and opening any page with any browser under windows, it always gives me this error in the logs, "Invalid HTTP Protocol Version. Must be one of: 1.0, 1.1, 2.0 ". , while I don't get this error using browsers under linux or android.

Honestly, I don't understand the exact reason why this occurs only with windows system, but if I add the value 3.0 to the file system/HTTP/Message.php then the error disappears and the pages open correctly.

PHP Code:
    
  
protected $ validProtocolVersions = [
        '1.0',
        '1.1',
        '2.0',
        '3.0',
    ]; 

I thank in advance anyone who could consider my report and help me solve the problem.
Reply
#4

If it is a big problem then leave an issue for the Developers on GitHub CodeIgniter 4 Development.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

Hi @chronic can you check this PR?
https://github.com/codeigniter4/CodeIgniter4/pull/6595
Reply
#6

(09-27-2022, 12:26 AM)InsiteFX Wrote: If it is a big problem then leave an issue for the Developers on GitHub CodeIgniter 4 Development.

Thanks to paulbalandan's report I see that the topic on github has already been covered by lonnieezell.
Reply
#7

That was a total fluke of timing, too. I have had that in the back of my mind for a while. I didn't see your post on the forums yesterday but had a little time last night and was looking for a quick fix I could get in and happened to remember that.

So good job with the mental control cap. Smile

Hopefully that PR will work out for you. It doesn't add any new features related to HTTP/3, but does unblock it.
Reply
#8

i'm running ci4.3.2 and this same message "...Invalid HTTP Protocol Version. Must be one of: 1.0, 1.1, 2.0, 3.0 in SYSTEMPATH/HTTP/MessageTrait.php on line 232." just appeared in my log. it doesnt say what the requested version was so maybe it would be good to change line 232 in system/http to forInvalidHTTPProtocol( 'http_version: '.$version.', allowedVersions: '........)
Reply
#9

@badger I sent a PR https://github.com/codeigniter4/CodeIgniter4/pull/7370
Reply




Theme © iAndrew 2016 - Forum software by © MyBB