Bellow are the step on how to create a patch in FreeBSD:
1. Run make patch to extract and apply patches that live in files/
2. Go to work/hiawatha-10.1/src and cp http.c http.c.orig then edit http.c and apply the fix
3. Go back to /usr/ports/www/hiawatha
4. Run make makepatch. This will generate a patch file in files/patch-src_http.c. You can save this for later or submit it to the port maintainer.
5. It's safe to run make clean now. If you later reinstall the port the patch will be automatically applied.
6. Build your port as you normally would.
Bellow is the patch that I generated.. It should save you some time:
files/patch-src_http.c
--- src/http.c.orig 2016-04-14 21:06:12 UTC
+++ src/http.c
@@ -845,9 +845,8 @@ int last_forwarded_ip(t_http_header *htt
/* Forwarded header
*/
begin = NULL;
- while ((forwarded = strcasestr(forwarded, "for=")) == NULL) {
- begin = forwarded;
- forwarded++;
+ while ((forwarded = strcasestr(forwarded, "for=")) != NULL) {
+ begin = forwarded + 4;
}
if (begin == NULL) {