Root > Integral parts > Options > Report sending page > HTTP upload

HTTP upload

Previous pageReturn to chapter overviewNext page   

This is setup options for HTTP upload send method (wsmHTTP). They are located at Sending tab.

 

Note: HTTP upload can be used to send bug reports to a facade for a bug tracker. See example for FogBugz. See example for Jira. See generic examples.

 

 

HTTP upload send method options

 

1. "URL" (.SendHTTPURL) option specifies target URL for file upload. Usually, it's script name on web server. See description of HTTP upload method for discussion of upload scripts. Do not add here "http://" or ":80" parts here. Specify only domain name (or IP), path and script name. Example: www.example.com/folder/upload.php

 

Warning: be sure to setup adequate maximum upload file limits in your web-server/script configuration. Otherwise sending may fail on large bug reports.

 

 

2. "Port" (.SendHTTPPort) option specifies HTTP port on web server. It's 80 by default. Other common value is 8080. For SSL/TLS it's usually 443.

 

 

3. "SSL / TLS" (.SendHTTPSSL) option enabled secure mode (HTTPS protocol). Don't forget to adjust port number, if you change this checkbox.

 

 

4. "Method" (.SendHTTPMethod) option specifies type of HTTP request being sent. Default is 'POST'. Please, refer to your receiving side (e.g. script at the specified URL) to learn which method should be used.

 

 

4. "BasicAuth" (.SendHTTPAuthLogin, .SendHTTPAuthPassword) options specify account details for Basic-Auth type authentication. Usually these fields are blank. Fill them, if you use Basic-Auth on your web server.

 

Warning: your real account's data will be stored inside application. Even if it's encrypted - it's still stored inside .exe, so it can be stolen. Create a new special account for bug reporting via this method. See also: Security Considerations.

 

 

6. "Proxy" (.SendHTTPProxyHost, .SendHTTPProxyPort, .SendHTTPProxyLogin, .SendHTTPProxyPassword) options specify proxy details. You can leave them blank to use system-provided settings. Or you can fill these values to set custom proxy.

 

 

7. "HTTP Headers" (.SendHTTPHeaders) option specifies additional HTTP headers to pass to the server on the specified URL. Each header must be placed on standalone line. Field name and value are separated by the ': ' ('colon' and 'space') characters.

 

These may be required by your receiving side. For example, if you are going to send bug report to Jira - you may use something like:

 

Origin: https://test.atlassian.net

Content-Type: application/x-www-form-urlencoded;charset=utf-8

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Sec-Fetch-Site: same-origin

Sec-Fetch-Mode: navigate

Sec-Fetch-User: ?1

Sec-Fetch-Dest: iframe

Referer: https://test.atlassian.net/rest/collectors/1.0/template/form/ffffffff

 

You can also specify headers in the OnCustomWebFieldsRequest event handler. For example:

 

uses
  EEvents, EConsts;
 
procedure SetHTTPHeaders(const ACustom: Pointer; AExceptionInfo: TEurekaExceptionInfo;
  ASender: TObject; AWebFields: TStrings; var ACallNextHandler: Boolean);
begin
  AWebFields.Values[sifHTTPHeaders + 'Origin'] :=

    'https://test.atlassian.net';
  AWebFields.Values[sifHTTPHeaders + 'Content-Type'] :=

    'application/x-www-form-urlencoded;charset=utf-8';
  AWebFields.Values[sifHTTPHeaders + 'Sec-Fetch-Site'] :=

    'same-origin';
  AWebFields.Values[sifHTTPHeaders + 'Sec-Fetch-Mode'] :=

    'navigate';
  AWebFields.Values[sifHTTPHeaders + 'Sec-Fetch-User'] :=

    '?1';
  AWebFields.Values[sifHTTPHeaders + 'Sec-Fetch-Dest'] :=

    'iframe';
  AWebFields.Values[sifHTTPHeaders + 'Referer'] :=

    'https://test.atlassian.net/rest/collectors/1.0/template/form/ffffffff';
end;
 
initialization
  // Define HTTP headers
  RegisterEventCustomWebFieldsRequest(nil, SetHTTPHeaders);
end

 

Important Note: if you override the Content-Type header with the application/x-www-form-urlencoded value - EurekaLog will send web fields, but will not upload any files. That is because application/x-www-form-urlencoded does not support file attaches. If you are going to use application/x-www-form-urlencoded - you will need to upload files by other means. A practical example can be found here.

 

 

8. "HTML Fields" (.SendHTTPFields) option specifies static web-form fields to send. Each field must be placed on standalone line. Field name and value are separated by the '=' ('equal') character.

 

Typically you would use OnCustomWebFieldsRequest event handler to set up web fields. However, if you have bunch of static fields (such as project ID, etc.) - you can set those here.

 

Fields names and values depend on your receiving URL. For example, when using HTTP upload to post bugs to FogBugz, you can put the following static fields here:

 

command=new

honeyInput=

honeyTextArea=

ixScreenshot=-1

fPublic=1

OK=OK

ixProject=3

ixArea=8

 

and then use the following code to set dynamic fields:

 

uses

  EEvents, ETypes, EConsts, EClasses, ESend, ESendWeb, ESendWebHTTP;

 

procedure SetCustomFields(const ACustom: Pointer; AExceptionInfo: TEurekaExceptionInfo; 

  ASender: TObject; AWebFields: TStrings; var ACallNextHandler: Boolean);

var

  Options: TEurekaModuleOptions;

  AttachedFiles: TStringList;

begin

  Options := nil;

  AttachedFiles := TStringList.Create;

  try

    if ASender is TELUniversalSender then

    begin

      Options := TELUniversalSender(ASender).Options;

      AttachedFiles.Assign(TELUniversalSender(ASender).AttachedFiles);

    end

    else

      Options := TEurekaModuleOptions.Create('');

 

    // hidden fields:

    AWebFields.Values['dblTimeStamp'] := FloatToStr(Now);

 

    // fixed fields:

    AWebFields.Values['sTitle'] := ComposeTitle(Options);

    AWebFields.Values['sEvent'] := ComposeMessage(Options);

    AWebFields.Values['sCustomerEmail'] := Options.CustomField[sifUserEMail];

    AWebFields.Values['sVersion'] := Options.CustomField[sifBugAppVersion];

    AWebFields.Values['sComputer'] := Options.CustomField[sifMachineID];

    AWebFields.Values['nFileCount'] := IntToStr(AttachedFiles.Count);

    Options.CustomField[sifHTTPFileNameTemplate] := 'File%d';

 

  finally

    FreeAndNil(AttachedFiles);

    if not (ASender is TELUniversalSender) then

      FreeAndNil(Options);

  end;

end;

 

initialization

  RegisterEventCustomWebFieldsRequest(nil, SetCustomFields);

end.

 

 

See also:

HTTP upload send method for general description of this send method



Send feedback... Build date: 2024-09-30
Last edited: 2023-03-07
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.


Permanent link to this article: https://www.eurekalog.com/help/eurekalog/send_options_http.php