}
}
- if (cfg) {
- if (cfg->appPrefix) {
+ if (cfg != NULL) {
+ if (cfg->appPrefix != NULL) {
if (!NGBufferedDescriptor_writeHttpHeader(toApp,
"x-webobjects-adaptor-prefix", cfg->appPrefix)) {
writeError = 1;
goto writeErrorHandler;
}
- apr_snprintf(tmp, sizeof(tmp), "%i", r->server->port);
- if (!NGBufferedDescriptor_writeHttpHeader(toApp,
- "x-webobjects-server-port",
- tmp)) {
- writeError = 1;
- goto writeErrorHandler;
+ if (r->server->port != 0) {
+ apr_snprintf(tmp, sizeof(tmp), "%i", r->server->port);
+ if (!NGBufferedDescriptor_writeHttpHeader(toApp,
+ "x-webobjects-server-port",
+ tmp)) {
+ writeError = 1;
+ goto writeErrorHandler;
+ }
}
// TODO: this seems to be broken with some Apache's!
// see: http://www.mail-archive.com/modssl-users@modssl.org/msg16396.html
- apr_snprintf(tmp, sizeof(tmp), "%s://%s:%i",
- ap_http_method(r),
- r->server->server_hostname,
- r->server->port);
+ if (r->server->port != 0) {
+ apr_snprintf(tmp, sizeof(tmp), "%s://%s:%i",
+ ap_http_method(r),
+ r->server->server_hostname,
+ r->server->port);
+ }
+ else {
+ apr_snprintf(tmp, sizeof(tmp), "%s://%s",
+ ap_http_method(r), r->server->server_hostname);
+ }
if (!NGBufferedDescriptor_writeHttpHeader(toApp,
"x-webobjects-server-url",
tmp)) {