Hi list,
As of today, most of the SAPIs have a lot of code duplication with
regards to HTTP headers parsing/handling.
I'm about to completely duplicate a function from one SAPI to the
other to add a feature to fpm (getallheaders()
, see
https://github.com/php/php-src/pull/523), and I'd like to avoid that.
Should I create a sapi/main/
folder for common functions across the
SAPIs? Or should each SAPI remain completely independent from each
other, even if it means duplicating code?
Regards,
--
Florian Margaine
Hi list,
As of today, most of the SAPIs have a lot of code duplication with
regards to HTTP headers parsing/handling.I'm about to completely duplicate a function from one SAPI to the
other to add a feature to fpm (getallheaders()
, see
https://github.com/php/php-src/pull/523), and I'd like to avoid that.Should I create a
sapi/main/
folder for common functions across the
SAPIs? Or should each SAPI remain completely independent from each
other, even if it means duplicating code?Regards,
Morning Florian,
There is already a place to put shared SAPI code.
main/SAPI.h
main/SAPI.c
There is also a SAPI_API decl that you will need to use.
Cheers
Joe
>
> > Hi list,
> >
> > As of today, most of the SAPIs have a lot of code duplication with
> > regards to HTTP headers parsing/handling.
> >
> > I'm about to completely duplicate a function from one SAPI to the
> > other to add a feature to fpm (`getallheaders()`, see
> > https://github.com/php/php-src/pull/523), and I'd like to avoid that.
> >
> > Should I create a `sapi/main/` folder for common functions across the
> > SAPIs? Or should each SAPI remain completely independent from each
> > other, even if it means duplicating code?
> >
> > Regards,
> >
>
> Morning Florian,
>
> There is already a place to put shared SAPI code.
>
> main/SAPI.h
> main/SAPI.c
>
> There is also a SAPI_API decl that you will need to use.
>
Thanks!
>
> Cheers
> Joe
>
>
Cheers,
--
Florian Margaine