amphp / http

HTTP primitives which can be shared by servers and clients.
https://amphp.org/http
MIT License
88 stars 10 forks source link

Add function to split comma-separated fields #14

Closed trowski closed 1 year ago

trowski commented 4 years ago

Useful when all you care about is splitting on commas, not generating key-value pairs.

@kelunik Can you review the regex to make sure it makes sense.

kelunik commented 4 years ago

@trowski Doesn't parseFieldValueComponents do already what you're trying to implement here?

trowski commented 4 years ago

In a manner of speaking, but it splits headers like 'permessage-deflate; client_max_window_bits=15; server_max_window_bits=15, some-other-extension' into [['permessage-deflate; client_max_window_bits', '15; server_max_window_bits=15'], ['some-other-extension', '']], which isn't exactly ideal. This function would parse the header to simply ['permessage-deflate; client_max_window_bits=15; server_max_window_bits=15', 'some-other-extension'].