~pcherenkov/udpxy/udpxy-github

« back to all changes in this revision

Viewing changes to chipmunk/uopt.c

  • Committer: Pavel Cherenkov
  • Date: 2013-01-26 15:33:24 UTC
  • Revision ID: git-v1:c667951692455d6e806f36a957f9509e58787060
README.russian corrected.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
}
52
52
 
53
53
 
 
54
inline static void
 
55
get_content_type(char *buf, size_t buflen)
 
56
{
 
57
    static const char DEFAULT_CONTENT_TYPE[] = "Content-Type:application/octet-stream";
 
58
    const char* ev = getenv("UDPXY_CONTENT_TYPE");
 
59
 
 
60
    if (ev && *ev)
 
61
        (void) snprintf(buf, buflen-1, "Content-Type:%s", ev);
 
62
    else
 
63
        strncpy(buf, DEFAULT_CONTENT_TYPE, buflen);
 
64
 
 
65
    buf[buflen - 1] = '\0';
 
66
}
 
67
 
 
68
 
54
69
/* populate options with default/initial values
55
70
 */
56
71
int
86
101
        rc = -1; /* modify rc only if there is an error */
87
102
    }
88
103
 
 
104
    get_content_type(uo->cnt_type, sizeof(uo->cnt_type));
 
105
    assert( uo->cnt_type[0] );
 
106
 
89
107
    uo->tcp_nodelay = (flag_t)get_flagval( "UDPXY_TCP_NODELAY", 1);
90
108
    return rc;
91
109
}