<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>139097</bug_id>
          
          <creation_ts>2014-11-29 01:51:11 -0800</creation_ts>
          <short_desc>Problem in modify a request of a redirected page in resource-request-starting signal</short_desc>
          <delta_ts>2014-11-29 01:51:11 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Page Loading</component>
          <version>420+</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Other</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sebastien Marie">semarie</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1051306</commentid>
    <comment_count>0</comment_count>
    <who name="Sebastien Marie">semarie</who>
    <bug_when>2014-11-29 01:51:11 -0800</bug_when>
    <thetext>Hi,

According to the documentation, the resource-request-starting signal is the place where modification of request may occurs.

This works great, but in the case of a redirection, the modification don&apos;t come back to web_view (or any other compoment) whereas the request is done at good place.

I wrote a minimal test-case at https://github.com/semarie/webkit-change-uri
The test-case exhibe two differents comportements (faulty one, and good one):

The odd one (request modification after redirection):
 - webkit_web_view_load_uri http://bit.ly/1sXuZsu (it is a redirection to http://projects.dm.id.lv/s/hsts-testresult.html)
 - in resource-request-starting callback,
     rewrite http://projects.dm.id.lv/s/hsts-testresult.html request to https://projects.dm.id.lv/s/hsts-testresult.html
     (so, after redirection occurs)

The page displayed is https://projects.dm.id.lv/s/hsts-testresult.html
The uri (webkit_web_view_get_uri) is http://projects.dm.id.lv/s/hsts-testresult.html

Please note the http in uri whereas the page displayed is the https one.

Full trace:
$ ./change-uri http://bit.ly/1sXuZsu
notify::load-status: WEBKIT_LOAD_PROVISIONAL: (null)
resource-request-starting: uri=http://bit.ly/1sXuZsu
resource-request-starting: uri=http://projects.dm.id.lv/s/hsts-testresult.html
resource-request-starting: switch projects.dm.id.lv from HTTP to HTTPS
notify::load-status: WEBKIT_LOAD_COMMITTED: http://projects.dm.id.lv/s/hsts-testresult.html
resource-request-starting: uri=http://projects.dm.id.lv/favicon.ico
resource-request-starting: switch projects.dm.id.lv from HTTP to HTTPS
notify::load-status: WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT: http://projects.dm.id.lv/s/hsts-testresult.html
notify::load-status: WEBKIT_LOAD_FINISHED: http://projects.dm.id.lv/s/hsts-testresult.html
resource-request-starting: uri=https://projects.dm.id.lv/Favicon.ico


A Usual (and good) one (classical request modification):
 - webkit_web_view_load_uri http://projects.dm.id.lv/s/hsts-testresult.html
 - in resource-request-starting callback,
     rewrite http://projects.dm.id.lv/s/hsts-testresult.html request to https://projects.dm.id.lv/s/hsts-testresult.html

The page displayed is https://projects.dm.id.lv/s/hsts-testresult.html
The uri (webkit_web_view_get_uri) is https://projects.dm.id.lv/s/hsts-testresult.html

Full trace:
$ ./change-uri http://projects.dm.id.lv/s/hsts-testresult.html
notify::load-status: WEBKIT_LOAD_PROVISIONAL: (null)
resource-request-starting: uri=http://projects.dm.id.lv/s/hsts-testresult.html
resource-request-starting: switch projects.dm.id.lv from HTTP to HTTPS
notify::load-status: WEBKIT_LOAD_COMMITTED: https://projects.dm.id.lv/s/hsts-testresult.html
resource-request-starting: uri=https://projects.dm.id.lv/favicon.ico
notify::load-status: WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT: https://projects.dm.id.lv/s/hsts-testresult.html
notify::load-status: WEBKIT_LOAD_FINISHED: https://projects.dm.id.lv/s/hsts-testresult.html
resource-request-starting: uri=https://projects.dm.id.lv/Favicon.ico

Thanks.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>