erlyaws / yaws

Yaws webserver
https://erlyaws.github.io
BSD 3-Clause "New" or "Revised" License
1.28k stars 267 forks source link

Store the current appmod name in the #arg{} record #388

Closed etnt closed 5 years ago

etnt commented 5 years ago

The reason for this is to make it possible for the extra_response_header callback to know in which appmod context it is executing and hence be able to return the proper set of extra HTTP headers.

vinoski commented 5 years ago

Seems reasonable, I'll merge it shortly.

vinoski commented 5 years ago

BTW the Travis-CI failure noted here was transient — I reran it and it passed.

vinoski commented 5 years ago

I have a counterproposal: instead of adding a new field to #arg, we could instead add a new function to yaws_api that would take an #arg record and return the appmod name if valid, or undefined otherwise? The reason I'd prefer this counterproposal approach is that the information is already present in the #arg record, so there's little point in adding a new field for it.

etnt commented 5 years ago

Hm...are you sure? The yaws_server:url_type/3 function looks rather complex... But, if there is an equivalent (and not too heavy) function, that can get me the appmod info, then I'm fine with that.