<commit_before>#!/usr/bin/env python

from subprocess import Popen, PIPE
import os
import sys

nmsgtool = 'nmsgtool -c 1 -V ISC -T emailhdr -f - -s 127.0.0.1/8430'

srcip = os.getenv('CLIENT_ADDRESS')
srchost = os.getenv('CLIENT_HOSTNAME')
helo = os.getenv('CLIENT_HELO')
fro = os.getenv('SENDER')
rcpt = os.getenv('ORIGINAL_RECIPIENT')

headers = []

for line in sys.stdin:
    if line == '\n':
        break
    headers.append(line.strip())

headers = '\n'.join(headers)

p = Popen(nmsgtool, shell=True, stdin=PIPE)

if srcip:
    p.stdin.write('srcip: %s\n' % srcip)
if srchost:
    p.stdin.write('srchost: %s\n' % srchost)
if helo:
    p.stdin.write('helo: %s\n' % helo)<commit_msg>emailhdr_postfix_client: don't strip leading whitespace from headers<commit_after>#!/usr/bin/env python

from subprocess import Popen, PIPE
import os
import sys

nmsgtool = 'nmsgtool -c 1 -V ISC -T emailhdr -f - -s 127.0.0.1/8430'

srcip = os.getenv('CLIENT_ADDRESS')
srchost = os.getenv('CLIENT_HOSTNAME')
helo = os.getenv('CLIENT_HELO')
fro = os.getenv('SENDER')
rcpt = os.getenv('ORIGINAL_RECIPIENT')

headers = []

for line in sys.stdin:
    if line == '\n':
        break
    headers.append(line.strip('\n'))

headers = '\n'.join(headers)

p = Popen(nmsgtool, shell=True, stdin=PIPE)

if srcip:
    p.stdin.write('srcip: %s\n' % srcip)
if srchost:
    p.stdin.write('srchost: %s\n' % srchost)
if helo:
    p.stdin.write('helo: %s\n' % helo)
{'fraction_non_alphanumeric': 0.16561844863731656, 'fraction_numerical': 0.015373864430468204, 'mean_word_length': 3.7733333333333334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4422009', 'n_tokens_mistral': 625, 'n_tokens_neox': 609, 'n_words': 131}