Removed HTTP_CLIENT_SESSION.post_multipart .. because it was not doing what the name might evoque

Restrict export of HTTP_CLIENT_REQUEST_CONTEXT.upload_data and upload_filename (and related) to .._SESSION and .._REQUEST
   this is mainly internal data, and is more about implementation than interface
This commit is contained in:
Jocelyn Fiat
2012-05-04 12:37:51 +02:00
parent 4508a76683
commit 3a979915f5
3 changed files with 46 additions and 44 deletions

View File

@@ -43,34 +43,12 @@ feature -- Basic operation
post (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
do
Result := post_multipart (a_path, a_ctx, data, Void)
Result := impl_post (a_path, a_ctx, data, Void)
end
post_file (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
do
Result := post_multipart (a_path, a_ctx, Void, fn)
end
post_multipart (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
local
req: HTTP_CLIENT_REQUEST
ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT
do
ctx := a_ctx
if data /= Void then
if ctx = Void then
create ctx.make
end
ctx.set_upload_data (data)
end
if fn /= Void then
if ctx = Void then
create ctx.make
end
ctx.set_upload_filename (fn)
end
create {LIBCURL_HTTP_CLIENT_REQUEST} req.make (base_url + a_path, "POST", Current, ctx)
Result := req.execute
Result := impl_post (a_path, a_ctx, Void, fn)
end
put (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
@@ -113,6 +91,30 @@ feature -- Basic operation
Result := req.execute
end
feature {NONE} -- Implementation
impl_post (a_path: READABLE_STRING_8; a_ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT; data: detachable READABLE_STRING_8; fn: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
local
req: HTTP_CLIENT_REQUEST
ctx: detachable HTTP_CLIENT_REQUEST_CONTEXT
do
ctx := a_ctx
if data /= Void then
if ctx = Void then
create ctx.make
end
ctx.set_upload_data (data)
end
if fn /= Void then
if ctx = Void then
create ctx.make
end
ctx.set_upload_filename (fn)
end
create {LIBCURL_HTTP_CLIENT_REQUEST} req.make (base_url + a_path, "POST", Current, ctx)
Result := req.execute
end
feature {LIBCURL_HTTP_CLIENT_REQUEST} -- Curl implementation
curl: CURL_EXTERNALS