Hi,
in order to avoid the ugliness of things like:
r->protocol = (char*)"HTTP/1.0";
does the following proposal makes sense to you?
Does turning a "char *" to a "const char *" in a struct defined in
include/httpd.h in considered as a API change?
CJ
=====================================
Index: include/httpd.h
===================================================================
--- include/httpd.h (révision 1728552)
+++ include/httpd.h (copie de travail)
@@ -826,7 +826,7 @@
/** Protocol version number of protocol; 1.1 = 1001 */
int proto_num;
/** Protocol string, as given to us, or HTTP/0.9 */
- char *protocol;
+ const char *protocol;
/** Host, as set by full URI or Host: header.
* For literal IPv6 addresses, this does NOT include the
surrounding [ ]
*/
Index: modules/http2/h2_request.c
===================================================================
--- modules/http2/h2_request.c (révision 1728552)
+++ modules/http2/h2_request.c (copie de travail)
@@ -408,7 +408,7 @@
}
ap_parse_uri(r, req->path);
- r->protocol = (char*)"HTTP/2";
+ r->protocol = "HTTP/2";
r->proto_num = HTTP_VERSION(2, 0);
r->the_request = apr_psprintf(r->pool, "%s %s %s",
Index: modules/proxy/mod_proxy_hcheck.c
===================================================================
--- modules/proxy/mod_proxy_hcheck.c (révision 1728552)
+++ modules/proxy/mod_proxy_hcheck.c (copie de travail)
@@ -393,7 +393,7 @@
r->header_only = 0;
}
- r->protocol = (char*)"HTTP/1.0";
+ r->protocol = "HTTP/1.0";
r->proto_num = HTTP_VERSION(1, 0);
r->hostname = NULL;
Index: server/protocol.c
===================================================================
--- server/protocol.c (révision 1728552)
+++ server/protocol.c (copie de travail)
@@ -614,7 +614,7 @@
r->status = HTTP_BAD_REQUEST;
}
r->proto_num = HTTP_VERSION(1,0);
- r->protocol = apr_pstrdup(r->pool, "HTTP/1.0");
+ r->protocol = "HTTP/1.0";
return 0;
}
} while ((len <= 0) && (--num_blank_lines >= 0));
@@ -634,7 +634,7 @@
if (!*r->method || !*uri) {
r->status = HTTP_BAD_REQUEST;
r->proto_num = HTTP_VERSION(1,0);
- r->protocol = apr_pstrdup(r->pool, "HTTP/1.0");
+ r->protocol = "HTTP/1.0";
return 0;
}
@@ -648,7 +648,7 @@
ap_parse_uri(r, uri);
if (r->status != HTTP_OK) {
r->proto_num = HTTP_VERSION(1,0);
- r->protocol = apr_pstrdup(r->pool, "HTTP/1.0");
+ r->protocol = "HTTP/1.0";
return 0;
}
@@ -687,7 +687,7 @@
"Invalid protocol '%s'", r->protocol);
if (enforce_strict) {
r->proto_num = HTTP_VERSION(1,0);
- r->protocol = apr_pstrdup(r->pool, "HTTP/1.0");
+ r->protocol = "HTTP/1.0";
r->connection->keepalive = AP_CONN_CLOSE;
r->status = HTTP_BAD_REQUEST;
return 0;